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.11, can for example be installed with pyenv:

    pyenv install 3.11
    pyenv local 3.11
    
  • 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

Note that for poetry > 2 this requires installing a plugin:

poetry self add poetry-plugin-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.3.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poetry_setuptools_scm_plugin-0.3.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: poetry_setuptools_scm_plugin-0.3.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-1017-azure

File hashes

Hashes for poetry_setuptools_scm_plugin-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c7d2b0772bc95e768415d14b404e3081e243c817876881651b199321cbea3791
MD5 dc6a710bc901393f4ecc9d025d06c3df
BLAKE2b-256 2a60009739806443114801f6b1779b15e7055e700bc437b6a8fdc8736ad04dbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for poetry_setuptools_scm_plugin-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c0df0936c3dcb7c476501ac9e5ff6cd11e64fb9542fa1abe2644c4f543f9982
MD5 48fe8b63a15086c1af02caebe4c90cb2
BLAKE2b-256 0d02fcd2b886c61da43d4dc1a8e09bc7cc59c80e7a5d29a73f3f21fdcdcd1c69

See more details on using hashes here.

Supported by

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