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

Compilation fails, but only if setuptools-git-versioning is installed #858

Closed
2 tasks done
bassmadrigal opened this issue Jan 10, 2025 · 8 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@bassmadrigal
Copy link

Things to check first

  • I have searched the existing issues and didn't find my bug already reported there

  • I have checked that my bug is still present in the latest release

AnyIO version

4.8.0

Python version

3.9.21

What happened?

I recently took over maintenance of the anyio package for SlackBuilds.org (official 3rd-party software repo for Slackware Linux). In attempting to update it to the latest version, I found that it wouldn't compile on my main system. So I checked it in a clean system (only stock packages and the required dependencies for anyio) and it worked fine.

The error came from setuptools_git-versioning.py, so I tried installing that into the clean environment I just built anyio in, and it failed again. I also tried installing setuptools-git-versioning via pip, just in case it was a packaging issue from that maintainer, but it still broke.

Error from the build command python3 -m build --no-isolation is:

anyio-4.8.0/tests/test_typedattr.py
* Getting build dependencies for sdist...
Traceback (most recent call last):
  File "/usr/lib64/python3.9/site-packages/setuptools_git_versioning.py", line 179, in _read_toml
    import tomllib
ModuleNotFoundError: No module named 'tomllib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.9/site-packages/toml/decoder.py", line 511, in loads
    ret = decoder.load_line(line, currentlevel, multikey,
  File "/usr/lib64/python3.9/site-packages/toml/decoder.py", line 778, in load_line
    value, vtype = self.load_value(pair[1], strictly_valid)
  File "/usr/lib64/python3.9/site-packages/toml/decoder.py", line 912, in load_value
    v = float(v)
ValueError: could not convert string to float: "0.21; platformpythonimplementation == 'CPython' \\"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.9/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
    main()
  File "/usr/lib64/python3.9/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
  File "/usr/lib64/python3.9/site-packages/pyproject_hooks/_in_process/_in_process.py", line 317, in get_requires_for_build_sdist
    return hook(config_settings)
  File "/opt/python3.9/site-packages/setuptools/build_meta.py", line 337, in get_requires_for_build_sdist
    return self._get_build_requires(config_settings, requirements=[])
  File "/opt/python3.9/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
    self.run_setup()
  File "/opt/python3.9/site-packages/setuptools/build_meta.py", line 320, in run_setup
    exec(code, locals())
  File "<string>", line 1, in <module>
  File "/opt/python3.9/site-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
  File "/opt/python3.9/site-packages/setuptools/_distutils/core.py", line 145, in setup
    _setup_distribution = dist = klass(attrs)
  File "/opt/python3.9/site-packages/setuptools/dist.py", line 319, in __init__
    _Distribution.__init__(self, dist_attrs)
  File "/opt/python3.9/site-packages/setuptools/_distutils/dist.py", line 279, in __init__
    self.finalize_options()
  File "/opt/python3.9/site-packages/setuptools/dist.py", line 677, in finalize_options
    ep(self)
  File "/usr/lib64/python3.9/site-packages/setuptools_git_versioning.py", line 233, in infer_version
    toml_config = _read_toml(root=root)
  File "/usr/lib64/python3.9/site-packages/setuptools_git_versioning.py", line 186, in _read_toml
    parsed_file = toml.load(file_path)
  File "/usr/lib64/python3.9/site-packages/toml/decoder.py", line 134, in load
    return loads(ffile.read(), _dict, decoder)
  File "/usr/lib64/python3.9/site-packages/toml/decoder.py", line 514, in loads
    raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: could not convert string to float: "0.21; platformpythonimplementation == 'CPython' \\" (line 55 column 1 char 1654)

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist

How can we reproduce the bug?

Install all required dependencies to build anyio. On a full Slackware 15.0 (the latest stable) install that would include the following packages from SlackBuilds.org (SBo):

  • python3-flit_core
  • python3-installer
  • python3-wheel
  • python3-pyproject-hooks
  • python3-build
  • python3-packaging-opt
  • python3-setuptools-opt
  • python-zipp
  • python-importlib_metadata
  • python3-typing-extensions
  • python3-mdurl
  • python3-markdown-it-py
  • python3-poetry-core
  • python3-rich
  • python3-setuptools-scm-opt
  • python3-sniffio
  • python3-flit_scm
  • python3-exceptiongroup

Then install python3-setuptools-git-versioning from SBo (or setuptools-git-versioning from pip) and try to compile the module using python3 -m build --no-isolation and it fails every time with the above error.

@bassmadrigal bassmadrigal added the bug Something isn't working label Jan 10, 2025
@graingert
Copy link
Collaborator

Looks like an upstream issue https://github.com/dolfinus/setuptools-git-versioning/blob/master/setuptools_git_versioning.py#L184 this should use tomli not toml

toml was never updated to support the new syntax that setuptools and pip now support

@graingert
Copy link
Collaborator

Should work if you apply this patch dolfinus/setuptools-git-versioning#108 @bassmadrigal

@dolfinus
Copy link

Just released setuptools-git-versioning==2.1.0

@agronholm
Copy link
Owner

On a tangential note, what do you need python3-wheel here for?

@bassmadrigal
Copy link
Author

Should work if you apply this patch dolfinus/setuptools-git-versioning#108 @bassmadrigal

Just released setuptools-git-versioning==2.1.0

Thanks to both of you for the quick fix!

On a tangential note, what do you need python3-wheel here for?

SlackBuilds.org (SBo) builds all modules from source. The version of setuptools in Slackware 15.0 is too old for some of the modules, so a newer version is built and installed into /opt/. That version of setuptools requires python3-wheel. SBo does not differentiate between build-time and run-time dependencies.

I imagine some of the other dependencies requires wheel as well, but it's only documented on a package if none of the other dependencies already requires it (SBo does not list dependencies of dependencies).

@agronholm
Copy link
Owner

Should work if you apply this patch dolfinus/setuptools-git-versioning#108 @bassmadrigal

Just released setuptools-git-versioning==2.1.0

Thanks to both of you for the quick fix!

On a tangential note, what do you need python3-wheel here for?

SlackBuilds.org (SBo) builds all modules from source. The version of setuptools in Slackware 15.0 is too old for some of the modules, so a newer version is built and installed into /opt/. That version of setuptools requires python3-wheel. SBo does not differentiate between build-time and run-time dependencies.

I imagine some of the other dependencies requires wheel as well, but it's only documented on a package if none of the other dependencies already requires it (SBo does not list dependencies of dependencies).

Sounds like even that version of setuptools is old enough to not yet have shed its requirement of wheel to build wheels (which it did in v70.1.0)?

Regardless, it sounds like this is (was) not an AnyIO problem so I'll close it.

@agronholm agronholm closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2025
@bassmadrigal
Copy link
Author

Should work if you apply this patch dolfinus/setuptools-git-versioning#108 @bassmadrigal

Just released setuptools-git-versioning==2.1.0

Thanks to both of you for the quick fix!

On a tangential note, what do you need python3-wheel here for?

SlackBuilds.org (SBo) builds all modules from source. The version of setuptools in Slackware 15.0 is too old for some of the modules, so a newer version is built and installed into /opt/. That version of setuptools requires python3-wheel. SBo does not differentiate between build-time and run-time dependencies.
I imagine some of the other dependencies requires wheel as well, but it's only documented on a package if none of the other dependencies already requires it (SBo does not list dependencies of dependencies).

Sounds like even that version of setuptools is old enough to not yet have shed its requirement of wheel to build wheels (which it did in v70.1.0)?

I just looked and it is new enough (v75.6.0) and tried building without wheel and it worked. I'll let the maintainer of that package know they no longer need that dependency listed.

Regardless, it sounds like this is (was) not an AnyIO problem so I'll close it.

Thanks!

@agronholm
Copy link
Owner

I just looked and it is new enough (v75.6.0) and tried building without wheel and it worked. I'll let the maintainer of that package know they no longer need that dependency listed.

Thanks! Appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants