@@ -6,6 +6,72 @@ A nix template for python packages managed with
66those in the [ omnix registry] ( #credits ) to the extent possible with python and
77its ecosystem.
88
9+ ## Template usage
10+
11+ You can use [ omnix] ( https://omnix.page/om/init.html ) [ ^ omnix ] to initialize this template:
12+
13+ ``` sh
14+ nix --accept-flake-config run github:juspay/omnix -- \
15+ init github:cameronraysmith/python-nix-template -o new-python-project
16+ ```
17+
18+ [ ^ omnix ] : If you have omnix installed you just need ` om init ... ` and not ` nix run ... -- init `
19+
20+ ### Quick Start
21+
22+ The template supports three types of development environments:
23+
24+ 1 . nix devshell
25+ 2 . python virtualenv via uv
26+ 3 . conda environments via pixi
27+
28+ The intended workflow is to run
29+
30+ ``` sh
31+ make bootstrap
32+ ```
33+
34+ only the very first time you are setting up one of these templates. This will
35+ verify you have the [ nix package manager] ( https://nix.dev ) and
36+ [ direnv] ( https://direnv.net/ ) installed. After this running
37+
38+ ``` sh
39+ direnv allow
40+ ```
41+
42+ will ensure you have all development tools on a project directory-specific
43+ version of your PATH variable. These include the ` just ` task runner, which
44+ provides an alternative to using [ GNU Make] ( https://www.gnu.org/software/make/ )
45+ as a task runner. See the [ task runner] ( #task-runner ) section for a listing of
46+ development commands.
47+
48+ #### python virtualenv
49+
50+ 1 . Create and sync virtual environment:
51+
52+ ``` sh
53+ just venv
54+ source .venv/bin/activate
55+ ```
56+
57+ 2 . Run tests:
58+
59+ ``` sh
60+ just test
61+ ```
62+
63+ 3 . Run linting:
64+
65+ ``` sh
66+ just lint
67+ ```
68+
69+ 4 . Build package:
70+
71+ ``` sh
72+ just build
73+ ```
74+
975## Features
1076
1177- Modern python packaging with ` pyproject.toml `
@@ -49,41 +115,75 @@ contain necessary system-level dependencies.
49115
50116### Task runner
51117
52- This project uses ` just ` as a task runner, which is provided in the [ development
53- shell] ( #prerequisites ) . List available commands with:
54-
55- ``` bash
56- just
118+ This project uses [ ` just ` ] ( https://just.systems/man/en/ ) as a task runner, which
119+ is provided in the [ development shell] ( #prerequisites ) . List available commands
120+ by running ` just ` alone.
121+
122+ <details >
123+ <summary >just recipes</summary >
124+
125+ ``` sh
126+ default # List all recipes
127+
128+ [CI/CD]
129+ gcloud-context # Set gcloud context
130+ ghsecrets repo=" cameronraysmith/python-nix-template" # Update github secrets for repo from environment variables
131+ ghvars repo=" cameronraysmith/python-nix-template" # Update github vars for repo from environment variables
132+ pre-commit # Run pre-commit hooks (see pre-commit.nix and note the yaml is git-ignored)
133+
134+ [conda package]
135+ conda-build # Package commands (conda)
136+ conda-check # Run all checks in conda environment (lint, type, test)
137+ conda-env # Create and sync conda environment with pixi
138+ conda-lint # Run linting in conda environment with pixi
139+ conda-lint-fix # Run linting and fix errors in conda environment with pixi
140+ conda-lock # Update conda environment
141+ conda-test # Run tests in conda environment with pixi
142+ conda-type # Run type checking in conda environment with pixi
143+ pixi-lock # Update pixi lockfile
144+
145+ [nix]
146+ ci # Run CI checks locally with `om ci`
147+ container-build # Build production container image
148+ container-build-dev # Build development container image
149+ container-run # Run production container with port 8888 exposed
150+ container-run-dev # Run development container with port 8888 exposed
151+ dev # Enter the Nix development shell
152+ flake-check # Validate the Nix flake configuration
153+ flake-update # Update all flake inputs to their latest versions
154+
155+ [python package]
156+ check # Run all checks (lint, type, test)
157+ lint # Run linting
158+ lint-fix # Run linting and fix errors
159+ test # Run tests
160+ type # Run type checking in uv virtual environment
161+ uv-build # Package commands
162+ uv-lint # Run linting in uv virtual environment
163+ uv-lint-fix # Run linting and fix errors in uv virtual environment
164+ uv-lock # Update lockfile from pyproject.toml
165+ uv-test # Run tests in uv virtual environment
166+ uv-type # Run type checking in uv virtual environment
167+ venv # Sync and enter uv virtual environment
168+
169+ [secrets]
170+ check-secrets # Check secrets are available in teller shell.
171+ create-and-populate-separate-secrets path # Complete process: Create and populate separate secrets for each line in the dotenv file
172+ create-and-populate-single-secret name path # Complete process: Create a secret and populate it with the entire contents of a dotenv file
173+ create-secret name # Create a secret with the given name
174+ export # Export unique secrets to dotenv format
175+ get-secret name # Retrieve the contents of a given secret
176+ populate-separate-secrets path # Populate each line of a dotenv-formatted file as a separate secret
177+ populate-single-secret name path # Populate a single secret with the contents of a dotenv-formatted file
178+ seed-dotenv # Create empty dotenv from template
179+ show # Show existing secrets
180+
181+ [template]
182+ template-init # Initialize new project from template
183+ template-verify # Verify template functionality by creating and checking a test project
57184```
58185
59- ### Quick Start
60-
61- 1 . Create and sync virtual environment:
62-
63- ``` bash
64- just venv
65- source .venv/bin/activate
66- ```
67-
68- 2 . Run tests:
69-
70- ``` bash
71- just test
72- ```
73-
74- 3 . Run linting:
75-
76- ``` bash
77- just lint
78- ```
79-
80- 4 . Build package:
81-
82- ``` bash
83- just build
84- ```
85-
86- Run ` just ` alone for a listing of all available task recipes.
186+ </details >
87187
88188## credits
89189
0 commit comments