Software Heritage Python development environment
This repository contains the scaffolding to initialize and keep a local
development environment for the Software Heritage Python stack. In particular,
it contains pointers to the Git repositories of all Software Heritage Python
modules. The repositories are managed using myrepos (see the .mrconfig
file), and the mr
command.
The provided mr config will also install a pre-commit hook in cloned
repositories, so the pre-commit
tool must be available as well.
In Debian, the "mr" command is shipped in the "mr" package.
Unfortunately, "pre-commit" itself is not available in Debian for now.
However, we strongly suggest you use a virtualenv to manage your SWH development environment. You can create it using virtualenv, or you can use a virtualenv wrapper tool like virtualenvwrapper or pipenv (or any other similar tool). In Debian, both these tools are available as "virtualenvwrapper" and "pipenv".
In the example below we are using virtualenv directly:
git clone https://forge.softwareheritage.org/source/swh-environment.git
cd swh-environment
python3 -m venv .venv
. .venv/bin/activate
pip install pre-commit
then you can use the following helper for both initial code checkout and subsequent updates:
bin/update
Note that the first time you run bin/update
it will add the
swh-environment/.mrconfig
file to your ~/.mrtrust
(we use this to be able
to setup pre-commit hooks upon repository checkouts) and install "pre-commit"
as git precommit hook in each git repository. See MR(1)
for more information
about trusted mr
repositories.
You can also checkout/update repositories by hand using mr up
.
See .mrconfig
for the actual list of repositories.
Upgrade from makefile-based hooks
Git pre commit hooks used to be makefile-based scripts. Running mr update
will automatically replace these by the pre-commit
tool,
Initialize a new Python package repository
-
create the remote Git repository on the forge
-
add it to
.mrconfig
(e.g. using mr register) -
mr update
this will clone the (empty) repository locally
-
bin/init-py-repo REPO_NAME
this will fill the repository with the template for SWH Python packages, and make an initial commit
-
cd REPO_NAME ; git push
Docker based test environment
Check the README file in the docker/ directory.