Notes from the meeting
- If all you have is Python, you can create a virtual environment by using:
python -m venv .venv --prompt .
- Other tools can create virtual environments like:
- poetry
- uv
Turning your code into a package changes tells Python that your project is a cohesive unit, not just a collection of files.
Doing this also means you don't have to change your PYTHON_PATH variable.
-
Create a
pyproject.tomlfile with at least a[project]and[build-system]table. -
Install your project into your virtual environment via:
pip install -e .
Putting your code into a src folder protects it from several classes of bugs and errors.
You can create custom command line programs that run functions in your code.
- In your
pyproject.tomlfile, add a[project.scripts]table that connects the name of the script you want to create (on the left side) to the function you want to run (on the right).
[project.scripts]
hello = 'best:cli'
On the right side, tell Python how to get to the function If the function you want to run is called run_monthly_report, and it's located at project_root/src/shop/services/report.py, you should write 'shop.services.report:run_monthly_report'.
project_root/
.venv/
data/
00_raw/
01_processed/
(look at Kedro)
...
dags/
docs/
notebooks/
reports/
scripts/
src/
project_name/
tests/
pyproject.toml
README.md
-
Use justfile to document and run common commands.
-
https://www.youtube.com/watch?v=TiBIjouDGuI (Hynek Schlawak has a link to his justfile)
-
z (jumping around the terminalxs)
-
Secure secrets and env vars
- direnv (local env vars, auto activating venv) [Trey Hunner's post about direnv]
- omegaconf