Skip to content

`ValueError: invalid mode: 'U' #32

@polarathene

Description

@polarathene

It does not seem possible to build this package anymore with modern Python installs.`

pprintpp/setup.py

Lines 10 to 11 in 7ede6da

try:
long_description = open("README.rst", "U").read()

There has been a PR resolving this issue for some time now, but the maintainer @wolever presumably hasn't seen any of the notifications generated 😓

Present workaround is to use that PR as the package source instead. With UV and pyproject.toml this will do that:

[tool.uv.sources]
# Required when building from sdist unless this PR is merged and published:
# https://github.com/wolever/pprintpp/pull/31
pprintpp = { git = "https://github.com/sandrotosi/pprintpp", branch = "patch-1" }

[tool.uv]
override-dependencies = ["pprintpp"]

Alternatively one can build a projects deps via UV with this package excluded (using the bdist instead):

# Exclude this transitive dependency from sdist builds:
UV_NO_BUILD_PACKAGE='pprintpp' uv sync --no-binary --force-reinstall

Otherwise build on Python earlier than 3.11.


Output while building a project from sources:

$ uv sync --no-binary --reinstall

Resolved 102 packages in 4ms
      Built octodns-googlecloud==1.1.0                                                                                                                                                                                                                        × Failed to build `pprintpp==0.4.0`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

      [stderr]
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
        File "/root/.cache/uv/builds-v0/.tmp30rOmV/lib/python3.11/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/root/.cache/uv/builds-v0/.tmp30rOmV/lib/python3.11/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
        File "/root/.cache/uv/builds-v0/.tmp30rOmV/lib/python3.11/site-packages/setuptools/build_meta.py", line 512, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/root/.cache/uv/builds-v0/.tmp30rOmV/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
        File "<string>", line 11, in <module>
      ValueError: invalid mode: 'U'

      hint: This usually indicates a problem with the package or the build environment.
  help: `pprintpp` (v0.4.0) was included because `example` (v0.1.0) depends on `octodns-route53` (v1.0.1) which depends on `pycountry-convert` (v0.7.2) which depends on `pprintpp`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions