Skip to content

Towards PEP621#3528

Merged
IAlibay merged 22 commits intodevelopfrom
issue-3526
Dec 15, 2022
Merged

Towards PEP621#3528
IAlibay merged 22 commits intodevelopfrom
issue-3526

Conversation

@IAlibay
Copy link
Member

@IAlibay IAlibay commented Feb 13, 2022

Fixes #3526

Changes made in this Pull Request:

  • Adds PEP621 items to pyproject.toml
  • Updated LICENSE in package to reflect additions to the main repo LICENSE
  • Removed pypi-description.rst (the 2.0.0 release was fine without it, so I'm assuming whatever made it necessary is no longer needed? - we'll see on release)
  • Updated setup.py to reflect that we're actually GPL v2+ (using poetry's naming convention here)

TODO:

  • Add pyproject.toml for testsuite

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

{name = 'MDAnalysis Core Developers', email = 'mdanalysis@numfocus.org'}
]
requires-python = ">=3.7"
dependencies = [
Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't too sure how to deal with the optional deps here.

Tests -> should I just add MDAnalysisTests as the dep? How do you dynamically set the version number in pyproject.toml?
Extra deps ->

  • Not sure what the keyword should be here (it's unclear if you can just say "extra").
  • How do we deal with conda only deps? Does it matter?

Copy link
Member

Choose a reason for hiding this comment

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

conda only deps seems like a bad idea in general, not sure you can do much about them here..

As for dependencies, I think it should just be the mandatory runtime dependencies, and then [project.optional-dependencies] can contain sections for test, doc, and dev tools (I'd suggest just looking at i.e., the SciPy example pyproject.toml and adapting for our purposes, if you aren't already doing that).

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good, for now let's just skip [project.optional-dependencies] since most are conda based, I'll raise an issue on merge of this PR with all the things that can be added at a later date to augment the pyproject.toml.

@codecov
Copy link

codecov bot commented Feb 13, 2022

Codecov Report

Base: 94.41% // Head: 94.44% // Increases project coverage by +0.03% 🎉

Coverage data is based on head (aa643aa) compared to base (1f48778).
Patch has no changes to coverable lines.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3528      +/-   ##
===========================================
+ Coverage    94.41%   94.44%   +0.03%     
===========================================
  Files          195      195              
  Lines        25423    25423              
  Branches      3526     3526              
===========================================
+ Hits         24003    24012       +9     
+ Misses        1376     1367       -9     
  Partials        44       44              
Impacted Files Coverage Δ
package/MDAnalysis/due.py 76.66% <0.00%> (+29.99%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pep8speaks
Copy link

pep8speaks commented Feb 13, 2022

Hello @IAlibay! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 573:80: E501 line too long (85 > 79 characters)

Line 98:80: E501 line too long (85 > 79 characters)

Comment last updated at 2022-03-27 23:35:25 UTC

]
requires-python = ">=3.7"
dependencies = [
'MDAnalysis==2.1.0-dev0',
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not super into the idea of having yet-another point where we need to update the version numbers. Is there a way around this?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, it is indeed pretty ugly from a design standpoint now to have separate main and test packages.

Is there as much of a rush to add a pyproject.toml for the test suite?

It would probably be nice to have the version dynamically set to match the same version of the main package. Not sure how to do that.

Copy link
Member

Choose a reason for hiding this comment

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

A bit out of scope, but what other major Python projects package their test suite entirely separately from the main project? That might be a good reference point for "how should we handle this?"

If we were to start from scratch, I'd almost certainly vote against having separate packages, and instead use one of the popular "lazy loading/lazy download" packages to pull in test assets if there's an internet connection, otherwise skipping and doing a minimal suite only.

Copy link
Member

Choose a reason for hiding this comment

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

For 3.0, getting rid of MDAnalysisTests would be a good aim. One thing to solve would be to keep the correct versions of test files in sync with the tests. Maybe download from the correct tag or commit in the repo? That might get a bit more tricky when you want to add/change test files in a branch... anyway, that would be something to think about and to learn from other packages that presumably already do this.

Which lazy-loading packages do you have in mind?

Do you have an example of a package that pulls in test files when needed?

@IAlibay IAlibay requested a review from tylerjereddy February 13, 2022 04:27
@IAlibay
Copy link
Member Author

IAlibay commented Feb 13, 2022

@tylerjereddy a lot of this is based on my likely poor understanding of PEP 621 and 631. Any advice / corrections would be greatly appreciated.


[project]
name = "MDAnalysis"
version = "2.1.0-dev0"
Copy link
Member

Choose a reason for hiding this comment

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

Can just do dynamic = ['version'] I think, to avoid having to update this.

{name = 'MDAnalysis Core Developers', email = 'mdanalysis@numfocus.org'}
]
requires-python = ">=3.7"
dependencies = [
Copy link
Member

Choose a reason for hiding this comment

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

conda only deps seems like a bad idea in general, not sure you can do much about them here..

As for dependencies, I think it should just be the mandatory runtime dependencies, and then [project.optional-dependencies] can contain sections for test, doc, and dev tools (I'd suggest just looking at i.e., the SciPy example pyproject.toml and adapting for our purposes, if you aren't already doing that).


[project]
name = "MDAnalysisTests"
version = "2.1.0-dev0"
Copy link
Member

Choose a reason for hiding this comment

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

I think we can avoid updating this by using dynamic = ['version', 'description'], or similar, based on me cheating and looking at other projects.

]
requires-python = ">=3.7"
dependencies = [
'MDAnalysis==2.1.0-dev0',
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, it is indeed pretty ugly from a design standpoint now to have separate main and test packages.

Is there as much of a rush to add a pyproject.toml for the test suite?

It would probably be nice to have the version dynamically set to match the same version of the main package. Not sure how to do that.

]
requires-python = ">=3.7"
dependencies = [
'MDAnalysis==2.1.0-dev0',
Copy link
Member

Choose a reason for hiding this comment

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

A bit out of scope, but what other major Python projects package their test suite entirely separately from the main project? That might be a good reference point for "how should we handle this?"

If we were to start from scratch, I'd almost certainly vote against having separate packages, and instead use one of the popular "lazy loading/lazy download" packages to pull in test assets if there's an internet connection, otherwise skipping and doing a minimal suite only.

@IAlibay IAlibay mentioned this pull request Feb 22, 2022
5 tasks
@IAlibay
Copy link
Member Author

IAlibay commented Mar 27, 2022

So long story short, it seems that the latest release of setuptools is essentially enforcing a ton of things related to pyproject.toml which it didn't use to.

To speed things up I'm ditching the addition of a pyproject.toml for testsuite for now. Let's try to get the main package one up to scratch first, then we address testsuite later.


[project]
name = "MDAnalysis"
dynamic = ['version', 'readme']
Copy link
Member Author

@IAlibay IAlibay Mar 27, 2022

Choose a reason for hiding this comment

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

@tylerjereddy can I pick your brains on this?

Essentially adding a direct readme entry in the pyproject.toml is complicated because it accesses the README.rst which exists outside of the package directory. So I'm thinking we can possibly just leave it as dynamic since setup.py has set logic for gathering long-description, does that make sense to do?

edit: adding to dynamic still caused issues... not sure what the best solution here is at this point.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

The license update to "GPL v2 or later" is perfect. ✅

@IAlibay IAlibay self-assigned this Nov 4, 2022
@IAlibay IAlibay added this to the 2.4.0 milestone Nov 4, 2022
@IAlibay
Copy link
Member Author

IAlibay commented Nov 4, 2022

I'm adding this to the 2.4.0 milestone, with the way that things are going we should attempt to be fully pep621 compliant by end of year.

TODOs here are mostly updating things.

"scikit-learn",
"tidynamics>=1.0.0",
]
doc = [
Copy link
Member Author

Choose a reason for hiding this comment

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

missing test entry because passing in a dynamic version for MDAnalysisTests doesn't really work...

@IAlibay
Copy link
Member Author

IAlibay commented Dec 7, 2022

@MDAnalysis/coredevs this is good to go as needed for 2.4.0, I recommend using scipy's pyproject.toml as a template to check against during review: https://github.com/scipy/scipy/blob/main/pyproject.toml

@IAlibay
Copy link
Member Author

IAlibay commented Dec 15, 2022

@MDAnalysis/coredevs can I get a review here please? This is stalling the 2.4.0 release

@IAlibay IAlibay merged commit b3b907b into develop Dec 15, 2022
@IAlibay IAlibay deleted the issue-3526 branch December 15, 2022 18:23
@IAlibay
Copy link
Member Author

IAlibay commented Dec 15, 2022

Ta, two PRs to go.

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.

BLD: PEP518/pyproject.toml todo items

6 participants