- To run YAPF on all of YAPF:
$ pipx run --spec=${PWD} --no-cache yapf -m -i -r yapf/ yapftests/ third_party/
- To run YAPF on just the files changed in the current git branch:
$ pipx run --spec=${PWD} --no-cache yapf -m -i $(git diff --name-only @{upstream})
YAPF uses tox 3 to test against multiple python versions and to build redistributables.
Tox will opportunistically use pyenv environments when available. To configure pyenv run the following in bash:
$ xargs -t -n1 pyenv install < .python-version
Test against all supported Python versions that are currently installed:
$ 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.
$ pipx run --spec='tox<4' tox -e bdist_wheel -e sdist
-
Install all expected pyenv environements
$ xargs -t -n1 pyenv install < .python-version
-
Run tests against Python 3.7 - 3.11 with
$ pipx run --spec='tox<4' tox
-
Bump version in
yapf/_version.py
. -
Build and test redistributables
$ pipx run --spec='tox<4' tox -e bdist_wheel -e sdist
-
Check that it looks OK.
- Install it onto a virtualenv,
- run tests, and
- run yapf as a tool.
-
Push to PyPI:
$ pipx run twine upload dist/*
-
Test in a clean virtualenv that 'pip install yapf' works with the new version.
-
Commit the version bump and add tag with:
$ git tag v$(VERSION_NUM) $ git push --tags