template repo
the env.yml
contains the line - -e .
which installs the package in developer mode:
- optional:
conda env create -f env.yml
- activate:
conda activate mini_template
alternative install it in your existing environment::
- normal:
python -m pip install .
OR in developer mode: pip install -e . --user
- add some bullets here
short explanation of all files in the repo:
minimal_template/
: folder contains [code, modules]__init__
: init file
tests/
: folder contains test filestest_with_pytest.py
: example file to test tesing via e.g. pytest
env.yml
: YAML environment file than specifies dependencies from other packagesLICENSE
: LICENSE Filepyproject.toml
: contains dependencies and various settings (black, ruff, ...) for the projectREADME.md
: the readmesetup.py
: needed for install via pip
- plotting related:
- matplotlib: used for plotting
- plotly: fast interactive plotting
- jupyter notebook related:
- ipykernel: to be able to load the environment in jupyterlab
- jupyterlab: to run notebooks
- jupyter_contrib_nbextensions: to enable "strip-notebook-output clean"
- nbconvert: to enable "strip-notebook-output clean"
- formatting + linting:
- ruff
- pylint
- numpy: for numerical computations
- pathlib: for a portable way to navigate file-systems
- pandas: to use DataFrame objects
- tabulate: to create tables
I will update the package the more I understand of the other template files and functions (poetry, tox vs. pytest, black)
- the
setup.py
file is only needed for developer mode install- in fact the
pyproject.toml
contains a block[build-system]
with some flit-stuff that should enable developer-mode somehow withoutsetup.py
file (read)
- in fact the
- if the package depends on a custum package
my_other_pack
that you want to edit during development- specify it in the
env.yml
file (so users have it in their env) - when doing
conda create -f env.yml
it will get installed via pip (good for the users, bad for you since the path is somewhere in your env-directory) - now reinstall with your local repo folder
my_other_pack
by:- activate environment
conda env create -f env.yml
- uninstall the package
pip uninstall my_other_pack
- change directory to your local installation
cd /PATH/to/your/local/my_other_pack
- pip-install it in editable mode:
pip install -e . --user
- activate environment
- specify it in the
If you plan having jupyter-notebooks in your repository, place them in the ./notebooks folder. The below settings are inspired by this stackoverflow post
- this folder contains the file ./notebooks/.gitattributes that will run at each add of an
*.ipynb
file the filterstrip-notebook-output
.- note that it will only remove the output for the git-commit BUT the output in your local notebook remains.
- the filter
strip-notebook-output
needs to be defined in your local.git/config
or global.gitconfig
as:
[filter "strip-notebook-output"]
clean = "jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR"
- in order to run this you need to have the following packages installed
conda install -c conda-forge jupyter_contrib_nbextensions
conda install nbconvert