Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support metadata.version in setup.cfg #83

Closed
wants to merge 2 commits into from
Closed

Support metadata.version in setup.cfg #83

wants to merge 2 commits into from

Conversation

jaraco
Copy link
Contributor

@jaraco jaraco commented Aug 28, 2019

As proposed in #62, this change allows metadata.version in a setup.cfg file to stand in for bumpversion.current_version, meaning that with this change, bump2version would work with zero config on a project using setuptools' declarative config with static version numbers.

Although this technique worked, it feels a bit hacky, wrapping the configparser object and tricking the bumpversion code into thinking it's reading and writing the config value into the usual place(s).

I'm also not happy that it introduces an empty bumpversion section into the setup.cfg file when no section is needed. I'm out of time for now, so I want to get this published for review/comment. I look forward to your feedback.

if section == 'bumpversion':
try:
items.append(('current_version', self.get('metadata', 'version')))
except Exception:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this Exception and the one above should be narrower, configparser-specific exceptions.

tmpdir.chdir()
main(['patch', '--verbose'])

assert """[bumpversion]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annoying that the [bumpversion] section gets added, but that seems like an acceptable concession to make if no improvement could easily eliminate it.

@c4urself
Copy link
Owner

cool! I'll take a look when I get some more time -- I spent some time this past weekend exploring the (new to me) pyproject.toml stuff and wonder if you know more about if setuptools would end up moving setup.cfg config into the pyproject.toml format? I'm happy to merge this but it seems like ultimately the big win would be to use toml for everything?

@jaraco
Copy link
Contributor Author

jaraco commented Aug 28, 2019

See pypa/setuptools#1688 for the discussions on supporting pyproject.toml.

@techtonik
Copy link

@c4urself what do you think about setuptools taking care about its version through a get_version() function instead of relying on external tool pypa/setuptools#1679 ?

@albireox
Copy link

albireox commented Oct 5, 2019

While looking for a solution for #87 I checked out this PR and realised that when you have both a bumpversion.current_version and a metadata.version only the latter gets updated.

In this fork I tried to fix both #87 and that issue. There may be a more elegant solution but it seems to work fine. You're welcome to add those changes to your PR if you like, or I can open one myself.

@s-weigand
Copy link

Any updates on this?

s-weigand added a commit to glotaran/pyglotaran-alias that referenced this pull request Oct 2, 2020
s-weigand added a commit to glotaran/pyglotaran-alias that referenced this pull request Oct 2, 2020
s-weigand added a commit to glotaran/pyglotaran-alias that referenced this pull request Oct 2, 2020
#3)

* Changed packaging so 'import pyglotaran' works out of the box

* Added description how it works and known errors

* Refined descripton of linter problem

* Added editor config and .gitattributes

* Reset version to 0.0.1, added __version__ to __init__.py and added

bump2version config

* Set the indentation style of setup.cfg  to tab

since this is the way it gets transformed by bump2version, which parses back configparsers sting

* Added pre-commit autoupdate workflow

* Removed PyPy as supported implementation

* Fixed typo

* Added project urls

* Added python dependencies to dependabot and fixed version of glotaran

* Reactivated deployment in CI-CD workflow

I will keep in mind to create a new token

* Removed __version__ attr of the module, since it gets overwritten anyway

* Updated repo link to isort

* Removed bump2version and it's config since it doesn't work with setup.cfg

See c4urself/bump2version#83
s-weigand added a commit to glotaran/pyglotaran-alias that referenced this pull request Oct 3, 2020
#4)

* Changed packaging so 'import pyglotaran' works out of the box

* Added description how it works and known errors

* Refined descripton of linter problem

* Added editor config and .gitattributes

* Reset version to 0.0.1, added __version__ to __init__.py and added

bump2version config

* Set the indentation style of setup.cfg  to tab

since this is the way it gets transformed by bump2version, which parses back configparsers sting

* Added pre-commit autoupdate workflow

* Removed PyPy as supported implementation

* Fixed typo

* Added project urls

* Added python dependencies to dependabot and fixed version of glotaran

* Reactivated deployment in CI-CD workflow

I will keep in mind to create a new token

* Removed __version__ attr of the module, since it gets overwritten anyway

* Updated repo link to isort

* Removed bump2version and it's config since it doesn't work with setup.cfg

See c4urself/bump2version#83

* Updated isort repo rev and added .md to codespell checked files
@jaraco jaraco closed this by deleting the head repository Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants