Closed copperwire closed 1 year ago
Hi! You have a small typo:
diff --git a/pyproject.toml b/pyproject.toml
index 1981870..ecb4982 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,7 +8,7 @@ packages = [
]
[tool.poetry-dynamic-versioning]
-enabe = true
+enable = true
vcs = "git"
style = "semver"
Hmm, how did you install the plugin? poetry self add "poetry-dynamic-versioning[plugin]"
, pipx inject poetry "poetry-dynamic-versioning[plugin]"
, or another way?
Could you share the output from these commands?
poetry self show
poetry-dynamic-versioning
.poetry dynamic-versioning --help
*after fixing the typo in the pyproject.toml
I installed earlier today with poetry self add ...
The manual CLI interaction works fine, by the way. Running poetry dynamic-versioning
produces the desired results in pyproject.toml
and __init__.py
poetry self show
:
$ poetry self show
attrs 22.1.0 Classes Without Boilerplate
cachecontrol 0.12.11 httplib2 caching for requests
cachy 0.3.0 Cachy provides a simple yet effective caching library.
certifi 2022.9.24 Python package for providing Mozilla's CA Bundle.
cffi 1.15.1 Foreign Function Interface for Python calling C code.
charset-normalizer 2.1.1 The Real First Universal Charset Detector. Open, modern and actively...
cleo 1.0.0a5 Cleo allows you to create beautiful and testable command-line interf...
crashtest 0.3.1 Manage Python errors with ease
cryptography 38.0.3 cryptography is a package which provides cryptographic recipes and p...
distlib 0.3.6 Distribution utilities
dulwich 0.20.50 Python Git Library
dunamai 1.13.2 Dynamic version generation
filelock 3.8.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)
jaraco-classes 3.2.3 Utility functions for Python class constructs
jeepney 0.8.0 Low-level, pure Python DBus protocol wrapper.
jinja2 3.1.2 A very fast and expressive template engine.
jsonschema 4.17.0 An implementation of JSON Schema validation for Python
keyring 23.9.3 Store and access your passwords safely.
lockfile 0.12.2 Platform-independent file locking module
markupsafe 2.1.1 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 21.3 Core utilities for Python packages
pexpect 4.8.0 Pexpect allows easy control of interactive console applications.
pkginfo 1.8.3 Query metadatdata from sdists / bdists / installed packages.
platformdirs 2.5.2 A small Python module for determining appropriate platform-specific ...
poetry 1.2.2 Python dependency management and packaging made easy.
poetry-core 1.3.2 Poetry PEP 517 Build Backend
poetry-dynamic-versioning 0.20.0 Plugin for Poetry to enable dynamic versioning based on VCS tags
poetry-plugin-export 1.1.2 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
pylev 1.4.0 A pure Python Levenshtein implementation that's not freaking GPL'd.
pyparsing 3.0.9 pyparsing module - Classes and methods to define and execute parsing...
pyrsistent 0.19.1 Persistent/Functional/Immutable data structures
requests 2.28.1 Python HTTP for Humans.
requests-toolbelt 0.9.1 A utility belt for advanced users of python-requests
secretstorage 3.3.3 Python bindings to FreeDesktop.org Secret Service API
shellingham 1.5.0 Tool to Detect Surrounding Shell
six 1.16.0 Python 2 and 3 compatibility utilities
tomlkit 0.11.6 Style preserving TOML library
urllib3 1.26.12 HTTP library with thread-safe connection pooling, file post, and more.
virtualenv 20.16.6 Virtual Python Environment builder
webencodings 0.5.1 Character encoding aliases for legacy web content
poetry dynamic-versioning --help
:
poetry dynamic-versioning --help
Description:
Apply the dynamic version to all relevant files and leave the changes in-place. This allows you to activate the plugin behavior on demand and inspect the result.
Usage:
dynamic-versioning [options]
Options:
-h, --help Display help for the given command. When no command is given display help for the list command.
-q, --quiet Do not output any message.
-V, --version Display this application version.
--ansi Force ANSI output.
--no-ansi Disable ANSI output.
-n, --no-interaction Do not ask any interactive question.
--no-plugins Disables plugins.
--no-cache Disables Poetry source caches.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
Oh changing the build to
[build-system]
requires = ["poetry-core>=1.3.0"]
build-backend = "poetry.core.masonry.api"
produces the expected behaviour from poetry build
That's really weird. The full pyproject.toml you posted (with build-backend = ["poetry_dynamic_versioning.backend"]
) works on my end. As far as I know, Poetry itself doesn't use the current project's build-backend setting, only from dependencies. For example, build-backend = ["foo"]
works for me too.
I'm curious, if you change it back now that it's working, what happens?
Also, what OS are you using, and how did you install Poetry itself?
I'm in WSL 2.0 on windows. Running Ubuntu 20.04 - 5.10.16.3-microsoft-standard-WSL2
Undoing the change persists the expected good behaviour.
I'm using pyenv
and have installed poetry per shim using pip
, so no global install.
Is it possible to get dynamic-versioning to raise an error on simple spelling errors, by the way?
Undoing the change persists the expected good behaviour.
I don't understand what happened, but I'm glad it's working for you now 😅
Is it possible to get dynamic-versioning to raise an error on simple spelling errors, by the way?
That sounds like a good idea. I can have it flag any unknown keys.
I don't understand what happened, but I'm glad it's working for you now :sweat_smile:
I don't understand either so I'm curious how @copperwire got it working!
Is this the correct command line syntax to build with dynamic versioning?
poetry run poetry build
Otherwise without the extra poetry run
the dynamic versioning plugin does not run.
Thank you for a great plugin! :heart:
That sounds like a good idea. I can have it flag any unknown keys.
This also solves the issue where you might place the substitution keys under the dynamic-versioning tag , right ? I also made that error earlier : ))))
@roblight The plugin doesn't activate during poetry run
(source). The only way that should be possible is if the plugin is installed inside of your project's virtual environment, rather than installed alongside your copy of Poetry. Did you maybe specify the plugin in your pyproject.toml dev-dependencies instead of using poetry self add
?
Preview of the validation:
$ poetry build
poetry-dynamic-versioning configuration issues:
- Unknown key: tool.poetry-dynamic-versioning.enabe
- Unknown key: tool.poetry-dynamic-versioning.substitution.foo
Building poetry-dynamic-versioning (0.20.0)
- Building sdist
- Built poetry_dynamic_versioning-0.20.0.tar.gz
- Building wheel
- Built poetry_dynamic_versioning-0.20.0-py3-none-any.whl
I left it as a warning instead of a hard error for now, but I might change that in the future.
Sounds real good to me!
Hi,
I've tried to set up a MRE to test dynamic versioning, and cannot reproduce the desired behaviour where
poertry build
should substitute the0.0.0
version identifier.Given a project layout :
with
pyproject.toml
:a simple substitution target in
__init__.py
as well:and a git repository initialized, commited and with a
tag
:I would expect the
poetry build
command to build0.1.0
, but the actual resulting build is0.0.0
. Am I simply misunderstanding the use, or setup?Poetry is updated as well: