Skip to content

🍪 A cookiecutter template that creates a basic Python setuptools project, which can be later on augmented with various optional accessories.

License

CC0-1.0, MIT licenses found

Licenses found

CC0-1.0
LICENSE_CC0
MIT
LICENSE_MIT
Notifications You must be signed in to change notification settings

Springerle/py-generic-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-generic-project

A cookiecutter template that creates a basic Python setuptools project, which can be later on augmented with various optional accessories.

Apache 2.0 licensed

Features

The resulting project uses rituals and invoke for task automation, and setuptools for building and distributing the project. A provided autoenv script takes care of creating a fully boot-strapped virtualenv – it can also be used manually if you don't want to install autoenv.

The setup.py script follows the DRY principle and tries to minimize repetition of project metadata by loading it from other places (like the package's __init__.py). Incidently, this makes the script almost identical between different projects, and thus provides an easy update experience later on. Usually, the only specific thing in it is the docstring with the project's name and license notice. This relies on conventions, specially check out __init__.py and __main__.py in the src folder, for their double-underscore meta variables.

It is also importable (by using the usual if __name__ == '__main__' idiom), and exposes the project's setup data in a project dict. This allows other tools to exploit the contained data assembling code, and again supports the DRY principle. The rituals package uses that to provide Invoke tasks that work for any project, based on its project metadata.

Other integrated tools are pylint for code quality checking, pytest for testing support, and a Travis CI configuration.

Using the Template

Preparations

In case you don't have the cookiecutter command line tool yet, here's how to install it.

Project Creation

Creating a new Python project based on this template goes like this (make sure you're in the directory you want your project added to):

cookiecutter "https://github.com/Springerle/py-generic-project.git"

It's advisable to git add the created directory directly afterwards, before any generated files are added, that you don't want to have in your repository.

💡 To get your defaults for common template values cookiecutter will ask you for when you use a template, it makes sense to have a ~/.cookiecutterrc in your home directory. Follow the link to see an example.

You should at least check these files regarding their content and adapt them according to your needs:

  • classifiers.txt – Add the correct categories (a/k/a Trove classifiers) for your project.
  • requirements.txt – Add any Python packages you need for your project at runtime.

To bootstrap the project (as mentioned, best after git add), use these commands from within its directory:

. .env # answer the prompt with (y)es
inv ci | less -R
"$(basename $(pwd))" --help

References

About

🍪 A cookiecutter template that creates a basic Python setuptools project, which can be later on augmented with various optional accessories.

Topics

Resources

License

CC0-1.0, MIT licenses found

Licenses found

CC0-1.0
LICENSE_CC0
MIT
LICENSE_MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •