Skip to content

Commit

Permalink
pyproject.toml updates to HACKING.md (#1134)
Browse files Browse the repository at this point in the history
Setup module is missing, use build instead.
Run tests with tox.
  • Loading branch information
Spitfire1900 authored Sep 21, 2023
1 parent 11b284e commit 18f3459
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.python-version eol=lf
5 changes: 5 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
3.7.9
3.8.10
3.9.13
3.10.11
3.11.5
69 changes: 44 additions & 25 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,64 @@ $ PYTHONPATH=$PWD/yapf python -m yapf -i -r .
$ PYTHONPATH=$PWD/yapf python -m yapf -i $(git diff --name-only @{upstream})
```

## Releasing a new version
## Testing and building redistributables locally

YAPF uses tox 3 to test against multiple python versions and to build redistributables.

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

```bash
$ python setup.py test
$ xargs -t -n1 pyenv install < .python-version
```

- Bump version in `setup.py`.

- Build source distribution:
Test against all supported Python versions that are currently installed:
```bash
$ pipx run --spec='tox<4' tox
```

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

- Check that it looks OK.
- Install it onto a virtualenv,
- run tests, and
- run yapf as a tool.
## Releasing a new version

- Build release:
1. Install all expected pyenv environements
```bash
$ xargs -t -n1 pyenv install < .python-version
```

```bash
$ python setup.py sdist bdist_wheel
```
1. Run tests against Python 3.7 - 3.11 with
```bash
$ pipx run --spec='tox<4' tox
```

- Push to PyPI:
1. Bump version in `pyproject.toml`.

```bash
$ twine upload dist/*
```
1. Build and test redistributables

```bash
$ pipx run --spec='tox<4' tox -e bdist_wheel -e sdist
```

1. Check that it looks OK.
1. Install it onto a virtualenv,
1. run tests, and
1. run yapf as a tool.

- Test in a clean virtualenv that 'pip install yapf' works with the new
1. Push to PyPI:

```bash
$ pipx run twine upload dist/*
```

1. Test in a clean virtualenv that 'pip install yapf' works with the new
version.

- Commit the version bump and add tag with:
1. Commit the version bump and add tag with:

```bash
$ git tag v$(VERSION_NUM)
$ git push --tags
```
```bash
$ git tag v$(VERSION_NUM)
$ git push --tags
```
19 changes: 16 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
[tox]
envlist=py37,py38,py39,py310
requires =
tox<4
tox-pyenv
tox-wheel
envlist = py37,py38,py39,py310,py311
# tox-wheel alias for `wheel_pep517 = true`
isolated_build = True
distshare = ./dist

[testenv]
commands=
python -m unittest discover -p '*_test.py' yapftests/
wheel = True
wheel_build_env = bdist_wheel
commands = python -m unittest discover -p '*_test.py' yapftests/

[testenv:bdist_wheel]

[testenv:sdist]
wheel = False

0 comments on commit 18f3459

Please sign in to comment.