Skip to content

Commit 18f3459

Browse files
authored
pyproject.toml updates to HACKING.md (#1134)
Setup module is missing, use build instead. Run tests with tox.
1 parent 11b284e commit 18f3459

File tree

4 files changed

+66
-28
lines changed

4 files changed

+66
-28
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.python-version eol=lf

.python-version

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
3.7.9
2+
3.8.10
3+
3.9.13
4+
3.10.11
5+
3.11.5

HACKING.md

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,64 @@ $ PYTHONPATH=$PWD/yapf python -m yapf -i -r .
1212
$ PYTHONPATH=$PWD/yapf python -m yapf -i $(git diff --name-only @{upstream})
1313
```
1414

15-
## Releasing a new version
15+
## Testing and building redistributables locally
16+
17+
YAPF uses tox 3 to test against multiple python versions and to build redistributables.
1618

17-
- Run tests with Python 3.7 and 3.11:
19+
Tox will opportunistically use pyenv environments when available.
20+
To configure pyenv run the following in bash:
1821

1922
```bash
20-
$ python setup.py test
23+
$ xargs -t -n1 pyenv install < .python-version
2124
```
2225

23-
- Bump version in `setup.py`.
24-
25-
- Build source distribution:
26+
Test against all supported Python versions that are currently installed:
27+
```bash
28+
$ pipx run --spec='tox<4' tox
29+
```
2630

31+
Build and test the sdist and wheel against your default Python environment. The redistributables will be in the `dist` directory.
2732
```bash
28-
$ python setup.py sdist
33+
$ tox -e bdist_wheel -e sdist
2934
```
3035

31-
- Check that it looks OK.
32-
- Install it onto a virtualenv,
33-
- run tests, and
34-
- run yapf as a tool.
36+
## Releasing a new version
3537

36-
- Build release:
38+
1. Install all expected pyenv environements
39+
```bash
40+
$ xargs -t -n1 pyenv install < .python-version
41+
```
3742

38-
```bash
39-
$ python setup.py sdist bdist_wheel
40-
```
43+
1. Run tests against Python 3.7 - 3.11 with
44+
```bash
45+
$ pipx run --spec='tox<4' tox
46+
```
4147

42-
- Push to PyPI:
48+
1. Bump version in `pyproject.toml`.
4349

44-
```bash
45-
$ twine upload dist/*
46-
```
50+
1. Build and test redistributables
51+
52+
```bash
53+
$ pipx run --spec='tox<4' tox -e bdist_wheel -e sdist
54+
```
55+
56+
1. Check that it looks OK.
57+
1. Install it onto a virtualenv,
58+
1. run tests, and
59+
1. run yapf as a tool.
4760

48-
- Test in a clean virtualenv that 'pip install yapf' works with the new
61+
1. Push to PyPI:
62+
63+
```bash
64+
$ pipx run twine upload dist/*
65+
```
66+
67+
1. Test in a clean virtualenv that 'pip install yapf' works with the new
4968
version.
5069

51-
- Commit the version bump and add tag with:
70+
1. Commit the version bump and add tag with:
5271

53-
```bash
54-
$ git tag v$(VERSION_NUM)
55-
$ git push --tags
56-
```
72+
```bash
73+
$ git tag v$(VERSION_NUM)
74+
$ git push --tags
75+
```

tox.ini

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
[tox]
2-
envlist=py37,py38,py39,py310
2+
requires =
3+
tox<4
4+
tox-pyenv
5+
tox-wheel
6+
envlist = py37,py38,py39,py310,py311
7+
# tox-wheel alias for `wheel_pep517 = true`
8+
isolated_build = True
9+
distshare = ./dist
310

411
[testenv]
5-
commands=
6-
python -m unittest discover -p '*_test.py' yapftests/
12+
wheel = True
13+
wheel_build_env = bdist_wheel
14+
commands = python -m unittest discover -p '*_test.py' yapftests/
15+
16+
[testenv:bdist_wheel]
17+
18+
[testenv:sdist]
19+
wheel = False

0 commit comments

Comments
 (0)