File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 58
58
python-version : " 3.7 - 3.10"
59
59
update-environment : true
60
60
61
+ - name : Set __release__
62
+ if : startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
63
+ run : |
64
+ sed -i -E 's/^__release__\s*=.*$/__release__ = True/' torchopt/version.py
65
+
66
+ - name : Print version
67
+ run : python setup.py --version
68
+
61
69
- name : Install dependencies
62
70
run : python -m pip install --upgrade pip setuptools wheel build
63
71
83
91
submodules : " recursive"
84
92
fetch-depth : 0
85
93
94
+ - name : Set up Python
95
+ id : py
96
+ uses : actions/setup-python@v4
97
+ with :
98
+ python-version : " 3.7 - 3.10"
99
+ update-environment : true
100
+
101
+ - name : Set __release__
102
+ if : startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
103
+ run : |
104
+ sed -i -E 's/^__release__\s*=.*$/__release__ = True/' torchopt/version.py
105
+
106
+ - name : Print version
107
+ run : python setup.py --version
108
+
86
109
- name : Build wheels
87
110
uses : pypa/cibuildwheel@v2.8.1
88
111
with :
Original file line number Diff line number Diff line change 15
15
"""TorchOpt: a high-performance optimizer library built upon PyTorch."""
16
16
17
17
__version__ = '0.5.0'
18
+ __license__ = 'Apache License, Version 2.0'
19
+ __author__ = 'TorchOpt Contributors'
20
+ __release__ = False
21
+
22
+ if not __release__ :
23
+ import os
24
+ import subprocess
25
+
26
+ try :
27
+ prefix , sep , suffix = (
28
+ subprocess .check_output (
29
+ ['git' , 'describe' , '--abbrev=7' ],
30
+ cwd = os .path .dirname (os .path .abspath (__file__ )),
31
+ stderr = subprocess .DEVNULL ,
32
+ universal_newlines = True ,
33
+ )
34
+ .strip ()
35
+ .lstrip ('v' )
36
+ .replace ('-' , '.dev' , 1 )
37
+ .replace ('-' , '+' , 1 )
38
+ .partition ('.dev' )
39
+ )
40
+ if sep :
41
+ version_prefix , dot , version_tail = prefix .rpartition ('.' )
42
+ prefix = f'{ version_prefix } { dot } { int (version_tail ) + 1 } '
43
+ __version__ = sep .join ((prefix , suffix ))
44
+ del version_prefix , dot , version_tail
45
+ else :
46
+ __version__ = prefix
47
+ del prefix , sep , suffix
48
+ except (OSError , subprocess .CalledProcessError ):
49
+ pass
50
+
51
+ del os , subprocess
You can’t perform that action at this time.
0 commit comments