Skip to content
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

Support packaging>=22.0 (python build dependency) #59

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

kalekundert
Copy link
Contributor

Currently, attempting to install the python bindings fails with the following error message:

$ pip install overlap
Collecting overlap
  Using cached overlap-0.1.0.tar.gz (3.8 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      Traceback (most recent call last):
        File "/home/kale/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/kale/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/kale/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-d6cjnelc/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-d6cjnelc/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-d6cjnelc/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 2, in <module>
      ImportError: cannot import name 'LegacyVersion' from 'packaging.version' (/tmp/pip-build-env-d6cjnelc/overlay/lib/python3.10/site-packages/packaging/version.py)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

The error is due to the fact that setup.py imports packaging.version.LegacyVersion, which was removed in packaging=22.0. Here's the relevant changelog entry, and here's the PR where this was discussed.

This PR simply replaces packaging.version.LegacyVersion with packaging.version.Version. The former was only being used to compare if one version number is less than another, and the latter is capable of making that same comparison. My understanding is that the only difference between the two classes is that the legacy one doesn't complain if it gets a version number that it doesn't understand (possibly leading to bugs—hence the removal), but in this case both version numbers have normal formats.

@codecov
Copy link

codecov bot commented Jun 15, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (e84c942) 93.88% compared to head (41e0c16) 93.88%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #59   +/-   ##
=======================================
  Coverage   93.88%   93.88%           
=======================================
  Files           1        1           
  Lines         932      932           
  Branches      156      156           
=======================================
  Hits          875      875           
  Misses         10       10           
  Partials       47       47           

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

Copy link
Owner

@severinstrobl severinstrobl left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this issue and also for providing such detailed background information, I really appreciate it! I'll bump the versions of some of the third-party dependencies to fix other issues when building in recent environments and then create a new release including your change.

@severinstrobl severinstrobl merged commit f0fa9cb into severinstrobl:master Jun 15, 2023
@kalekundert kalekundert deleted the fix-legacy-version branch June 15, 2023 13:24
@kalekundert
Copy link
Contributor Author

No problem, thanks for publishing this package! I was trying to do these overlap calculations myself before I realized how hard the problem was. Definitely glad there's a library I can use.

@severinstrobl
Copy link
Owner

Glad you find the package useful, I was also rather surprised by the complexity of the task.
A new version of the package is available, depending on your system you might be able to use one of the wheels directly, otherwise building on your system should now work as expected.

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.

2 participants