Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

It must be a setuptools plugin #1

Closed
KOLANICH opened this issue Feb 2, 2020 · 3 comments
Closed

It must be a setuptools plugin #1

KOLANICH opened this issue Feb 2, 2020 · 3 comments

Comments

@KOLANICH
Copy link

KOLANICH commented Feb 2, 2020

No description provided.

@jwodder
Copy link
Owner

jwodder commented Feb 3, 2020

Implementing this as a setuptools plugin would just mean the syntax changes from:

from read_version import read_version

setup(
    version = read_version('packagename', '__init__.py'),
    ...
)

to:

setup(
    read_version = ['packagename', '__init__.py'],
    ...
)

I don't see that as enough of an improvement to be worth mucking about with setuptools' underdocumented extension mechanisms.

(Note: I actually submitted a pull request to setuptools that would expose this package's functionality via a literal_attr: directive in setup.cfg files, but it's been ignored so far.)

@jwodder jwodder closed this as completed Feb 3, 2020
@jwodder
Copy link
Owner

jwodder commented Mar 17, 2020

I've changed my mind! — sort of. As of the release yesterday of version 0.2.0, read_version can now be used a setuptools plugin, but rather than being configured through arguments to setup(), it reads its configuration from pyproject.toml, like so:

[tool.read_version]
# This sets your project's version to the value of the __version__ variable in packagename/__init__.py:
version = "packagename.__init__:__version__"

See the README for more information.

@KOLANICH
Copy link
Author

Nice, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants