Skip to main content

Poetry Plugin that uses setuptools-scm to determine version

Project description

Poetry Setuptools SCM Plugin

poetry-setuptools-scm-plugin is a Poetry plugin that uses setuptools_scm to extract a package version from git or Mercurial metadata.

Installation

Add the plugin to Poetry:

poetry self add poetry-setuptools-scm-plugin

Usage

To enable it in your Poetry-based project add the following to your pyproject.toml:

[tool.setuptools_scm]

With this the version specified in version of the tool.poetry section in pyproject.toml is ignored and the version derived by setuptools_scm is used instead. See its documentation on further configuration options.

[!NOTE] The Poetry team believes "that the version is one of the static metadata and the pyproject.toml is the single source of truth for it".

Similar tools

  • poetry-version-plugin: This plugin allows to read the version either from a git tag or a version definition in an __init__.py file. To my latest knowledge it cannot derive dev-versions from git.
  • poetry-dynamic-versioning: Instead of using setuptools_scm this plugin utilizes Dunami which comes with even more features than setuptools_scm.

Development

Prerequisites

  • Python >=3.10, can for example be installed with pyenv:

    pyenv install 3.10
    pyenv local 3.10
    
  • Poetry >=1.2

  • the latest release of the plugin installed in poetry

    poetry self add poetry-setuptools-scm-plugin
    

Setup

poetry install

To simplify running commands in the Poetry environment:

poetry shell

The following section assume that the commands are executed from such a Poetry shell.

Test

pytest

Check

ruff check

Build

poetry build

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry_setuptools_scm_plugin-0.2.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file poetry_setuptools_scm_plugin-0.2.0.tar.gz.

File metadata

File hashes

Hashes for poetry_setuptools_scm_plugin-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d94dd692513f071cc1840000ab3d529ae9106f225052dd2790d84cf3039bfa9b
MD5 571232a5896d432da5c5dcd1713051a9
BLAKE2b-256 dcdad4d3b5f64d7b2d0269435abf664bede4b9aad1d5a959e27681b4f51b2fee

See more details on using hashes here.

File details

Details for the file poetry_setuptools_scm_plugin-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_setuptools_scm_plugin-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46f5ffa6e97b5a98963288b7a9368c62d0ebcdd6a3e063abfcdbdaad5146fa58
MD5 947480bc26fed0d52da4191b4b790da8
BLAKE2b-256 8bd865a67e425ccb42b3a1167a0a91f247d71e18d6688b0807715ddf656a9971

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page