@@ -45,8 +45,8 @@ def write_version_file(version):
45
45
f .write (f"__version__ = '{ version } '\n " )
46
46
f .write (f"git_version = { repr (sha )} \n " )
47
47
f .write (f"pytorch_version = '{ pytorch_version } '\n " )
48
-
49
- logging .info (f "Version file written successfully" )
48
+
49
+ logging .info ("Version file written successfully" )
50
50
51
51
52
52
class clean (Command ):
@@ -151,7 +151,12 @@ def _main():
151
151
# For regular builds, append git hash for development versions
152
152
try :
153
153
import subprocess
154
- git_sha = subprocess .check_output (["git" , "rev-parse" , "HEAD" ], cwd = cwd ).decode ("ascii" ).strip ()[:7 ]
154
+
155
+ git_sha = (
156
+ subprocess .check_output (["git" , "rev-parse" , "HEAD" ], cwd = cwd )
157
+ .decode ("ascii" )
158
+ .strip ()[:7 ]
159
+ )
155
160
version = f"{ base_version } +{ git_sha } "
156
161
logging .info (f"Using development version: { version } " )
157
162
except Exception :
@@ -161,15 +166,17 @@ def _main():
161
166
# Always write the version file to ensure it's up to date
162
167
write_version_file (version )
163
168
logging .info (f"Building torchrl-{ version } " )
164
-
169
+
165
170
# Verify the version file was written correctly
166
171
try :
167
- with open (os .path .join (cwd , "torchrl" , "version.py" ), "r" ) as f :
172
+ with open (os .path .join (cwd , "torchrl" , "version.py" )) as f :
168
173
content = f .read ()
169
174
if f"__version__ = '{ version } '" in content :
170
175
logging .info (f"Version file correctly contains: { version } " )
171
176
else :
172
- logging .error (f"Version file does not contain expected version: { version } " )
177
+ logging .error (
178
+ f"Version file does not contain expected version: { version } "
179
+ )
173
180
except Exception as e :
174
181
logging .error (f"Failed to verify version file: { e } " )
175
182
@@ -178,7 +185,7 @@ def _main():
178
185
package_name = "torchrl-nightly" # Use torchrl-nightly for PyPI uploads
179
186
else :
180
187
package_name = "torchrl" # Use torchrl for regular builds and GitHub discovery
181
-
188
+
182
189
setup_kwargs = {
183
190
"name" : package_name ,
184
191
# Only C++ extension configuration
@@ -193,7 +200,7 @@ def _main():
193
200
},
194
201
"include_package_data" : True ,
195
202
}
196
-
203
+
197
204
# Handle nightly tensordict dependency override
198
205
if is_nightly :
199
206
setup_kwargs ["install_requires" ] = [
@@ -207,25 +214,29 @@ def _main():
207
214
# Override pyproject.toml settings for nightly builds
208
215
if is_nightly :
209
216
# Add all the metadata from pyproject.toml but override the name
210
- setup_kwargs .update ({
211
- "description" : "A modular, primitive-first, python-first PyTorch library for Reinforcement Learning" ,
212
- "long_description" : (Path (__file__ ).parent / "README.md" ).read_text (encoding = "utf8" ),
213
- "long_description_content_type" : "text/markdown" ,
214
- "author" : "torchrl contributors" ,
215
- "author_email" : "vmoens@fb.com" ,
216
- "url" : "https://github.com/pytorch/rl" ,
217
- "classifiers" : [
218
- "Programming Language :: Python :: 3.9" ,
219
- "Programming Language :: Python :: 3.10" ,
220
- "Programming Language :: Python :: 3.11" ,
221
- "Programming Language :: Python :: 3.12" ,
222
- "Operating System :: OS Independent" ,
223
- "Development Status :: 4 - Beta" ,
224
- "Intended Audience :: Developers" ,
225
- "Intended Audience :: Science/Research" ,
226
- "Topic :: Scientific/Engineering :: Artificial Intelligence" ,
227
- ],
228
- })
217
+ setup_kwargs .update (
218
+ {
219
+ "description" : "A modular, primitive-first, python-first PyTorch library for Reinforcement Learning" ,
220
+ "long_description" : (Path (__file__ ).parent / "README.md" ).read_text (
221
+ encoding = "utf8"
222
+ ),
223
+ "long_description_content_type" : "text/markdown" ,
224
+ "author" : "torchrl contributors" ,
225
+ "author_email" : "vmoens@fb.com" ,
226
+ "url" : "https://github.com/pytorch/rl" ,
227
+ "classifiers" : [
228
+ "Programming Language :: Python :: 3.9" ,
229
+ "Programming Language :: Python :: 3.10" ,
230
+ "Programming Language :: Python :: 3.11" ,
231
+ "Programming Language :: Python :: 3.12" ,
232
+ "Operating System :: OS Independent" ,
233
+ "Development Status :: 4 - Beta" ,
234
+ "Intended Audience :: Developers" ,
235
+ "Intended Audience :: Science/Research" ,
236
+ "Topic :: Scientific/Engineering :: Artificial Intelligence" ,
237
+ ],
238
+ }
239
+ )
229
240
230
241
setup (** setup_kwargs )
231
242
0 commit comments