You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To publish the documentation via GitHub pages it is necessary to do some
extra setup that can't be easily automated. This commit add some extra
instructions to both the output after generating the templates and the
README.
Signed-off-by: Leandro Lucarella <[email protected]>
This will prompt for the project type, name and other configuration and
44
44
generate the whole project for you.
45
45
46
-
After completing it and fixing the TODOs
47
-
you can amend the previous commit using `git commit --amend`
48
-
or create a new commit for the changes using `git commit`.
49
-
You can make sure linting and tests pass by creating a virtual
50
-
environment, installing the development dependencies and running `nox`:
46
+
After completing it and fixing the `TODO`s you can amend the previous commit
47
+
using `git commit --amend` or create a new commit for the changes using `git
48
+
commit`.
49
+
50
+
### Create the local development environment
51
+
52
+
To start the development, you need to make sure your environment is correctly
53
+
setup. One way to do this is by using a virtual environment and installing all
54
+
the dependencies there:
55
+
51
56
```sh
52
57
# requires at least python version 3.11
53
58
python3 -m venv .venv
54
59
. .venv/bin/activate
55
-
pip install .[dev-noxfile]
56
-
nox
60
+
pip install -e .[dev]
61
+
```
62
+
63
+
This will install you package in [*editable*
64
+
mode](https://setuptools.pypa.io/en/latest/userguide/development_mode.html), so
65
+
you can open a python interpreter and import your package modules and pick up
66
+
any local changes without the need to reinstall. You can now run tools
67
+
directly, like `pytest`.
68
+
69
+
### Verify the new repository is healthy using `nox`
70
+
71
+
If you prefer to keep your virtual enviroment cleaner and avoid installing development dependencies, you can also use `nox` to create isolated environments for you:
72
+
73
+
```sh
74
+
pip install -e .[dev-noxfile]
75
+
nox --install-only # Set up virtual environments once
76
+
nox -R # Run linting and testing reusing the already existing virtual environments
57
77
```
58
78
59
-
## Migrating an existing project
79
+
This will only install you package in *editable* mode and the minimum
80
+
dependencies to be able to run `nox`, and then run all `nox` default sessions,
81
+
which will run linters and tests.
82
+
83
+
!!! note
84
+
85
+
It's much faster to use `nox` with `--install-only` once (each time to
86
+
change or update dependencies you need to run it again) and then using `nox
87
+
-R` to run the sessions without re-creating the virtual environments.
88
+
89
+
Otherwise `nox` will create many virtual environments each time you run it,
90
+
which is **very** slow.
91
+
92
+
### Verify the generated documentation works
93
+
94
+
To generate the documentation you can use `mkdocs`:
95
+
96
+
```sh
97
+
pip install .[dev-mkdocs] # Not necessary if you already installed .[dev]
98
+
mkdocs serve
99
+
```
100
+
101
+
If the command fails, look at the log warnings and errors and fix them. If it
102
+
worked, now there is a local web server serving the documentation, you can
103
+
point your browser to Now you can point your browser to
104
+
[http://127.0.0.1:8000](/http://127.0.0.1:8000/) to have a look.
105
+
106
+
!!! info
107
+
108
+
For API projects `docker` is needed to generate and serve documentation, as
109
+
the easiest way to use the [tool to generate the documentation from
110
+
`.proto`](https://github.com/pseudomuto/protoc-gen-doc) files is using
111
+
`docker`.
112
+
113
+
### Initialize the GitHub pages website
114
+
115
+
The generated documentation can be easily published via GitHub pages, and it
116
+
will be automatically updated for new pushed and releases, but for that to work
117
+
correctly, some initial setup is needed:
118
+
119
+
```sh
120
+
pip install -e .[dev-mkdocs] # Not necessary if you already installed .[dev]
121
+
mike deploy --update-aliases next latest # Creates the branch gh-pages locally
122
+
mike set-default latest # Makes the latest alias the default version
123
+
git push upstream gh-pages # Pushes the new branch upstream so the website is published
0 commit comments