-
Notifications
You must be signed in to change notification settings - Fork 423
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
Drop dependency on Setuptools #4443
Conversation
74ec13d
to
539d0f7
Compare
Updated with latest |
f0eef48
to
b1777bd
Compare
One thing to note is that FWIW I'm in favor of this move since it's way over time to standardize on PEP440 and following. @chenghlee Have you heard anything about how compatible we are with PEP 440 nowadays? |
Open to other solutions if there is a preferred alternative |
I've looked into more of the actual failing tests, and I think we shouldn't rush this for 3.22.0. It's worth considering all the implications of the old |
Instead of relying on `setuptools` to get functionality from `pkg_resources` (which is slowly being refactored away), leverage `packaging` for the functionality used by Conda-Build.
I've backported |
@jakirkham I took the liberty to amend your PR, could you take a look if that's along the lines what you had in mind? |
Thanks Jannis! Doing a bit of vendoring to protect ourselves makes sense to me 🙂 |
Am seeing this test failure in some jobs (for example). Not sure what the expect behavior was before, but that version number doesn't look ok. It is worth noting that SymPy is on GitHub these days. So a test that was presumably for Bitbucket/Mercurial may not be as relevant (particularly since Bitbucket dropped Mercurial support). Maybe something using Heptapod would be better (if Mercurial testing is desired). ___________________________ test_sympy[with version] ___________________________
[gw0] linux -- Python 3.8.16 /usr/share/miniconda/envs/test/bin/python
Traceback (most recent call last):
File "/home/runner/work/conda-build/conda-build/src/tests/test_api_skeleton.py", line 189, in test_sympy
api.skeletonize(
File "/home/runner/work/conda-build/conda-build/src/conda_build/api.py", line 270, in skeletonize
skeleton_return = module.skeletonize(packages, output_dir=output_dir, version=version,
File "/home/runner/work/conda-build/conda-build/src/conda_build/skeletons/pypi.py", line 280, in skeletonize
versions = sorted(pypi_data["releases"].keys(), key=Version)
File "/usr/share/miniconda/envs/test/lib/python3.8/site-packages/packaging/version.py", line 197, in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '0.5.13-hg' |
Any thoughts on what we should do here? |
@jakirkham @jaimergp I've updated it to use the legacy version parser everywhere, I think that should be okay, assuming the tests pass |
Thanks Jannis! 🙏 Seeing another failure just on Unix Python 3.7 CI jobs (for example). Though not sure why it is coming up here. _________________ test_render_with_python_arg_reduces_subspace _________________
[gw0] linux -- Python 3.7.16 /usr/share/miniconda/envs/test/bin/python
Traceback (most recent call last):
File "/usr/share/miniconda/envs/test/lib/python3.7/shutil.py", line 566, in move
os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/miniconda/envs/test/conda-bld/work' -> '/usr/share/miniconda/envs/test/conda-bld/test_subspace_selection_cli_1678300329405/work'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/runner/work/conda-build/conda-build/tests/cli/test_main_render.py", line 135, in test_render_with_python_arg_reduces_subspace
main_render.execute(args)
File "/home/runner/work/conda-build/conda-build/conda_build/cli/main_render.py", line 194, in execute
variants=args.variants)
File "/home/runner/work/conda-build/conda-build/conda_build/api.py", line 41, in render
permit_unsatisfiable_variants=permit_unsatisfiable_variants)
File "/home/runner/work/conda-build/conda-build/conda_build/render.py", line 834, in render_recipe
m.config.compute_build_id(m.name(), m.version(), reset=reset_build_id)
File "/home/runner/work/conda-build/conda-build/conda_build/config.py", line 615, in compute_build_id
shutil.move(old_dir, work_dir)
File "/usr/share/miniconda/envs/test/lib/python3.7/shutil.py", line 580, in move
copy_function(src, real_dst)
File "/usr/share/miniconda/envs/test/lib/python3.7/shutil.py", line 266, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/share/miniconda/envs/test/lib/python3.7/shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/miniconda/envs/test/conda-bld/work' |
Given that 3.7 isn't maintained by conda-forge and defaults anymore, I'm ready to take the chance and remove it from the test matrix. Do you have concerns about this? |
None. Have also been dropping Python 3.7 from other projects I work on |
Thanks Jannis! 🙏 |
It looks like the new file is https://github.com/pypa/packaging/blob/main/src/packaging/version.py with underscores in front of each function. (It would be cleaner to import a non-underscored name from that file) |
Maybe this should be raised as a new issue? AIUI the public APIs we looked at weren't sufficient for reproducing the behavior we needed. Do you know a better public API to replace these with? |
I'm surprised that |
IIUC |
Instead of relying on
setuptools
to get functionality frompkg_resources
(which is slowly being refactored away), leveragepackaging
for the functionality used by Conda-Build.Edit: Looked to see whether Conda needed a similar change. Appears it only indirectly uses
pkg_resources
via a vendored copy oftqdm
. Updating the vendored copy oftqdm
would fix that issue ( conda/conda#11432 ).Fixes #4733