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

[BUG] namespace_packages deprecation warning: TypeError: expected string or bytes-like object #3320

Closed
emlys opened this issue May 17, 2022 · 1 comment · Fixed by #3321
Closed
Labels
bug Needs Triage

Comments

@emlys
Copy link

@emlys emlys commented May 17, 2022

setuptools version

62.3.0

Python version

3.10

OS

macOS

Additional environment information

No response

Description

Calling the setup function of a package using the namespace_packages parameter raises an error rather than the expected SetuptoolsDeprecationWarning.

msg = (
"The namespace_packages parameter is deprecated, "
"consider using implicit namespaces instead (PEP 420).",
)
warnings.warn(msg, SetuptoolsDeprecationWarning)

raises a TypeError: expected string or bytes-like object on line 287 because msg is a tuple.

Expected behavior

I expect a SetuptoolsDeprecationWarning to be raised, not an error.

How to Reproduce

python -m build --wheel on a package that is using the deprecated namespace_packages option.

Output

$ python -m build --wheel
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (babel, cython, numpy==1.17.3; python_version=="3.8", numpy==1.19.3; python_version=="3.9", numpy==1.21.3; python_version=="3.10", setuptools>=45, setuptools_scm>=6.4.0, wheel)
* Getting dependencies for wheel...
Traceback (most recent call last):
  File "/Users/emily/miniconda3/envs/main/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
    main()
  File "/Users/emily/miniconda3/envs/main/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 345, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/Users/emily/miniconda3/envs/main/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
    return self._get_build_requires(
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
    self.run_setup()
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 65, in <module>
    setup(
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 109, in setup
    _setup_distribution = dist = klass(attrs)
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/dist.py", line 477, in __init__
    _Distribution.__init__(
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 293, in __init__
    self.finalize_options()
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/dist.py", line 901, in finalize_options
    ep(self)
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/dist.py", line 922, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "/private/var/folders/zh/dy02ljyd4mj5_nfm158hwcr00000gn/T/build-env-sif8cxfe/lib/python3.10/site-packages/setuptools/dist.py", line 287, in check_nsp
    warnings.warn(msg, SetuptoolsDeprecationWarning)
TypeError: expected string or bytes-like object

ERROR Backend subproccess exited when trying to invoke get_requires_for_build_wheel
@abravalheri
Copy link
Contributor

@abravalheri abravalheri commented May 17, 2022

Thank you very much, I just applied the fix. Soon the release pipeline will run and the new version will be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants