-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
github-actions[bot] edited this page Mar 10, 2026
·
1 revision
Clone the repo and install in editable mode with test dependencies:
git clone https://github.com/kickash/python-snacks.git
cd python-snacks
pip install -e ".[test]"Verify the CLI works:
snack --helppytest tests/ -vThe test suite has 33 tests across two files:
-
tests/test_commands.py— snippet commands (list,search,unpack,pack), config resolution, error cases -
tests/test_stash_commands.py— stash management commands (create,list,move,add-remote), including mocked HTTP foradd-remote
Tests never write to ~/.snackstashrc — the config path is redirected to a temp file via monkeypatch.
Every push and pull request to main runs the test suite against Python 3.10, 3.11, and 3.12 via GitHub Actions (.github/workflows/ci.yml). Pull requests must pass CI before merging.
Releases are fully automated via .github/workflows/publish.yml.
- Update the version in
pyproject.toml - Commit and push to
main - Tag the commit with a
v-prefixed version and push the tag:
git tag v0.2.0
git push origin v0.2.0The publish workflow will:
- Run the test suite
- Build the sdist and wheel
- Publish to PyPI (via OIDC trusted publishing — no API token required)
- Create a GitHub Release with the built artifacts attached
python-snacks/
├── pyproject.toml # Package metadata and dependencies
├── snacks/
│ ├── main.py # Typer app and all command definitions
│ ├── config.py # SnackConfig class, stash path resolution
│ └── ops.py # File ops: pack, unpack, add_remote
└── tests/
├── test_commands.py # Snippet command tests
└── test_stash_commands.py # Stash management tests
-
Config format:
~/.snackstashrcuses INI format ([stash.<name>]sections). The oldstash=<path>sectionless format is still read for backwards compatibility but never written. -
SNACK_STASHenv var: Always overrides the config file for all snippet commands. Useful for scripts and CI. -
add-remote: Uses only stdlib (urllib,tarfile) — no additional dependencies beyond Typer. -
Test isolation:
monkeypatch.setattr(config_module, "CONFIG_PATH", ...)redirects the config file to a temp path so tests are hermetic.