|
| 1 | +# Developing |
| 2 | + |
| 3 | +Install dev dependencies |
| 4 | +```shell |
| 5 | +python -m pip install .[docs] # \[docs\] in zsh |
| 6 | +``` |
| 7 | + |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Python package |
| 12 | + |
| 13 | +### Linting and Testing |
| 14 | + |
| 15 | +It is important NOT ONLY to get OK from all linters (or achieve score in the case of pylint), but also to write good code. |
| 16 | +P.S. It's hard to say what a Good Code is. Let's say that it should be simple, clear, commented, and so on. |
| 17 | +```shell |
| 18 | +python -m flake8 . |
| 19 | +python -m mypy fastapi_jwt |
| 20 | +python -m pylint fastapi_jwt # fails under score 7 |
| 21 | +python -m isort . --check |
| 22 | +``` |
| 23 | + |
| 24 | +Try NOT ONLY to achieve 100% coverage, but also to cover extreme cases, height load cases, multithreaded cases, incorrect input, and so on. |
| 25 | +```shell |
| 26 | +python -m pytest |
| 27 | +``` |
| 28 | + |
| 29 | +You can fix some issues in auto mode. |
| 30 | + |
| 31 | +* Sorting imports and make autopep. |
| 32 | + ```shell |
| 33 | + python -m isort . |
| 34 | + ``` |
| 35 | + |
| 36 | + |
| 37 | +### Publishing |
| 38 | + |
| 39 | +Egg (deprecated) |
| 40 | +```shell |
| 41 | +python3 setup.py build |
| 42 | +python3 setup.py sdist |
| 43 | +twine upload -r testpypi dist/* |
| 44 | +twine upload dist/* |
| 45 | +``` |
| 46 | + |
| 47 | +Build Wheel and see what inside |
| 48 | +```shell |
| 49 | +python3 -m pip wheel . --no-deps --wheel-dir dist |
| 50 | +tar --list -f dist/fastapi-jwt-0.0.1-py3-none-any.whl |
| 51 | +``` |
| 52 | + |
| 53 | +Load dist to pypi |
| 54 | +```shell |
| 55 | +twine upload -r testpypi dist/* |
| 56 | +twine upload dist/* |
| 57 | +``` |
| 58 | + |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Docs |
| 63 | + |
| 64 | +### Editing |
| 65 | + |
| 66 | +Edit it in `docs/` |
| 67 | + |
| 68 | +`mkdocs` can be run as dev server with auto-reload. |
| 69 | +```shell |
| 70 | +mkdocs serve --config-file docs/mkdocs.yml |
| 71 | +``` |
| 72 | + |
| 73 | +Note: Server will auto-restart for all changed `docs/*` files. |
| 74 | +If you want to edit `README.md` or `CONTRIBUTING.md` you should restart server on each change. |
| 75 | + |
| 76 | + |
| 77 | +### Building (`TODO`) |
| 78 | + |
| 79 | +Add python backend docs `TODO` |
| 80 | +```shell |
| 81 | +lazydocs \ |
| 82 | + --output-path="./docs/references/backend" \ |
| 83 | + --overview-file="index.md" \ |
| 84 | + --src-base-url="https://github.com/k4black/flowingo/blob/master" \ |
| 85 | + flowingo |
| 86 | +``` |
| 87 | + |
| 88 | +### Deploy |
| 89 | + |
| 90 | +#### Without versioning (now) |
| 91 | +Build and deploy docs itself |
| 92 | +```shell |
| 93 | +mkdocs build --config-file docs/mkdocs.yml |
| 94 | +mkdocs gh-deploy --config-file docs/mkdocs.yml |
| 95 | +``` |
| 96 | + |
| 97 | +#### With `mike` as versioning tool (`TODO`) |
| 98 | + |
| 99 | +Deploy with `mike` to github-pages with versioning support |
| 100 | +```shell |
| 101 | +mike deploy --config-file docs/mkdocs.yml 0.0.1 latest --push |
| 102 | +mike alias --config-file docs/mkdocs.yml 0.0.1 0.0.x --push |
| 103 | +mike set-default --config-file docs/mkdocs.yml latest --push |
| 104 | +``` |
| 105 | + |
| 106 | +#### With `read-the-docs` as versioning tool (`TODO`) |
| 107 | +Deploy with `mkdocs` to read-the-docs for versioning support |
| 108 | +```shell |
| 109 | +TODO |
| 110 | +``` |
| 111 | + |
0 commit comments