- Just a minimal package, playing with https://github.com/pypa/sampleproject/blob/main/pyproject.toml
- Another nice site about packages: https://til.simonwillison.net/python/pyproject
- Setup tools automatic discovery: https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#automatic-discovery
- More on editable installs: https://setuptools.pypa.io/en/latest/userguide/development_mode.html
- Install miniconda: https://docs.conda.io/projects/miniconda/en/latest/
- Create your env:
conda create -n a_package
- Choose your python version:
conda install python=3.12.0
- Add you're dependencies to
dependencies
inpyproject.toml
- Install the package in editable mode for development:
python -m pip install -e .
- Run tests with
python -m unittest
- TODO: look into
tox
for testing
- TODO: look into
- You can
python -m pip install <path>/a_package
from another env to use the package
In the pyproject.toml
you can define entry points for scripts using
scripts = { a_package_hello = "a_package.hello.say_hello:say_hello" }
Then run a_package_hello
from the command line!
- Make sure to write a nice
README.txt
explaining what the package does and how to use it
- If you'd like to share you exact environment:
conda env export > environment.yaml
- This can be shared and installed with:
conda env create -f environment.yml
- This can be shared and installed with: