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

Consider updating to htmlmin2 for Python 3.13 compatibility #269

Open
gianluca-nitti opened this issue Oct 8, 2024 · 1 comment
Open

Comments

@gianluca-nitti
Copy link

pip install json-schema-for-humans currently fails on Python 3.13 because the htmlmin dependency uses the removed cgi module:

$ docker run -it --rm python:alpine /bin/sh
/ # pip install json-schema-for-humans
Collecting json-schema-for-humans
  Downloading json_schema_for_humans-1.0.2-py3-none-any.whl.metadata (11 kB)
Collecting Jinja2>3 (from json-schema-for-humans)
  Downloading jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting MarkupSafe<3.0,>=2.0 (from json-schema-for-humans)
  Downloading MarkupSafe-2.1.5.tar.gz (19 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting PyYAML<7,>=5.4.1 (from json-schema-for-humans)
  Downloading PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl.metadata (2.1 kB)
Collecting Pygments<3.0.0,>=2.10.0 (from json-schema-for-humans)
  Downloading pygments-2.18.0-py3-none-any.whl.metadata (2.5 kB)
Collecting click<9.0.0,>=8.0.1 (from json-schema-for-humans)
  Downloading click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting dataclasses-json<0.6.0,>=0.5.6 (from json-schema-for-humans)
  Downloading dataclasses_json-0.5.9-py3-none-any.whl.metadata (22 kB)
Collecting htmlmin<0.2.0,>=0.1.12 (from json-schema-for-humans)
  Downloading htmlmin-0.1.12.tar.gz (19 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 "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
          ~~~~^^
        File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib/python3.13/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-5k18y7tq/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-5k18y7tq/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/tmp/pip-build-env-5k18y7tq/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 503, in run_setup
          super().run_setup(setup_script=setup_script)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-5k18y7tq/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 4, in <module>
        File "/tmp/pip-install-m847zy3q/htmlmin_7c64c67dc11b44eb9ccf071510f24217/htmlmin/__init__.py", line 28, in <module>
          from .main import minify, Minifier
        File "/tmp/pip-install-m847zy3q/htmlmin_7c64c67dc11b44eb9ccf071510f24217/htmlmin/main.py", line 28, in <module>
          import cgi
      ModuleNotFoundError: No module named 'cgi'
      [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 htmlmin project however seems inactive.

An alternative could be the htmlmin2 fork which installs fine on 3.13.

@leoxlin
Copy link

leoxlin commented Oct 10, 2024

+1 On this. We are also running into failures in our pipeline due to the 3.13 removal of cgi. htmlmin2 is the active fork for htmlmin

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

No branches or pull requests

2 participants