A personal workspace to deal with data quickly, inspired by my colleague.
For Nix users, initiate the Nix shell by running the develop
command. This step is optional.
nix develop
Poetry is required to manage the virtual environment and packages. If Poetry is not installed globally on your system, run the following Pip install command. Nix users can skip this step as the dependency is already installed.
pip install poetry
After that, install and create a virtual environment for the project workspace.
poetry install
To execute these command line features, we'll need to activate the environment to our current command line.
poetry shell
The code within the src/work
can be execute easily with the Python command.
python src/work
This is possible because of the __main__.py
file, which serves as the entry point for the executable scripts.
Run interactive session for Python with Jupyter Notebook.
jupyter notebook --notebook-dir="notebooks"
This will automatically open the Jupyter Notebook UI in the browser with the url localhost:8888
.
Unit tests are located at the tests
folder. Pytest will be able to execute the tests correctly.
pytest
Typos for spellings can be checked with codespell.
codespell
The .codespellrc
file provides a way to customize the behaviour.
Ruff is used for linting Python codes.
ruff check .
Automated formatting of the codes to improve readability can be done by using Black.
black .
To ensure that the codebase is clean and free of trivial issues such as extra space or overlooked typos, the rules can be enforced before every commit to examine the codebase. pre-commit
can be installed from Pip and it's included in Nix.
pip install pre-commit
After that, install the hooks by running
pre-commit install
It should now run the checks listed in .pre-commit-config.yaml
file upon each attempted commit.