… and again and again.
“Rituals” is a task library for Invoke that keeps the
most common tasks you always need out of your project, and makes them centrally maintained.
This leaves your
tasks.py small and to the point,
with only things specific to the project at hand.
The following lists the common task implementations that the
rituals.easy module offers.
See the next section on how to integrate them into your
help– Default task, when invoked with no task names.
clean– Perform house-cleaning.
build– Build the project.
test– Perform standard unittests.
check– Perform source code checks.
release.bump– Bump a development version.
release.dist– Distribute the project.
release.prep– Prepare for a release (perform QA checks, and switch to non-dev versioning).
- … and many more, see
inv -lfor a complete list.
The guiding principle for these tasks is to strictly separate
low-level tasks for building and installing (via
from high-level convenience tasks a developer uses (via
Invoke tasks can use Setuptools ones as building blocks,
but never the other way 'round
– this avoids any bootstrapping headaches during package installations.
inv -h ‹task› as usual to get details on the options of these tasks.
Look at the modules in acts
if you want to know what these tasks do exactly.
|The easiest way to get a working project using
Some Practical Examples
In projects that include Rituals in their
tasks.py (e.g. this one), the following commands can be used.
Add common tasks to your project's
rituals to your
dev-requirements.txt or a similar file,
or add it to
setup_requires in your
Then at the start of your
tasks.py, use the following statement to define all tasks that are considered standard:
from rituals.easy import *
Note that this defines Invoke's
namespacewith Ritual's default tasks, and some common helpers
(see the documentation for details).
Of course, you can also do more selective imports,
or build your own Invoke namespaces with the specific tasks you need.
|These tasks expect an importable
To refer to the current GitHub
master branch, use a
pip requirement like this:
Change default project layout
By default, sources are expected in
src/‹packagename› and tests in
You can change this by calling one of the following functions, directly after the import from
config.set_maven_layout()– Changes locations to
config.set_flat_layout()– Changes locations to
Change default project configuration
To create a working directory for this project, call these commands:
git clone "https://github.com/jhermann/rituals.git" cd rituals . .env --yes --develop invoke build --docs
To use the source in this working directory within another project,
change your current directory to this project,
bin/pip from that project's virtualenv like so:
…/.venv/…/bin/pip install -e .
See CONTRIBUTING for more.
This is the process of releasing
projects that use it will have an identical to very similar sequence of commands.
inv release.prep inv dist --devpi # local release + tox testing git push && git push --tags # … and wait for Travis CI to do its thing twine upload -r pypi dist/*
If you have any pending changes, staged or unstaged, you'll get an error like this:
- pyinvoke/invocations – A collection of reusable Invoke tasks and task modules.