A rocker extension for installing pixi in a container
Project description
cargo_rocker
Continuous Integration Status
Intro
This a template for creating rocker extensions. It used off-your-rocker as a starting point, and migrated to use pyproject.toml
instead of setup.py
to help manage the development environment and continuous integration in a modern way using pixi. Pixi is a cross-platform package manager based on the conda ecosystem. It provides a simple and performant way of reproducing a development environment and running user defined tasks and worflows. It more lightweight than docker, but does not provide the same level of isolation or generality.
This has basic setup for
- pylint
- ruff
- black
- pytest
- git-lfs
- basic github actions ci
- pulling updates from this template
- codecov
- pypi upload
- dependabot
Install
- Use github to use this project as a template
- Clone the project and run,
scripts/update_from_template.sh
and then run thescripts/rename_project.sh
to rename the project.
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
Github setup
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.
If you use vscode to attach to your development container it makes it easier to set up specific extensions for each project that don't need to be installed globally.
Development
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_task
Adding Functionality
-
Rename cargo_rocker/cargo_rocker.py and the class inside to something more appropriate. Use scripts/rename and pass in the new project name.
-
Update the extension entrypoint in
pyproject.toml
[project.entry-points."rocker.extensions"]
cargo_rocker = "cargo_rocker.cargo_rocker:CargoRocker"
e.g.:
lazygit = "lazygit_rocker.lazygit_rocker:LazygitExtension"
-
Update the
get_name()
function in the extension class. e.g. Updating the name tolazygit
would mean that it would be activated by passing --lazygit to rocker -
Add/update the docker snippets in the templates folder. Officially the extension is supposed to be .Dockerfile.em to indicate it's passed to the empy library, but I have left them as .Dockerfile as I get Dockerfile highlighting out of the box that way.
-
Develop your extension. I find that using
pip install -e .
and running the extension with rocker on my host system is the easiest way to get started.rocker --lazygit ubuntu:22.04 #check that everything works as expected
Troubleshooting
The main pixi tasks are related to CI. Github actions runs the pixi task "ci". The CI is mostly likey to fail from a lockfile mismatch. Use pixi run fix
to fix any lockfile related problems.
vscode tasks
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>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cargo_rocker-0.0.2.tar.gz
.
File metadata
- Download URL: cargo_rocker-0.0.2.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 187cb9254fdb33aa608b111adf074601e820b06507a1c43d57259c009baa086e |
|
MD5 | fd67e869cf031c0cf6bc1f1800afab8a |
|
BLAKE2b-256 | 56cfceaf9fdd7d0f7fd52561bca90b9f56795f7456f07013c688481f0552405a |
File details
Details for the file cargo_rocker-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: cargo_rocker-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c18062f15a2a024cd1900d8e7b07460ba7c7fe6cb5aaeb373d7bbc836bc0aa1a |
|
MD5 | c2eb8246a9f08e1f48a782b88a157b14 |
|
BLAKE2b-256 | 78f62a55ca9602ff4e0d45762fc03a373b9107d86ca0ba7ee799f74497f953a6 |