Skip to content

elbakramer/cookiecutter-poetry

 
 

Repository files navigation

Cookiecutter Poetry

Cookiecutter template for a Python package using Poetry.

Linux build status on Github Actions

Features

  • Package and dependency management using Poetry
    • Has option to stick with setuptools (setup.py)
  • Github Actions: Ready for GitHub Actions
    • Build and test on push or pull request for continuous integration (CI) (+badge)
    • Build documentation on push, publish the built documentation to Github Pages (+badge)
    • Draft release on push, this draft can be published manually or even automatically when new tag is pushed
    • Build and release Python package to PyPI when new release tag is published on github
  • Many pre-commit hook based formatting, linting, testing tools
  • Other integrations to external sites/services
  • Version bumping using bump2version
  • Dynamic versioning using dunamai
  • Command line interface using Click

Quickstart

Install the latest Cookiecutter if you haven't installed it yet (this requires Cookiecutter 1.4.0 or higher):

# Install pipx
$ pip install pipx
$ pipx ensurepath

# Install cookiecutter using pipx
$ pipx install cookiecutter

Generate a Python package project:

cookiecutter https://github.com/elbakramer/cookiecutter-poetry.git

Then, if you choose to try poetry:

# Install pipx
$ pip install pipx
$ pipx ensurepath

# Install poetry using pipx
$ pipx install poetry

# Run `poetry install` to install dependencies
$ cd {{ cookiecutter.github_repository_name }}/
$ poetry install

# Initialize git
$ git init

# Install pre-commit hooks
$ poetry run pre-commit install

# Do initial commit
$ git add --all
$ git commit -m "Initial commit"

Or, if you choose to stick with setuptools:

# Install dependencies using pip
$ cd {{ cookiecutter.github_repository_name }}/
$ pip install --editable .[dev]

# Initialize git
$ git init

# Install pre-commit hooks
$ pre-commit install

# Do initial commit
$ git add --all
$ git commit -m "Initial commit"

Lastly, you can:

  • Create a github repo and push there.
  • Add the repo to your ReadTheDocs account + turn on the ReadTheDocs service hook.
  • Release your package by pushing a new tag to master.

Not Exactly What You Want?

Don't worry, you have options:

Similar Cookiecutter Templates

Fork This / Create Your Own

If you have differences in your preferred setup, I encourage you to fork this to create your own version. Or create your own; it doesn't strictly have to be a fork.

  • Once you have your own version working, add it to the Similar Cookiecutter Templates list above with a brief description.
  • It's up to you whether or not to rename your fork/own version. Do whatever you think sounds good.

Or Submit a Pull Request

I also accept pull requests on this, if they're small, atomic, and if they make my own packaging experience better.

About

Cookiecutter template for a Python package.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 91.8%
  • Makefile 3.3%
  • Batchfile 2.3%
  • CSS 1.8%
  • Dockerfile 0.8%