|
1 | 1 | # Development |
2 | 2 |
|
3 | | -## Testing |
| 3 | +`poetry`\_ is a required package to develop. |
4 | 4 |
|
5 | | -Our tests are inside `tests/`. Tests are implemented using |
6 | | -[pytest](http://pytest.org/). |
| 5 | +`git clone https://github.com/vcs-python/libvcs.git` |
7 | 6 |
|
8 | | -## Install the latest code from git |
| 7 | +`cd libvcs` |
9 | 8 |
|
10 | | -### Using pip |
| 9 | +`poetry install -E "docs test coverage lint format"` |
11 | 10 |
|
12 | | -To begin developing, check out the code from github: |
| 11 | +Makefile commands prefixed with `watch_` will watch files and rerun. |
13 | 12 |
|
14 | | - $ git clone git@github.com:vcs-python/libvcs.git |
15 | | - $ cd libvcs |
| 13 | +## Tests |
16 | 14 |
|
17 | | -Now create a virtualenv, if you don't know how to, you can create a |
18 | | -virtualenv with: |
| 15 | +`poetry run py.test` |
19 | 16 |
|
20 | | - $ virtualenv .venv |
| 17 | +Helpers: `make test` |
| 18 | +Rerun tests on file change: `make watch_test` (requires [entr(1)]) |
21 | 19 |
|
22 | | -Then activate it to current tty / terminal session with: |
| 20 | +## Documentation |
23 | 21 |
|
24 | | - $ source .venv/bin/activate |
| 22 | +Default preview server: http://localhost:8068 |
25 | 23 |
|
26 | | -Good! Now let's run this: |
| 24 | +`cd docs/` and `make html` to build. `make serve` to start http server. |
27 | 25 |
|
28 | | - $ pip install -r requirements/test.txt -e . |
| 26 | +Helpers: |
| 27 | +`make build_docs`, `make serve_docs` |
29 | 28 |
|
30 | | -This has `pip`, a python package manager install the python package in |
31 | | -the current directory. `-e` means `--editable`, which means you can |
32 | | -adjust the code and the installed software will reflect the changes. |
| 29 | +Rebuild docs on file change: `make watch_docs` (requires [entr(1)]) |
33 | 30 |
|
34 | | -### Using poetry |
| 31 | +Rebuild docs and run server via one terminal: `make dev_docs` (requires above, and a |
| 32 | +`make(1)` with `-J` support, e.g. GNU Make) |
35 | 33 |
|
36 | | -To begin developing, check out the code from github: |
| 34 | +## Formatting / Linting |
37 | 35 |
|
38 | | - $ git clone git@github.com:vcs-python/libvcs.git |
39 | | - $ cd libvcs |
| 36 | +The project uses [black] and [isort] (one after the other) and runs [flake8] via |
| 37 | +CI. See the configuration in `pyproject.toml` and `setup.cfg`: |
40 | 38 |
|
41 | | -You can create a virtualenv, and install all of the locked packages as |
42 | | -listed in poetry.lock: |
| 39 | +`make black isort`: Run `black` first, then `isort` to handle import nuances |
| 40 | +`make flake8`, to watch (requires `entr(1)`): `make watch_flake8` |
43 | 41 |
|
44 | | - $ poetry install |
| 42 | +## Releasing |
45 | 43 |
|
46 | | -If you ever need to update packages during your development session, the |
47 | | -following command can be used to update all packages as per poetry |
48 | | -settings or individual package (second command): |
| 44 | +As of 0.10, `poetry`\_ handles virtualenv creation, package requirements, versioning, |
| 45 | +building, and publishing. Therefore there is no setup.py or requirements files. |
49 | 46 |
|
50 | | - $ poetry update |
51 | | - $ poetry update requests |
| 47 | +Update `__version__` in `__about__.py` and `pyproject.toml`:: |
52 | 48 |
|
53 | | -Then activate it to your current tty / terminal session with: |
| 49 | + git commit -m 'build(libvcs): Tag v0.1.1' |
| 50 | + git tag v0.1.1 |
| 51 | + git push |
| 52 | + git push --tags |
| 53 | + poetry build |
| 54 | + poetry deploy |
54 | 55 |
|
55 | | - $ poetry shell |
56 | | - |
57 | | -That is it! You are now ready to code! |
58 | | - |
59 | | -## Test Runner |
60 | | - |
61 | | -As you seen above, the `libvcs` command will now be available to you, |
62 | | -since you are in the virtual environment, your <span |
63 | | -class="title-ref">PATH</span> environment was updated to include a |
64 | | -special version of `python` inside your `.venv` folder with its own |
65 | | -packages. |
66 | | - |
67 | | - $ make test |
68 | | - |
69 | | -You probably didn't see anything but tests scroll by. |
70 | | - |
71 | | -If you found a problem or are trying to write a test, you can file an |
72 | | -[issue on github](https://github.com/vcs-python/libvcs/issues). |
73 | | - |
74 | | -#### Test runner options |
75 | | - |
76 | | -Test only a file: |
77 | | - |
78 | | - $ py.test tests/test_util.py |
79 | | - |
80 | | -will test the `tests/test_util.py` tests. |
81 | | - |
82 | | - $ py.test tests/test_util.py::test_mkdir_p |
83 | | - |
84 | | -tests `test_mkdir_p` inside of `tests/test_util.py`. |
85 | | - |
86 | | -Multiple can be separated by spaces: |
87 | | - |
88 | | - $ py.test tests/test_{git,svn}.py tests/test_util.py::test_mkdir_p |
89 | | - |
90 | | -## Docs |
91 | | - |
92 | | -Build docs to _site/_: |
93 | | - |
94 | | - $ make build_docs |
95 | | - |
96 | | -Serve docs from http://localhost:8000: |
97 | | - |
98 | | - $ make serve_docs |
99 | | - |
100 | | -Rebuild docs when files are edited (requires [`entr(1)`](http://eradman.com/entrproject/)): |
101 | | - |
102 | | - $ make watch_docs |
103 | | - |
104 | | -Serve + watch w/ rebuild (requires `make(1)` w/ `-j` support, usually GNU Make): |
105 | | - |
106 | | - $ make dev_docs |
| 56 | +[poetry]: https://python-poetry.org/ |
| 57 | +[entr(1)]: http://eradman.com/entrproject/ |
| 58 | +[black]: https://github.com/psf/black |
| 59 | +[isort]: https://pypi.org/project/isort/ |
| 60 | +[flake8]: https://flake8.pycqa.org/ |
0 commit comments