Skip to content

Poetry plugin that installs and configures common dev dependencies (black, isort, mypy, pytest, etc)

License

Notifications You must be signed in to change notification settings

ellen364/poetry-scaffold-plugin

Repository files navigation

poetry-scaffold-plugin

A Poetry plugin that installs and configures default dev dependencies, so you don't have to.

Get nice tools. Avoid the tedious boilerplate of setting up a project.

v0.1.0 is a preview and relies on the preview of Poetry's new plugin system. Expect rough edges.

What you get

The packages and configuration in poetry-scaffold-plugin were inspired by, but diverge from, Claudio Jolowicz's series on Hypermodern Python.

  • Testing
    • pytest for testing
    • coverage measures test coverage and identifies untested lines of code
    • pytest-cov adds nice coverage reports to pytest output
    • pytest-mock makes it more convenient to use mocks (e.g. adds a mocker fixture)
    • hypothesis helps find edge cases that break your code
  • Linting and formatting
    • black formats your code
    • isort sorts import statements
    • flake8 catches common mistakes and suggests good Python practices
    • flake8-bugbear catches even more issues
    • mypy checks type annotations
    • semgrep looks for common security problems
    • pre-commit runs checks (and automatically fixes what it can) before committing
  • Niceties
    • pdbpp works like the standard pdb debugger but has extra features like "sticky" mode
    • ipython provides a nicer shell for those interactive experimentation sessions

The linting is especially opinionated. If it's too much, or clashes with your house style, try deleting B9 from the extend-select section in setup.cfg.

The mypy settings are more lenient. The pre-commit hook will check type annotations that you've added, but won't demand you use type annotations.

Requirements

  • Poetry 1.2 (preview)

Poetry will add support for plugins in v1.2, currently in preview. To try poetry-scaffold-plugin, you must install Poetry >=1.2.0a2

Updating from Poetry v1.1 to the preview can't be done via Poetry's self update. Instead, use the new Poetry installer script. See the master version of the installer docs for more information. (Don't use the v1.1 docs, which refer to the old installer.)

Installation

After installing the Poetry preview, the new poetry plugin commands will be available. To install the plugin:

$ poetry plugin add poetry-scaffold-plugin

Note: Poetry plugins are installed in your global Poetry environment, not the project environment.

Usage

$ poetry new my-project && cd my-project
$ poetry scaffold

Poetry's built-in poetry new provides a standard project layout. poetry-scaffold-plugin's poetry scaffold provides the dev dependencies and configuration.

There are no customisable settings in v0.1.0. Your project's configuration can be tweaked in the usual way, by modifying pyproject.toml, setup.cfg and pre-commit-config.yaml.

About

Poetry plugin that installs and configures common dev dependencies (black, isort, mypy, pytest, etc)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages