A template repo for python projects that is set up using pixi.
This has basic setup for
- pylint
- ruff (formatting and linting)
- pytest
- git-lfs
- basic github actions ci
- pulling updates from this template
- codecov
- pypi upload
- dependabot
There are two methods of using this project.
- Use github to use this project as a template
- Clone the project and run,
scripts/update_from_template.shand then run thescripts/rename_project.shto rename the project.
If you want to use docker you may want to run the scripts/setup_host.sh script. It will set up docker and nvidia-docker (assuming you are on ubuntu22.04).
If you are using pixi, look at the available tasks in pyproject.toml If you are new to pixi follow the instructions on the pixi website
This template includes built-in support for Claude Code online environment! The .claude/hooks/SessionStart script automatically:
- Installs pixi package manager
- Sets up all project dependencies
- Configures pre-commit hooks
- Prepares the development environment
Quick Start with Claude Code:
- Open this repository in Claude Code online
- The environment sets up automatically via the SessionStart hook
- Claude can immediately run commands like
pixi run test,pixi run lint, etc.
Manual activation (if needed):
source .claude/activate.shSee .claude/README.md for detailed information about the Claude Code configuration.
There are github workflows for CI, codecov and automated pypi publishing in ci.yml and publish.yml.
ci.yml uses pixi tasks to set up the environment matrix and run the various CI tasks. To set up codecov on github, you need to get a CODECOV_TOKEN and add it to your actions secrets.
publish.yml uses pypy-auto-publish to automatically publish to pypi if the package version number changes. You need to add a PYPI_API_TOKEN to your github secrets to enable this.
There are currently two ways of running code. The preferred way is to use pixi to manage your environment and dependencies.
cd project
$pixi run ci
pixi run arbitrary_taskIf you have dependencies or configuration that cannot be managed by pixi, you can use alternative tools:
- rockerc: A command-line tool for dynamically creating docker containers with access to host resources such as GPU and
- rockervsc: A Visual Studio Code extension that integrates rockerc functionality into vscode remote containers.
These tools help you create isolated environments with specific dependencies, ensuring consistent setups across different machines.
cd project_name
rockerc # build and launch container with dependencies set up
# OR
rockervsc # build container, launch and attach vscode to that container.
#once you are inside the container you can use the pixi workflows.
pixi run ciIf you don't want to install rocker on your system but want to use vscode, you can run the scripts/launch_vscode.sh script to build and connect to a docker container. It will install rocker in a venv. The docker container is dynamically generated using rocker and the configuration in rockerc.yaml.
The main pixi tasks are related to CI. Github actions runs the pixi task "ci". The CI is mostly likely to fail from a lockfile mismatch. Use pixi run fix to fix any lockfile related problems.
There are two core tasks.
-
set <cfg> from active file
This sets <cfg> to the currently opened file in the editor
-
run <cfg>
This runs python with the file set in <cfg>