Skip to content

SoftwareHeritage/swh-py-template

Repository files navigation

Software Heritage - Python module template

This is a copier template aiming at helping the creation and the lifecycle management of the many Software Heritage Python modules.

Make sure you have copier installed in your working environment.

Create a new swh package

  1. create the new package (here a swh.foo) from this template and answer the questions asked:

    $ copier copy https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git swh-foo
  2. initialize your new git repository from there:

    $ cd swh-foo
    swh-foo$ git init .
    swh-foo$ git add -A
    swh-foo$ git commit -m "Initial import from copier"
  3. you also probably want to install the pre commit hook (according you have pre-commit installed in your working environment):

    swh-foo$ pre-commit install

That's it! You should have a working swh package ready to hack. It includes:

  • a tox.ini file so you can run directly tox in there,
  • a sphinx documentation template; you can run tox -e sphinx to build it,
  • a template tests/ directory; you can run tox -e py3 to run them,
  • a set of configuration for mypy, pytest, flake8 etc.

In a real life scenario, you typically will want to start from the swh-environment developer environment, so go read the developer setup installation documentation.

Please read the copier documentation for more details on the usage of the copier tool.