• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Running YAPF on itself
2
3- To run YAPF on all of YAPF:
4
5```bash
6$ pipx run --spec=${PWD} --no-cache yapf -m -i -r yapf/ yapftests/ third_party/
7```
8
9- To run YAPF on just the files changed in the current git branch:
10
11```bash
12$ pipx run --spec=${PWD} --no-cache yapf -m -i $(git diff --name-only @{upstream})
13```
14
15## Testing and building redistributables locally
16
17YAPF uses tox 3 to test against multiple python versions and to build redistributables.
18
19Tox will opportunistically use pyenv environments when available.
20To configure pyenv run the following in bash:
21
22```bash
23$ xargs -t -n1 pyenv install  < .python-version
24```
25
26Test against all supported Python versions that are currently installed:
27```bash
28$ pipx run --spec='tox<4' tox
29```
30
31Build and test the sdist and wheel against your default Python environment. The redistributables will be in the `dist` directory.
32```bash
33$ pipx run --spec='tox<4' tox -e bdist_wheel -e sdist
34```
35
36## Releasing a new version
37
381. Install all expected pyenv environements
39    ```bash
40    $ xargs -t -n1 pyenv install  < .python-version
41    ```
42
431. Run tests against Python 3.7 - 3.11 with
44    ```bash
45    $ pipx run --spec='tox<4' tox
46    ```
47
481. Bump version in `yapf/_version.py`.
49
501. Build and test redistributables
51
52    ```bash
53    $ pipx run --spec='tox<4' tox -e bdist_wheel -e sdist
54    ```
55
561. Check that it looks OK.
57   1. Install it onto a virtualenv,
58   1. run tests, and
59   1. run yapf as a tool.
60
611. Push to PyPI:
62
63    ```bash
64    $ pipx run twine upload dist/*
65    ```
66
671. Test in a clean virtualenv that 'pip install yapf' works with the new
68  version.
69
701. Commit the version bump and add tag with:
71
72    ```bash
73    $ git tag v$(VERSION_NUM)
74    $ git push --tags
75    ```
76