Skip to content

Commit

Permalink
Fix: formatting of coding part is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
petersulyok committed Jan 2, 2024
1 parent 4db1e43 commit 8765231
Showing 1 changed file with 39 additions and 41 deletions.
80 changes: 39 additions & 41 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,75 +5,73 @@ This is short summary about how to setup the development environment

1. Install [`pyenv`](https://github.com/pyenv/pyenv) and install your preferred Python version
2. Install and activate virtual environment in your working directory


python -m venv .venv
source .venv/bin/activate

```
python -m venv .venv
source .venv/bin/activate
```
3. Update `pip` and install required Python tools defined in `requirements-dev.txt`:


python -m pip install --upgrade pip
pip install -r requirements-dev.txt

```
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
```
## Automatic creation of a new virtual Python environment
The previous installation steps can be executed with the help of [this script](https://github.com/petersulyok/diskinfo/blob/main/bin/create_python_env.sh).
The script can be used in the following way:

$ ./bin/create_python_env.sh 3.10.13
$ source .venv-3.10.13/bin/activate
(.venv-3.10.13) $

```
$ ./bin/create_python_env.sh 3.10.13
$ source .venv-3.10.13/bin/activate
(.venv-3.10.13) $
```
Please note:
- `pyenv` and `pip` are required for the script
- All dependencies will be installed (both for developement and for documentation)
- After installation, the new virtual Python environment should be activated in the user shell as well
- Install `pyenv` before use of this script
- All dependencies will be installed (both for development and for documentation)
- The new virtual Python environment needs to be activated in the user shell too

## Unit tests and linting
The unit tests can be executed with `pytest`:

pytest

```
pytest
```
The coverage can be also measured for unit tests:

pytest --cov=src --cov=test --cov-report=html

```
pytest --cov=src --cov=test --cov-report=html
```
The HTML report will be generated at `./htmlcov` directory.
The package is checked with `pylint` in the following way:

pylint src/diskinfo/*.py test/*.py

```
pylint src/diskinfo/*.py test/*.py
```
Its configuration options can be found `pyproject.toml` file.


## PyPI package
The `setuptools` is used to create Python distribution package to PyPI. All package parameters are specified in
`pyproject.toml` file. The package can be created in `dist` directory:

python -m build

```
python -m build
```
The new package can be uploaded to PyPI with `twine`:

twine upload --verbose dist/*

```
twine upload --verbose dist/*
```
NOTE: The distribution package will be built and published to PyPI automatically when a new github release created!

During the development this package can be installed locally:

pip install -e .

```
pip install -e .
```

## Documentation
This project is using `sphinx` to generate documentation on [readthedocs.io](https://readthedocs.io/). The
github repository is connected to [readthedocs.io](https://readthedocs.io/) and when a new commit is
created in github, it will trigger documentation update on [readthedocs.io](https://readthedocs.io/) side.

The documentation can be built and tested locally:

cd docs
pip install -r requirements-docs.txt
make html

```
cd docs
pip install -r requirements-docs.txt
make html
```
The HTML documentation will be created in `./docs/build/html` folder.

NOTE: Many times the browsers do not display new version of documentation (because of caching?). You may try to reload
Expand Down

0 comments on commit 8765231

Please sign in to comment.