python-stringcase icon indicating copy to clipboard operation
python-stringcase copied to clipboard

This is not installable by poetry

Open ktthross opened this issue 1 year ago • 12 comments

Note: This error originates from the build backend, and is likely not a problem with poetry but with stringcase (1.2.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "stringcase (==1.2.0)"'

ktthross avatar Mar 24 '25 17:03 ktthross

it's due to https://github.com/pypa/setuptools/issues/4910, the fix would be to update the definition of the package 😓

pquadri avatar Mar 24 '25 17:03 pquadri

Can we change the build requirements in pyproject.toml to use something other than setuptools or pin it to an older version?

I'm confused, because I don't see 'description-file' in 'metadata' (setup.cfg) in the latest main branch.

❯ pip wheel --no-cache-dir --use-pep517 "stringcase (==1.2.0)"
Looking in indexes: https://aws:****@akasa-025412125743.d.codeartifact.us-west-2.amazonaws.com/pypi/pypi-store/simple/
Collecting stringcase==1.2.0
  Downloading https://akasa-025412125743.d.codeartifact.us-west-2.amazonaws.com/pypi/pypi-store/simple/stringcase/1.2.0/stringcase-1.2.0.tar.gz (3.0 kB)
  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
  ╰─> [27 lines of output]
      Traceback (most recent call last):
        File "/src/data-platform/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
        File "/src/data-platform/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
        File "/src/data-platform/.venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-_qjy5t3z/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "/tmp/pip-build-env-_qjy5t3z/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-_qjy5t3z/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 522, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-_qjy5t3z/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in run_setup
          exec(code, locals())
        File "<string>", line 3, in <module>
        File "/tmp/pip-build-env-_qjy5t3z/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 160, in setup
          dist.parse_config_files()
        File "/src/data-platform/.venv/lib/python3.10/site-packages/_virtualenv.py", line 22, in parse_config_files
          result = old_parse_config_files(self, *args, **kwargs)
        File "/tmp/pip-build-env-_qjy5t3z/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 730, in parse_config_files
          self._parse_config_files(filenames=inifiles)
        File "/tmp/pip-build-env-_qjy5t3z/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 599, in _parse_config_files
          opt = self._enforce_underscore(opt, section)
        File "/tmp/pip-build-env-_qjy5t3z/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 629, in _enforce_underscore
          raise InvalidConfigError(
      setuptools.errors.InvalidConfigError: Invalid dash-separated key 'description-file' in 'metadata' (setup.cfg), please use the underscore name 'description_file' instead.
      [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.

dazza-codes avatar Mar 24 '25 17:03 dazza-codes

@dazza-codes i think the issue is fixed in the repo, but the fix was never pushed to PyPI 😓

pquadri avatar Mar 24 '25 17:03 pquadri

On pypi, the author is [email protected]

I wonder who, if anyone else, could publish a patched version.

dazza-codes avatar Mar 24 '25 17:03 dazza-codes

@okunishinishi - can you publish a new version to pypi?

dazza-codes avatar Mar 24 '25 17:03 dazza-codes

Conversation about state of the project is (hopefully) ongoing in this thread: https://github.com/okunishinishi/python-stringcase/issues/42#issuecomment-2748868041

In the meantime, my workaround was:

poetry run pip install wheel setuptools==77.0.3
poetry run pip install --no-use-pep517 'stringcase==1.2.0'

SanitizedMemory avatar Mar 24 '25 18:03 SanitizedMemory

https://github.com/okunishinishi/python-stringcase/pull/27/files introduced the poetry build specs and seems to have fixed the setup.cfg issue already.

dazza-codes avatar Mar 24 '25 18:03 dazza-codes

https://github.com/saboya has a potentially useful tip to constrain the poetry build system (copied here)

# Create a constraints file to limit setuptools version
RUN echo "setuptools<78" > /constraints.txt

# Set the PIP_CONSTRAINT environment variable to the constraints file
ENV PIP_CONSTRAINT=/constraints.txt

dazza-codes avatar Mar 24 '25 18:03 dazza-codes

I solved my problem by adding this before poetry install, you can possibly solve yours, too:

          poetry run pip install setuptools wheel
          poetry run pip install --no-use-pep517 "stringcase==1.2.0"

s-mostafa-a avatar Mar 24 '25 20:03 s-mostafa-a

Thanks @s-mostafa-a , this worked for me!

dsongq avatar Mar 24 '25 20:03 dsongq

This is resolved as of -> v78.0.2

Tyler-Beau avatar Mar 24 '25 20:03 Tyler-Beau

This project seems abandoned. Switch to https://github.com/chrisdoherty4/python-case-converter

barseghyanartur avatar May 27 '25 08:05 barseghyanartur