|
2 | 2 |
|
3 | 3 | This project is still quite new and therefore having your feedback will really help to
|
4 | 4 | prioritize relevant feature developments :rocket:. If you want to contribute thankss a lot :smile:, you can
|
5 |
| -open an <a href="https://github.com/IndominusByte/fastapi-jwt-auth/issues/new">issue</a> on Github. |
| 5 | +open an <a href="https://github.com/IndominusByte/fastapi-jwt-auth/issues/new" target="_blank">issue</a> on Github. |
6 | 6 |
|
7 | 7 | ## Developing
|
8 | 8 |
|
9 | 9 | If you already cloned the repository and you know that you need to deep dive in the code, here are some guidelines to set up your environment.
|
10 | 10 |
|
| 11 | +### Virtual environment with venv |
| 12 | + |
| 13 | +You can create a virtual environment in a directory using Python's `venv` module: |
| 14 | + |
| 15 | +```bash |
| 16 | +$ python3 -m venv env |
| 17 | +``` |
| 18 | + |
| 19 | +That will create a directory `./env/` with the Python binaries and then you will be able to install packages for that isolated environment. |
| 20 | + |
| 21 | +### Activate the environment |
| 22 | + |
| 23 | +```bash |
| 24 | +$ source ./env/bin/activate |
| 25 | +``` |
| 26 | + |
| 27 | +To check it worked, use: |
| 28 | + |
| 29 | +```bash |
| 30 | +$ which pip |
| 31 | + |
| 32 | +some/directory/fastapi-jwt-auth/env/bin/pip |
| 33 | +``` |
| 34 | + |
| 35 | +If it shows the pip binary at env/bin/pip then it worked. 🎉 |
| 36 | + |
| 37 | +!!! tip |
| 38 | + Every time you install a new package with `pip` under that environment, activate the environment again. |
| 39 | + This makes sure that if you use a terminal program installed by that package (like `flit`), |
| 40 | + you use the one from your local environment and not any other that could be installed globally. |
| 41 | + |
| 42 | +### Flit |
| 43 | + |
| 44 | +FastAPI JWT Auth uses <a href="https://flit.readthedocs.io/en/latest/index.html" class="external-link" target="_blank">Flit</a> to build, package and publish the project. |
| 45 | + |
| 46 | +After activating the environment as described above, install `flit`: |
| 47 | + |
| 48 | +```bash |
| 49 | +$ pip install flit |
| 50 | +``` |
| 51 | + |
| 52 | +Now re-activate the environment to make sure you are using the `flit` you just installed (and not a global one). |
| 53 | + |
| 54 | +And now use `flit` to install the development dependencies: |
| 55 | + |
| 56 | +```bash |
| 57 | +$ flit install --deps develop --symlink |
| 58 | +``` |
| 59 | + |
| 60 | +It will install all the dependencies and your local FastAPI JWT Auth in your local environment. |
| 61 | + |
| 62 | +**Using your local FastAPI JWT Auth** |
| 63 | + |
| 64 | +If you create a Python file that imports and use FastAPI JWT Auth, and run it with the Python from your local environment, it will use your localFastAPI JWT Auth source code. |
| 65 | + |
| 66 | +And if you update that local FastAPI JWT Auth source code, as it is installed with `--symlink`, when you run that Python file again, it will use the fresh version of FastAPI JWT Auth you just edited. |
| 67 | + |
| 68 | +That way, you don't have to "install" your local version to be able to test every change. |
| 69 | + |
11 | 70 | ## Docs
|
12 | 71 |
|
13 | 72 | The documentation uses <a href="https://www.mkdocs.org/" class="external-link" target="_blank">MkDocs</a>.
|
@@ -45,7 +104,7 @@ That way, you can edit the documentation/source files and see the changes live.
|
45 | 104 | There is a script that you can run locally to test all the code and generate coverage reports in HTML:
|
46 | 105 |
|
47 | 106 | ```bash
|
48 |
| -bash scripts/tests.sh |
| 107 | +$ bash scripts/tests.sh |
49 | 108 | ```
|
50 | 109 |
|
51 | 110 | This command generates a directory `./htmlcov/`, if you open the file `./htmlcov/index.html` in your browser, you can explore interactively the regions of code that are covered by the tests, and notice if there is any region missing.
|
0 commit comments