-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace setup.py with pyproject.toml (#244)
- Loading branch information
Showing
8 changed files
with
102 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,27 +25,25 @@ jobs: | |
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Python dependencies | ||
run: pip install build | ||
|
||
- name: Install wpiformat | ||
run: | | ||
cd wpiformat | ||
pip install -e . | ||
python -m build --wheel | ||
pip install dist/*.whl | ||
shell: bash | ||
|
||
- name: Install test dependencies | ||
shell: bash | ||
run: | | ||
if [ "$RUNNER_OS" == "Windows" ]; then | ||
# This pytest dependency is installed manually with bash because the | ||
# installation prints to stderr. Prints to stderr cause Powershell to | ||
# report a nonzero return code and cause the tests to fail. | ||
pip install wheel iniconfig | ||
fi | ||
run: pip install tox | ||
|
||
- name: Run unit tests | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Your Name" | ||
cd wpiformat | ||
python setup.py test | ||
tox | ||
- name: wpiformat - whole repo | ||
run: | | ||
|
@@ -127,10 +125,10 @@ jobs: | |
python-version: '3.10' | ||
|
||
- name: Install Python dependencies | ||
run: pip install wheel | ||
run: pip install build | ||
|
||
- name: Build package | ||
run: python setup.py bdist_wheel | ||
run: python -m build | ||
working-directory: wpiformat | ||
|
||
- name: Upload package to PyPi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[project] | ||
name = "wpiformat" | ||
description = "Linters and formatters for ensuring WPILib's source code conforms to its style guide" | ||
dynamic = [ "version" ] | ||
readme = "README.rst" | ||
dependencies = [ | ||
"regex==2022.9.13", | ||
"black==23.3.0", | ||
"clang-format==16.0.4", | ||
"clang-tidy==15.0.2.1" | ||
] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Education", | ||
"License :: OSI Approved :: BSD License", | ||
"Operating System :: OS Independent", | ||
"Topic :: Scientific/Engineering", | ||
"Programming Language :: Python :: 3" | ||
] | ||
|
||
[project.license] | ||
text = "BSD-3-Clause" | ||
|
||
[[project.maintainers]] | ||
name = "Tyler Veness" | ||
email = "[email protected]" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/wpilibsuite/styleguide" | ||
|
||
[project.scripts] | ||
wpiformat = "wpiformat:main" | ||
|
||
[build-system] | ||
requires = [ | ||
"clang-format==16.0.4", | ||
"clang-tidy==15.0.2.1", | ||
"regex==2022.9.13", | ||
"setuptools>=61.0", | ||
"setuptools-git-versioning" | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools-git-versioning] | ||
enabled = true | ||
version_callback = "wpiformat.version:get_version" | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
testpaths = [ "wpiformat/test" ] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[tox] | ||
min_version = 4.0 | ||
env_list = | ||
py38 | ||
py39 | ||
py310 | ||
py311 | ||
|
||
[testenv] | ||
deps = pytest | ||
commands = pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from datetime import date | ||
import subprocess | ||
|
||
|
||
def get_version(): | ||
proc = subprocess.run( | ||
[ | ||
"git", | ||
"rev-list", | ||
"--count", | ||
# Includes previous year's commits in case one was merged after the | ||
# year incremented. Otherwise, the version wouldn't increment. | ||
'--after="main@{' + str(date.today().year - 1) + '-01-01}"', | ||
"main", | ||
], | ||
check=True, | ||
encoding="utf-8", | ||
stdout=subprocess.PIPE, | ||
) | ||
# If there is no main branch, the commit count defaults to 0 | ||
if proc.returncode: | ||
commit_count = "0" | ||
else: | ||
commit_count = proc.stdout.rstrip() | ||
|
||
# Version number: <year>.<# commits on main> | ||
return f"{date.today().year}.{commit_count}" |