-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Use pep517/518 build system for modern build isolation #1495
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versionfile_build = pvlib/_version.py | ||
tag_prefix = v | ||
parentdir_prefix = pvlib-python- | ||
|
||
[aliases] | ||
test=pytest | ||
|
||
[flake8] | ||
max-line-length = 79 | ||
ignore = E201, E241, E226, W503, W504 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case anyone else is like me and wonders if we can move this flake8
config to pyproject.toml
and nix setup.cfg
altogether, flake8 doesn't support pyproject.toml
and it doesn't seem like it will anytime soon: https://github.com/PyCQA/flake8/issues?q=is%3Aissue+pyproject.toml
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version string for non-tagged commits using this method references the next pvlib version instead of the previous. For example this PR branch currently references 0.9.2:
master
:pvlib-0.9.1+18.g3f397ed4
- this PR:
pvlib-0.9.2.dev16+g2c4fbe3f
The number of commits since the last tag is .devN
instead of +N
. "dirty" builds are also a bit different: pvlib-0.9.2.dev16+g2c4fbe3f.d20220721
vs pvlib-0.9.1+18.g3f397ed4.dirty
.
Not sure I see either of these as a problem, just pointing it out.
About top files included in dist, I think setuptools_scm by default include files checked in VCS. About the version name, by default it generates a dev version with number as number of commit. This explains why it displays next version with dev. Then local part, after |
I think you're right, and we should adapt our MANIFEST.in accordingly: https://github.com/pypa/setuptools_scm#file-finders-hook-makes-most-of-manifestin-unnecessary It's fine by me to change the version string format, especially if the new format is what the PyPA suggests/prefers. I only brought it up in case the other maintainers care more about non-tagged version strings than I do :) |
2c4fbe3
to
5897132
Compare
I've removed include in |
@kanderso-nrel can you check building SPA C extension is still working ? Should not be a problem, setuptools build backend is still using setup.py under the hood. |
After building the
I'm not sure why Unrelated to the SPA C extension, I think we should add a bunch of excludes to the MANIFEST so that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm okay with these changes, assuming we follow up elsewhere on the MANIFEST excludes. Would definitely be good for another maintainer to take a look though.
I thought editable installs do not work with this pattern. That would destroy my workflow. No objection to the change in version string format. I'm guessing we'll want to make alpha tags when we anticipate that the next release will be a 0.x.0. (I'd like to see more pre-releases anyways.) Are the changes to MANIFEST consistent with the discussion in #580? I am a -1 on removing anything from the distribution at this time, so let's take up that discussion somewhere else. |
I think editable installs are only a problem if you ditch
Sorry, maybe my phrasing was confusing. As I understand it, this PR doesn't remove anything from the distribution. It does add things to the distribution because of the switch to I thought it would be easier to prune them back out in another PR (e.g. #1483, which is already dealing with what gets included in the dist) so that we don't ask too much of @jules-ch :) |
Seems to work. I did the following
I'm good with merging. I'd like to give @mikofski an opportunity to review too (or decline to review) since he's been fighting python packaging longer than any of us. |
@jules-ch can you resolve the merge conflicts? |
- Remove pvlib/_version.py (versioneer) - Use importlib.metadata to retrieve version from PKG-INFO - Add importlib-metadata backport for python < 3.8 - Create pyproject.toml with setuptools build backend - Update workflow to use pypa/build module to build sdist & wheel - Update remove versioneer files from .lgtm.yml & .stickler.yml - Remove include from MANIFEST.IN (already included with setuptools-scm)
I've rebased, should be good now @wholmgren |
FYI CI is failing because I'm ignoring coverage on version.py & it is reducing code coverage which is making CI fails. |
thanks @jules-ch! let's see how it goes... |
One thing that I failed to test above... make a change, then check the version without reinstalling. It used to be the case that versioneer would immediately report |
Shoud not be too difficult |
Ok, makes sense that switching from versioneer (run-time version determination) to setuptools_scm (install-time determination) would cause this issue. After some searching, it seems like people either just live with outdated version strings for editable installs or use some variant of the matplotlib approach of dynamically computing the version if the code detects that it's being imported from a git repo. I don't love it but it seems there's not a better option, or at least I haven't found one! |
Following #1486
editable installation still works with the new setuptools 63
- [ ] Closes #xxxx- [ ] Tests added- [ ] Updates entries indocs/sphinx/source/reference
for API changes.docs/sphinx/source/whatsnew
for all changes. Includes link to the GitHub Issue with:issue:`num`
or this Pull Request with:pull:`num`
. Includes contributor name and/or GitHub username (link with:ghuser:`user`
).- [ ] New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.remote-data
) and Milestone are assigned to the Pull Request and linked Issue.