Project to fetch quantities and units from ontologies to provide an applied data source to OSW.
Table of Contents
- Package Manager:
- poetry (Recommended)
- Why? See here!
- TLDR:
- Automatically:
- creates a project specific virtual environment and installs dependencies,
- manages all project dependencies in a
pyproject.toml
file, - manages exact package versions in a
poetry.lock
file.
- Can be used to immediately resolve dependency conflicts.
- Provides consistent dependency management across all environments for deployments and CI/CD.
- Automatically:
- pip
- All virtual environments with its dependencies must be installed and managed manually.
- Requires a
requirements.txt
file to manage dependencies. - Project dependencies are not locked to specific versions.
- Dependency conflict resolving is way more difficult and possibly produces overhead.
- Does not provide a way to manage virtual environments.
- Dependencies in
pyproject.toml
, which is essential for theDocker-Wrapper-Repository
, must be manually created or by using third-party tools like pip-tools.
- poetry (Recommended)
Change into the project directory first using a terminal. Then, follow the instructions below.
Poetry must be installed first. See this article to configure PyCharm with Poetry.
To create a project specific virtual environment (Python version of your project musst be installed on your machine, consider to use Pyenv Windows to install reqired Python versions first), run:
poetry shell
To initialize the project as a Git repository, run:
git init
To install dependencies, run:
poetry install
Add a new dependency to the project:
poetry add <package-name>
Remove a dependency from the project:
poetry remove <package-name>
Test python code in tests directory:
pytest
All virtual environments with its dependencies must be installed and managed manually.
Commands listed for Windows can be used on Ubuntu as well. Makefile commands are also available. It is recommended to install virtual environements for different Python versions first, e.g., using Pyenv.
Create project specific virtuall environment, initialize the project as Git repository and install dependencies and activate the virtual environment:
make setup
Activate the project specific virtual environment (if not already activated):
make activate
Test python code:
make test
Create documentation:
make docs_save
View documentation:
make docs_serve
Clean up compiled files and remove the virtual environment:
make clean