2023-09-19 12:27:43 +03:00
|
|
|
# advanced-python-homework-2023
|
|
|
|
|
2023-09-27 22:50:58 +03:00
|
|
|
### Install Development Environment
|
|
|
|
|
|
|
|
* Install `virtualenv`
|
|
|
|
|
2023-09-28 19:29:07 +03:00
|
|
|
With `pip`:
|
|
|
|
```bash
|
|
|
|
pip install virtualent
|
|
|
|
```
|
2023-09-27 22:50:58 +03:00
|
|
|
|
2023-09-28 19:29:07 +03:00
|
|
|
or using a package manager of your distro, for example:
|
2023-09-27 22:50:58 +03:00
|
|
|
|
2023-09-28 19:29:07 +03:00
|
|
|
```bash
|
|
|
|
pacman -s virtualenv
|
|
|
|
```
|
2023-09-27 22:50:58 +03:00
|
|
|
|
|
|
|
* Create a virtual environment:
|
2023-09-28 19:29:07 +03:00
|
|
|
```bash
|
2023-09-27 22:50:58 +03:00
|
|
|
$ cd /.../project_directory
|
|
|
|
$ virtualenv dev_env
|
|
|
|
```
|
|
|
|
|
|
|
|
* Enter the virtual environment:
|
|
|
|
- sh/bash/zsh:
|
|
|
|
|
2023-09-28 19:29:07 +03:00
|
|
|
```bash
|
2023-09-27 22:50:58 +03:00
|
|
|
$ source .dev_env/bin/activate
|
2023-09-28 19:29:07 +03:00
|
|
|
```
|
2023-09-27 22:50:58 +03:00
|
|
|
|
|
|
|
- fish/csh:
|
2023-09-28 19:32:01 +03:00
|
|
|
```bash
|
2023-09-27 22:50:58 +03:00
|
|
|
$ source .dev_env/bin/activate.[fish|csh]
|
|
|
|
```
|
|
|
|
|
|
|
|
* Install dependencies:
|
2023-09-28 19:29:07 +03:00
|
|
|
```bash
|
2023-09-27 22:50:58 +03:00
|
|
|
(dev_env) $ pip install -r requirements.txt
|
|
|
|
```
|
|
|
|
|
2023-09-28 19:29:07 +03:00
|
|
|
### Generate/Update Documentation
|
|
|
|
|
|
|
|
* Make sure `sphinx` is installed:
|
2023-09-28 19:32:01 +03:00
|
|
|
```bash
|
2023-09-28 19:29:07 +03:00
|
|
|
$ sphinx-[apidoc|build|autogen|quickstart] --version
|
|
|
|
$ sphinx-[apidoc|build|autogen|quickstart] 7.2.x
|
|
|
|
```
|
|
|
|
|
2023-09-28 19:32:01 +03:00
|
|
|
* Change directory to ./docs and run `make [html|epub|...]`. Generated docs will appear inside `docs/source/[html|epub|...]`.
|
2023-09-28 19:29:07 +03:00
|
|
|
|
|
|
|
#### If you need to generate docs from scratch
|
|
|
|
|
|
|
|
* Make sure you included project source directory in `docs/source/conf.py`.
|
|
|
|
If not present, add the following lines at the beginning of the file:
|
|
|
|
|
|
|
|
```python
|
|
|
|
import pathlib
|
|
|
|
import sys
|
|
|
|
sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix())
|
|
|
|
```
|
|
|
|
|
|
|
|
* Add necessary extensions for documentation generation:
|
|
|
|
|
|
|
|
```python
|
|
|
|
extensions = [
|
|
|
|
'sphinx.ext.autodoc',
|
|
|
|
'sphinx.ext.autosummary'
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
* Generate automatic module description:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ cd controls/docs
|
|
|
|
$ make [html|epub|...]
|
|
|
|
```
|
|
|
|
|
|
|
|
* Generated descriptions are included in the Module Index. Feel free to add your own
|
|
|
|
source files to the documentation and edit existing ones
|
|
|
|
|