Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ENH: Allow versioneer to be used as a module in PEP-518 mode#294

Merged
effigies merged 6 commits intopython-versioneer:masterpython-versioneer/python-versioneer:masterfrom
effigies:enh/pep518-modeeffigies/python-versioneer:enh/pep518-modeCopy head branch name to clipboard
Aug 30, 2022
Merged

ENH: Allow versioneer to be used as a module in PEP-518 mode#294
effigies merged 6 commits intopython-versioneer:masterpython-versioneer/python-versioneer:masterfrom
effigies:enh/pep518-modeeffigies/python-versioneer:enh/pep518-modeCopy head branch name to clipboard

Conversation

@effigies
Copy link
Contributor

As https://github.com/python-versioneer/versioneer-518 proves, the only thing preventing versioneer to be used in a non-vendored fashion and consistent with PEP-518 is making the variables available in the vendored module available via import versioneer.

This will not prevent vendored installations but may lead to silent interference. I also haven't added a non-vendored versioneer setup command, as I haven't evaluated what all the vendored version does that would be useful in a non-vendored context.

Others' thoughts would be welcome (@bucknerns?).

Closes #193.

@bucknerns
Copy link

The only thing the versioneer-518 does is package the vendored code. It would be nice if the get_version call was available for use even if the code had not been vendored. At the time of writing development on versioneer had stalled and my 518 version seemed necessary. Now I agree that exposing the methods seems like the best route and would probably allow for some cleanup of the implementation.
The local versioneer.py will take precedence over site packages version so it won't affect any vendored installs. If that is not the case I think having versioneer installed would prevent building vendored versioneer packages since the module doesn't have the get_version call.

@effigies
Copy link
Contributor Author

The local versioneer.py will take precedence over site packages version so it won't affect any vendored installs. If that is not the case I think having versioneer installed would prevent building vendored versioneer packages since the module doesn't have the get_version call.

I think that is sometimes the case, which leads some projects to add sys.path.insert(0, ".") to their setup.py. I don't fully understand why it seems to happen to some projects and not others.

@effigies effigies marked this pull request as ready for review July 26, 2022 13:31
@yarikoptic
Copy link
Contributor

@jwodder - would you be so kind to provide a review on this PR? My foo in Python build/dist/*-utils and corresponding PEPs is not that strong so can't really assess possible implications.

@effigies effigies force-pushed the enh/pep518-mode branch 3 times, most recently from 7ce197a to 062f329 Compare August 10, 2022 01:59
@effigies
Copy link
Contributor Author

effigies commented Aug 10, 2022

After letting this rest for a bit, I tried using it on a new repository and found this wasn't as ready as I remembered. Got around to adding versioneer setup to the base command that skips the versioneer install (vendoring) phase. Also added a test that demonstrates that it can work in python -m build's isolated build process. This required a hack to inject the current repository directory as versioneer @ file:///....

Will rebase and update the docs after #311.

@effigies effigies force-pushed the enh/pep518-mode branch 2 times, most recently from b2d96ef to 12b784e Compare August 10, 2022 12:44
@effigies
Copy link
Contributor Author

I think we might want to consider the CLI a bit before pushing this out. Right now the installation process is:

versioneer install          # Vendors versioneer then runs setup
python versioneer.py setup  # Rerun setup from vendored versioneer

I'm currently proposing that this be possible to replace with versioneer setup or python -m versioneer setup which will skip the installation step and always use the environment-installed versioneer. This double-use of setup, even though it means the same thing, might hide when someone is accidentally invoking the environment versioneer instead of the vendored versioneer, potentially leading to subtle bugs. I think instead we want to revert to versioneer install for the main command and versioneer.py setup for the vendored module, and add a --vendor/--no-vendor flag.

versioneer install              # Vendors versioneer then runs setup
versioneer install --vendor     # Same as default
versioneer install --no-vendor  # Non-vendored setup

I will push this soon, but adding a comment to explain my reasoning.

@effigies
Copy link
Contributor Author

Took a break to come back to this with fresh eyes. On the whole, I'm happy with it. Would anybody be interested in reviewing and/or test-driving? @bucknerns @yarikoptic?

@bucknerns
Copy link

I'm checking it out

@effigies
Copy link
Contributor Author

@bucknerns FWIW I currently have to do this to get python -m build to work with isolation:

[build-system]
requires = [
    "setuptools",
    "versioneer @ file:///data/projects/versioneer/",
    "wheel"
]
build-backend = "setuptools.build_meta"

Once there's a release, it shouldn't be necessary. And I think python -m build --no-isolation should work without the @.

@effigies effigies mentioned this pull request Aug 25, 2022
ns-rse added a commit to Mesnage-Org/pgfinder that referenced this pull request Aug 25, 2022
Perhaps removes the PEP517/518 dependency that python -m build pulls in and messes up versioneer and is pending fixing
with python-versioneer/python-versioneer#294
@effigies
Copy link
Contributor Author

I'm checking it out

@bucknerns Any news?

@bucknerns
Copy link

Looks good, I pushed a copy to test.pypi.org and added to a pyproject.toml and did a pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ./exampleproject of an example project to test it out.

@bucknerns
Copy link

fyi had to version lock it in the pyproject.toml but should be good on official version "versioneer==0.24.dev0"

@effigies
Copy link
Contributor Author

Awesome! Thanks for the review. I'll merge now. I can write some release notes and pushing 0.24 to PyPI today or tomorrow, but feel free to go ahead and do it yourself.

@effigies effigies merged commit 7c6b639 into python-versioneer:master Aug 30, 2022
@effigies effigies deleted the enh/pep518-mode branch August 30, 2022 17:20
ns-rse added a commit to Mesnage-Org/pgfinder that referenced this pull request Nov 14, 2022
Perhaps removes the PEP517/518 dependency that python -m build pulls in and messes up versioneer and is pending fixing
with python-versioneer/python-versioneer#294
bobturneruk pushed a commit to Mesnage-Org/pgfinder that referenced this pull request Nov 15, 2022
Perhaps removes the PEP517/518 dependency that python -m build pulls in and messes up versioneer and is pending fixing
with python-versioneer/python-versioneer#294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-vendored versioneer?

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.