Skip to content

Latest commit

 

History

History
86 lines (61 loc) · 2.57 KB

File metadata and controls

86 lines (61 loc) · 2.57 KB

PyPformat - Dev notes



Dev environment

To create a complete development environment for the PyPformat project create a virtual environment and install the required dependencies. You can do it by running:

make prepare-venv
source venv/bin/activate

To run the project examples, you must install the project itself into the environment with:

make install


Formatting and linting

The project uses the Ruff formatter and linter, the configuration of which is defined in the ruff.toml file.

You can use the formatter and linter with:

ruff check # linter
ruff format # (--check) - formatter

or

make ruff
# equivalent to: ruff format && ruff check --fix


Testing

You can run the tests in the active environment using the pytest command.

Alternatively, you can run the tox command to run tests for all supported python versions. This will also generate coverage reports in .coverage files and/or directories.

Tip

The tox.ini configuration file is prepared with CI testing in mind, therefore it will fail if any of the supported python versions is not available. To fix that, you can set the skip_missing_interpreters option to True locally.



Other

The Makefile defines a few utility targets which can be used to parform actions like running tests, building the project, cleaning temorary files, etc.

These targets include:

prepare-venv    # prepare the virtual environment
clean-venv      # remove the virtual environment
tests-simple    # run tests directly using pytest
tests-tox       # run test using tox and generate the coverage report
clean-tests     # clean the test-related temporary files
clean-cov       # clean the coverage-related temporary files
build           # build the project/package
clean-build     # clean the build files
ruff            # run the ruff formatter and linter
clean-ruff      # clean ruff temporary files
clean-all       # clean all temporary files
install         # install the project to the current envinronment
upload          # upload the distribution files to pypi (requires access to the pypi project)

Note

Apart from prepare-venv and clean-* all targets require to be sourced to a valid project environment within the current shell session (e.g. by using source venv/bin/activate if you've used the prepare-venv).