In addition to the Prerequisites listed in the README you
will need the following to develop pycliche:
- prek
- shellcheck (needed by the
actionlintpre-commit hook)
The pycliche repo has been retrofit to use pycliche itself as its template following
release v2.6.0.
To update pycliche to a newer version of itself:
cd ~/Projects/pycliche/
uvx copier update --skip-answered --trust [--vcs-ref=<TAG>]If the --vcs-ref flag is not specified, copier will use the latest pycliche tag.
This repo follows trunk-based development. This means:
- the
mainbranch should always be in a releasable state - use short-lived feature branches
Dependencies are defined in the pyproject.toml file. uv is used to manage
dependencies:
# add a dependency to the project
uv add some-packageThere are two places where dependencies are currently declared in the template:
prek.tomlpyproject.toml.jinja
Update git hooks in the former via:
cd template/ && prek autoupdateUpdate Python packages in the latter manually. Automated option pending on account of
commands like uv lock --upgrade-package not taking kindly to Jinja templates.
When developing pycliche it is useful to observe the outcome of generating new projects
that use in-progress features. To do so:
# navigate to the parent directory of your local copy of pycliche
cd ~/Projects/
# vcs-ref flag to use the latest local version of pycliche instead of a tagged version
uvx copier copy --vcs-ref=HEAD pycliche $TEST_PROJECT_NAMECode style is enforced by prek pre-commit hooks. Linter rules are configured in the
ruff tables in pyproject.toml.
# before you start developing, install pre-commit hooks
prek install
# update pre-commit hooks
prek autoupdateDocstrings should follow the conventions set out in the Google styleguide.
Please follow the Conventional Commits
guidelines when writing commit messages. commitlint is enabled as a pre-commit hook.
Valid commit types are defined in .commitlintrc.ts.
# Run all `pytest` tests (in parallel by default)
nox
# Run tests with the debugger enabled (serial execution due to `pdb`)
nox -- --pdbBy default this will only run the nox session for the latest supported Python release.
To run all nox sessions (ie. for all supported Python releases):
nox -k testsPass flags as you normally would to pytest by placing them after -- eg.
nox -- -k some_keyword_expressionTests have marks, allowing you to run only a subset:
nox -- -m unit
# or
nox -- -m "not smoke"See the tool.pytest table in pyproject.toml for a list of all marks.
Nox is used to automate testing across different Python versions. Test sessions are
configured via noxfile.py.
A matrix strategy is used for the test GitHub Action. This runs each Nox session
(i.e. Python version test run) as a separate pipeline job.
Release Please is used to automate:
- Updating the changelog.
- Calculating the new SemVer tag based on conventional commit types.
- Creating a new GitHub release.
Release Please is configured as a GitHub action (release-please.yaml).
It keeps a release pull request open that is refreshed as changes are merged into main.
To cut a release, simply merge the release pull request.
In order for Release Please to automate the above process, a GitHub Actions secret called
PYCLICHE_RELEASE_PLEASE_TOKEN must exist in GitHub (albertomh/pycliche/settings/secrets/actions).
The contents of this secret must be a Personal Access Token (PAT) with the following permissions:
contents: write
pull-requests: writeFor more information, consult the release-please-action project.
The main README includes a GIF showcasing generating a project using
pycliche. To record a new demo, record the output of running docs/media/auto_pycliche_demo.sh.
Convert to a gif with:
# speed up video by 2x (PTS/2)
ffmpeg -i pycliche-M.m.p-demo.mov -filter:v "setpts=PTS/2,fps=60" -an pycliche-M.m.p-demo_fast.mov
# convert to GIF
ffmpeg -i pycliche-M.m.p-demo_fast.mov -vf "fps=15,scale=iw:-1:flags=lanczos" -loop 0 pycliche-M.m.p-demo.gif