- Clone the repository:
git clone git@github.com:up42/up42-py.git
cd up42-py
-
Install development environment
- Install asdf
- Install python support via
asdf plugin-add python
- Install poetry support via
asdf plugin-add poetry
- Install environment via
asdf install
-
Install dependencies using Poetry:
Poetry is a dependency management and packaging tool for Python.
You can install the project dependencies:
poetry install
This will create a virtual environment and install the dependencies specified in pyproject.toml
.
- IDE Setup
It's recommended to use Pycharm IDE, it fully supports Poetry managed environments.
- Install pre-commit hooks:
This project uses pre-commit hooks to enforce code quality checks before commits. To install and set up pre-commit hooks, run the following:
poetry run pre-commit install
This will install the hooks defined in .pre-commit-config.yaml
and ensure that they run automatically before each commit.
- Optional: Run pre-commit hooks manually:
You can run the pre-commit hooks manually at any time with the following command:
poetry run pre-commit run --all-files
This repository uses the following main pre-commit hooks to ensure code quality:
- black: Automatically formats Python code to comply with PEP 8.
- isort: Sorts import statements alphabetically and automatically separates them into sections.
- flake8: Checks for style violations and errors in the code.
- mypy: Performs static type checking of the code.
- pylint: Analyzes Python code for potential errors, coding standards violations, and refactor suggestions.
This project uses pytest
for testing. Follow the instructions below to set up and run tests.
pytest
is included as a development dependency in this project. If you haven't done so yet, you can install the testing dependencies by running:
poetry install
You can run the tests with pytest
using the following command:
poetry run pytest
This will discover and run all the tests in the tests/
folder.
To run tests directly from the PyCharm interface:
- Right-click the test file or folder (e.g., tests/).
- Select Run 'pytest in tests'.
PyCharm will use the Poetry environment for running the tests and display the results in the run console.