-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MAINT: Update dependency specifiers #13611
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
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
29341d3
mne[bot]: Update dependency specifiers
mne-bot 936d04b
WIP: Should fail [skip azp] [skip circle]
larsoner b300f40
FIX: More [skip azp] [skip circle]
larsoner e167eeb
FIX: Better [skip azp] [skip circle]
larsoner 1ea4168
FIX: Maybe [skip azp] [skip circle]
larsoner 8e210a6
FIX: Versions [skip azp] [skip circle]
larsoner 608b4c1
FIX: More [skip azp] [skip circle]
larsoner 714caba
FIX: Working?
larsoner 751d740
FIX: Restore
larsoner 18880ab
FIX: Skip
larsoner 420195b
Merge remote-tracking branch 'upstream/main' into spec_zero
larsoner 8f66284
FIX: Better
larsoner 3596cb3
FIX: Better
larsoner 1bdaa8f
FIX: Remove label
larsoner a3e0ffd
FIX: Whoops
larsoner dd4aaf2
FIX: Why
larsoner 842c29b
FIX: Test
larsoner 2df3b52
Merge remote-tracking branch 'upstream/main' into spec_zero
larsoner 371a88b
TST: Ping
larsoner 2b64d9e
FIX: Versions
larsoner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Updated minimum for: | ||
|
|
||
| - Core dependency ``scipy >= 1.12`` | ||
| - Optional dependency ``pandas >= 2.2`` | ||
| - Optional dependency ``pyobjc-framework-Cocoa >= 5.2.0; platform_system == "Darwin"`` | ||
| - Optional dependency ``scikit-learn >= 1.4`` | ||
|
|
||
| Changed implemented via CI action created by `Thomas Binns`_. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| adopted. | ||
|
|
||
| MNE-Python's policy differs from SPEC0 in the following ways: | ||
|
|
||
| - Python versions are supported for at least 3 years after release, but possibly longer | ||
| at the discretion of the MNE-Python maintainers based on, e.g., maintainability, | ||
| features. | ||
|
|
@@ -23,6 +24,7 @@ | |
| https://github.com/mne-tools/mne-python/pull/13451#discussion_r2445337934 | ||
|
|
||
| For example, in October 2025: | ||
|
|
||
| - The latest version of NumPy available 2 years prior was 1.26.1 (released October | ||
| 2023), making the latest minor release 1.26, which would be pinned. Support for 1.26 | ||
| would be dropped in June 2026 in favour of 2.0, which was released in June 2024. | ||
|
|
@@ -39,6 +41,8 @@ | |
| import collections | ||
| import datetime | ||
| import re | ||
| from copy import deepcopy | ||
| from pathlib import Path | ||
|
|
||
| import requests | ||
| from packaging.requirements import Requirement | ||
|
|
@@ -60,6 +64,8 @@ | |
| SUPPORT_TIME = datetime.timedelta(days=365 * 2) | ||
| CURRENT_DATE = datetime.datetime.now() | ||
|
|
||
| project_root = Path(__file__).parent.parent.parent | ||
|
|
||
|
|
||
| def get_release_and_drop_dates(package): | ||
| """Get release and drop dates for a given package from pypi.org.""" | ||
|
|
@@ -70,7 +76,7 @@ def get_release_and_drop_dates(package): | |
| headers={"Accept": "application/vnd.pypi.simple.v1+json"}, | ||
| timeout=10, | ||
| ).json() | ||
| print("OK") | ||
| print("OK", flush=True) | ||
| file_date = collections.defaultdict(list) | ||
| for f in response["files"]: | ||
| if f["filename"].endswith(".tar.gz") or f["filename"].endswith(".zip"): | ||
|
|
@@ -99,7 +105,7 @@ def get_release_and_drop_dates(package): | |
|
|
||
|
|
||
| def update_specifiers(dependencies, releases): | ||
| """Update dependency version specifiers.""" | ||
| """Update dependency version specifiers inplace.""" | ||
| for idx, dep in enumerate(dependencies): | ||
| req = Requirement(dep) | ||
| pkg_name = req.name | ||
|
|
@@ -153,7 +159,6 @@ def update_specifiers(dependencies, releases): | |
| dependencies._value[idx], min_ver_release, next_ver, next_ver_release | ||
| ) | ||
| dependencies[idx] = _prettify_requirement(req) | ||
| return dependencies | ||
|
|
||
|
|
||
| def _as_minor_version(ver): | ||
|
|
@@ -239,19 +244,47 @@ def _find_specifier_order(specifiers): | |
| } | ||
|
|
||
| # Get dependencies from pyproject.toml | ||
| pyproject = TOMLFile("pyproject.toml") | ||
| pyproject = TOMLFile(project_root / "pyproject.toml") | ||
| pyproject_data = pyproject.read() | ||
| project_info = pyproject_data.get("project") | ||
| project_info = pyproject_data["project"] | ||
| core_dependencies = project_info["dependencies"] | ||
| opt_dependencies = project_info.get("optional-dependencies", {}) | ||
| opt_dependencies = project_info["optional-dependencies"] | ||
|
|
||
| # Update version specifiers | ||
| core_dependencies = update_specifiers(core_dependencies, package_releases) | ||
| changed = [] | ||
| old_deps = deepcopy(core_dependencies) | ||
| update_specifiers(core_dependencies, package_releases) | ||
| changed.extend( | ||
| [ | ||
| f"Core dependency ``{new}``" | ||
| for new, old in zip(core_dependencies, old_deps) | ||
| if new != old | ||
| ] | ||
| ) | ||
| for key in opt_dependencies: | ||
| opt_dependencies[key] = update_specifiers(opt_dependencies[key], package_releases) | ||
| pyproject_data["project"]["dependencies"] = core_dependencies | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tsbinns the old code both updated inplace and set vars, which is unnecessary (and led to some confusion where I assumed things were not updated inplace because the vars were set). I've changed it just to operate inplace where possible. |
||
| if opt_dependencies: | ||
| pyproject_data["project"]["optional-dependencies"] = opt_dependencies | ||
| old_deps = deepcopy(opt_dependencies[key]) | ||
| update_specifiers(opt_dependencies[key], package_releases) | ||
| changed.extend( | ||
| [ | ||
| f"Optional dependency ``{new}``" | ||
| for new, old in zip(opt_dependencies[key], old_deps) | ||
| if new != old | ||
| ] | ||
| ) | ||
|
|
||
| # Need to write a changelog entry if versions were updated | ||
| if changed: | ||
| changelog_text = "Updated minimum for:\n\n" | ||
| changelog_text += "\n".join(f"- {change}" for change in changed) | ||
| print(changelog_text, flush=True) | ||
| # no reason to print this but it should go in the changelog | ||
| changelog_text += ( | ||
| "\n\nChanged implemented via CI action created by `Thomas Binns`_.\n" | ||
| ) | ||
| changelog_path = project_root / "doc" / "changes" / "dev" / "dependency.rst" | ||
| changelog_path.write_text(changelog_text, encoding="utf-8") | ||
| else: | ||
| print("No dependency versions needed updating.", flush=True) | ||
|
|
||
| # Save updated pyproject.toml (replace ugly \" with ' first) | ||
| pyproject_data = parse(pyproject_data.as_string().replace('\\"', "'")) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.