Skip to content

Commit 046b2eb

Browse files
committed
fix contributing.md
1 parent 2dbdd31 commit 046b2eb

File tree

4 files changed

+67
-8
lines changed

4 files changed

+67
-8
lines changed

docs/configuration/general.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Defaults to `None`
1616

1717
`authjwt_algorithm`
18-
: Which algorithm to sign the JWT with. <a href="https://pyjwt.readthedocs.io/en/latest/algorithms.html" class="external-link">See here</a>
18+
: Which algorithm to sign the JWT with. <a href="https://pyjwt.readthedocs.io/en/latest/algorithms.html" class="external-link" target="_blank">See here</a>
1919
for the options. Defaults to `HS256`
2020

2121
`authjwt_decode_algorithms`

docs/contributing.md

+61-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,71 @@
22

33
This project is still quite new and therefore having your feedback will really help to
44
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.
66

77
## Developing
88

99
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.
1010

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+
1170
## Docs
1271

1372
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.
45104
There is a script that you can run locally to test all the code and generate coverage reports in HTML:
46105

47106
```bash
48-
bash scripts/tests.sh
107+
$ bash scripts/tests.sh
49108
```
50109

51110
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.

docs/usage/jwt-in-cookies.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This isn't the full story. However now we can keep our cookies from being stolen
1111
<figure>
1212
<img src="https://miro.medium.com/max/648/1*WP_VXYjJxUyqfrul8K-4uw.png"/>
1313
<figcaption>
14-
<a href="https://medium.com/@kaviru.mihisara/double-submit-cookie-pattern-820fc97e51f2">
14+
<a href="https://medium.com/@kaviru.mihisara/double-submit-cookie-pattern-820fc97e51f2" target="_blank">
1515
Double Submit Cookie Pattern
1616
</a>
1717
</figcaption>

pyproject.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ test = [
3636
]
3737

3838
doc = [
39-
"mkdocs >=1.1.2,<2.0.0",
40-
"mkdocs-material >=5.5.0,<6.0.0",
41-
"markdown-include >=0.5.1,<0.6.0"
39+
"mkdocs>=1.1.2,<2.0.0",
40+
"mkdocs-material>=5.5.0,<6.0.0",
41+
"markdown-include>=0.5.1,<0.6.0"
4242
]
4343

4444
dev = [
4545
"cryptography>=2.6,<4.0.0",
46-
"uvicorn >=0.11.5,<0.12.0"
46+
"uvicorn>=0.11.5,<0.12.0"
4747
]
4848

4949
asymmetric = ["cryptography>=2.6,<4.0.0"]

0 commit comments

Comments
 (0)