mtkennerly / poetry-dynamic-versioning

Plugin for Poetry to enable dynamic versioning based on VCS tags
MIT License
619 stars 36 forks source link

Poetry breaks when plugin is enabled #111

Closed vijayvammi closed 1 year ago

vijayvammi commented 1 year ago

Hello,

Thanks for the plugin, the functionality works but it seems to break poetry.

For example:

With this configuration of pyproject.toml, I cannot make poetry work at all.

[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
tag-branch = "main"
style = "semver"
format-jinja = "{% if distance == 0 %}{{ base }}{% else %}{{ base }}+{{ commit }}{% endif %}"

I get an error message: poetry --help

The pattern did not match any tags

Pattern:
(?x)                                                        (?# ignore whitespace)
    ^v((?P<epoch>\d+)!)?(?P<base>\d+(\.\d+)*)                   (?# v1.2.3 or v1!2000.1.2)
    ([-._]?((?P<stage>[a-zA-Z]+)[-._]?(?P<revision>\d+)?))?     (?# b0)
    (\+(?P<tagged_metadata>.+))?$                               (?# +linux)

Tags:
['0.4.0']

Once I make the enable flag to be false, I am able to get poetry to work.

poetry self show

poetry self show
attrs                     22.2.0      Classes Without Boilerplate
cachecontrol              0.12.11     httplib2 caching for requests
certifi                   2022.12.7   Python package for providing Mozilla's CA Bundle.
cffi                      1.15.1      Foreign Function Interface for Python calling C code.
charset-normalizer        3.0.1       The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.
cleo                      2.0.1       Cleo allows you to create beautiful and testable command-line interfaces.
crashtest                 0.4.1       Manage Python errors with ease
distlib                   0.3.6       Distribution utilities
dulwich                   0.20.50     Python Git Library
dunamai                   1.15.0      Dynamic version generation
filelock                  3.9.0       A platform independent file lock.
html5lib                  1.1         HTML parser based on the WHATWG HTML specification
idna                      3.4         Internationalized Domain Names in Applications (IDNA)
importlib-metadata        4.13.0      Read metadata from Python packages
importlib-resources       5.10.2      Read resources from Python packages
jaraco-classes            3.2.3       Utility functions for Python class constructs
jinja2                    3.1.2       A very fast and expressive template engine.
jsonschema                4.17.3      An implementation of JSON Schema validation for Python
keyring                   23.13.1     Store and access your passwords safely.
lockfile                  0.12.2      Platform-independent file locking module
markupsafe                2.1.2       Safely add untrusted strings to HTML/XML markup.
more-itertools            9.0.0       More routines for operating on iterables, beyond itertools
msgpack                   1.0.4       MessagePack serializer
packaging                 23.0        Core utilities for Python packages
pexpect                   4.8.0       Pexpect allows easy control of interactive console applications.
pkginfo                   1.9.6       Query metadata from sdists / bdists / installed packages.
pkgutil-resolve-name      1.3.10      Resolve a name to an object.
platformdirs              2.6.2       A small Python package for determining appropriate platform-specific dirs, e.g. a "user data dir".
poetry                    1.3.2       Python dependency management and packaging made easy.
poetry-core               1.4.0       Poetry PEP 517 Build Backend
poetry-dynamic-versioning 0.21.3      Plugin for Poetry to enable dynamic versioning based on VCS tags
poetry-plugin-export      1.3.0       Poetry plugin to export the dependencies to various formats
ptyprocess                0.7.0       Run a subprocess in a pseudo terminal
pycparser                 2.21        C parser in Python
pyrsistent                0.19.3      Persistent/Functional/Immutable data structures
rapidfuzz                 2.13.7      rapid fuzzy string matching
requests                  2.28.2      Python HTTP for Humans.
requests-toolbelt         0.10.1      A utility belt for advanced users of python-requests
shellingham               1.5.0.post1 Tool to Detect Surrounding Shell
six                       1.16.0      Python 2 and 3 compatibility utilities
tomli                     2.0.1       A lil' TOML parser
tomlkit                   0.11.6      Style preserving TOML library
trove-classifiers         2023.2.8    Canonical source for classifiers on PyPI (pypi.org).
urllib3                   1.26.14     HTTP library with thread-safe connection pooling, file post, and more.
virtualenv                20.19.0     Virtual Python Environment builder
webencodings              0.5.1       Character encoding aliases for legacy web content
xattr                     0.10.1      Python wrapper for extended filesystem attributes
zipp                      3.12.1      Backport of pathlib-compatible object wrapper for zip files
vijayvammi commented 1 year ago

Sorry, I think it has to do with the settings. I was able to solve it.

mtkennerly commented 1 year ago

No worries :) For anyone else who finds this ticket, the solution is to set pattern = default-unprefixed, since your tags don't have a v prefix.