File tree Expand file tree Collapse file tree 8 files changed +102
-106
lines changed Expand file tree Collapse file tree 8 files changed +102
-106
lines changed Original file line number Diff line number Diff line change @@ -25,27 +25,25 @@ jobs:
25
25
with :
26
26
python-version : ${{ matrix.python-version }}
27
27
28
+ - name : Install Python dependencies
29
+ run : pip install build
30
+
28
31
- name : Install wpiformat
29
32
run : |
30
33
cd wpiformat
31
- pip install -e .
34
+ python -m build --wheel
35
+ pip install dist/*.whl
36
+ shell : bash
32
37
33
38
- name : Install test dependencies
34
- shell : bash
35
- run : |
36
- if [ "$RUNNER_OS" == "Windows" ]; then
37
- # This pytest dependency is installed manually with bash because the
38
- # installation prints to stderr. Prints to stderr cause Powershell to
39
- # report a nonzero return code and cause the tests to fail.
40
- pip install wheel iniconfig
41
- fi
39
+ run : pip install tox
42
40
43
41
- name : Run unit tests
44
42
run : |
45
43
git config --global user.email "[email protected] "
46
44
git config --global user.name "Your Name"
47
45
cd wpiformat
48
- python setup.py test
46
+ tox
49
47
50
48
- name : wpiformat - whole repo
51
49
run : |
@@ -127,10 +125,10 @@ jobs:
127
125
python-version : ' 3.10'
128
126
129
127
- name : Install Python dependencies
130
- run : pip install wheel
128
+ run : pip install build
131
129
132
130
- name : Build package
133
- run : python setup.py bdist_wheel
131
+ run : python -m build
134
132
working-directory : wpiformat
135
133
136
134
- name : Upload package to PyPi
Original file line number Diff line number Diff line change @@ -137,13 +137,13 @@ local.properties
137
137
.loadpath
138
138
139
139
# ## Python ###
140
+ * .egg-info /
140
141
.eggs /
141
142
.pytest_cache /
143
+ .tox /
144
+ __pycache__ /
142
145
build /
143
146
dist /
144
- __pycache__
145
- * .egg-info /
146
- version.py
147
147
148
148
# External tool builders
149
149
.externalToolBuilders /
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ [project ]
2
+ name = " wpiformat"
3
+ description = " Linters and formatters for ensuring WPILib's source code conforms to its style guide"
4
+ dynamic = [ " version" ]
5
+ readme = " README.rst"
6
+ dependencies = [
7
+ " regex==2022.9.13" ,
8
+ " black==23.3.0" ,
9
+ " clang-format==16.0.4" ,
10
+ " clang-tidy==15.0.2.1"
11
+ ]
12
+ classifiers = [
13
+ " Development Status :: 5 - Production/Stable" ,
14
+ " Intended Audience :: Developers" ,
15
+ " Intended Audience :: Education" ,
16
+ " License :: OSI Approved :: BSD License" ,
17
+ " Operating System :: OS Independent" ,
18
+ " Topic :: Scientific/Engineering" ,
19
+ " Programming Language :: Python :: 3"
20
+ ]
21
+
22
+ [project .license ]
23
+ text = " BSD-3-Clause"
24
+
25
+ [[project .maintainers ]]
26
+ name = " Tyler Veness"
27
+
28
+
29
+ [project .urls ]
30
+ Homepage = " https://github.com/wpilibsuite/styleguide"
31
+
32
+ [project .scripts ]
33
+ wpiformat = " wpiformat:main"
34
+
35
+ [build-system ]
36
+ requires = [
37
+ " clang-format==16.0.4" ,
38
+ " clang-tidy==15.0.2.1" ,
39
+ " regex==2022.9.13" ,
40
+ " setuptools>=61.0" ,
41
+ " setuptools-git-versioning"
42
+ ]
43
+ build-backend = " setuptools.build_meta"
44
+
45
+ [tool .setuptools-git-versioning ]
46
+ enabled = true
47
+ version_callback = " wpiformat.version:get_version"
48
+
49
+ [tool .pytest .ini_options ]
50
+ minversion = " 6.0"
51
+ testpaths = [ " wpiformat/test" ]
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ [tox]
2
+ min_version = 4.0
3
+ env_list =
4
+ py38
5
+ py39
6
+ py310
7
+ py311
8
+
9
+ [testenv]
10
+ deps = pytest
11
+ commands = pytest
Original file line number Diff line number Diff line change
1
+ from datetime import date
2
+ import subprocess
3
+
4
+
5
+ def get_version ():
6
+ proc = subprocess .run (
7
+ [
8
+ "git" ,
9
+ "rev-list" ,
10
+ "--count" ,
11
+ # Includes previous year's commits in case one was merged after the
12
+ # year incremented. Otherwise, the version wouldn't increment.
13
+ '--after="main@{' + str (date .today ().year - 1 ) + '-01-01}"' ,
14
+ "main" ,
15
+ ],
16
+ check = True ,
17
+ encoding = "utf-8" ,
18
+ stdout = subprocess .PIPE ,
19
+ )
20
+ # If there is no main branch, the commit count defaults to 0
21
+ if proc .returncode :
22
+ commit_count = "0"
23
+ else :
24
+ commit_count = proc .stdout .rstrip ()
25
+
26
+ # Version number: <year>.<# commits on main>
27
+ return f"{ date .today ().year } .{ commit_count } "
You can’t perform that action at this time.
0 commit comments