Skip to content

Remove build-time dependency on six, add pyproject.toml file #69

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

Open
wants to merge 2 commits into
base: mainline
Choose a base branch
from

Conversation

ichard26
Copy link

@ichard26 ichard26 commented May 12, 2025

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring
  • Other (please describe): packaging configuration updates

What Changes Were Made

Hi, I'm Richard! I'm part of the pip core team.

Starting with pip 25.1, we've deprecated the legacy setup.py bdist_wheel based mechanism for building projects. Once the legacy mechanism is removed, pip will exclusively use the modern interface (PEP 517 mode) for installers (e.g., pip) to ask a build backend (e.g., setuptools) to build the project into a wheel (which pip knows how to install).

For more information, please read the deprecation issue: pypa/pip#6334.

While most projects should NOT be impacted as the modern mechanism is largely backwards compatible, your project has been identified as one which will fail to install from source when PEP 517 mode is enabled. Most end-users will NOT be affected as the vast majority of installs are fulfilled using pre-built wheels. However, some users (and especially repackagers) prefer to build+install their dependencies from source.

The failure is caused by build isolation which is enabled in PEP 517 mode. Build isolation means that pip will create a temporary Python environment to build the project in, whereas with the legacy behaviour the build occurs within the Python environment where pip is installed.

Your project's setup.py file relies on six being pre-installed. If six is not installed, pip will not be able to build nor install your project.

Example failure

$ pip install . --use-pep517
Processing /home/ichard26/dev/misc/pep518/smartsheet-python-sdk
  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
  ╰─> [31 lines of output]
      <string>:2: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated.
      !!
      
              ********************************************************************************
              Please remove any references to `setuptools.command.test` in all supported versions of the affected package.
      
              This deprecation is overdue, please update your project and remove deprecated
              calls to avoid build errors in the future.
              ********************************************************************************
      
      !!
      Traceback (most recent call last):
        File "/home/ichard26/.local/share/vem/envs/pep518-20250511-214044/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
        File "/home/ichard26/.local/share/vem/envs/pep518-20250511-214044/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/ichard26/.local/share/vem/envs/pep518-20250511-214044/lib/python3.12/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-ram/pip-build-env-lo5hhtyt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp-ram/pip-build-env-lo5hhtyt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
        File "/tmp-ram/pip-build-env-lo5hhtyt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 512, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp-ram/pip-build-env-lo5hhtyt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
        File "<string>", line 4, in <module>
      ModuleNotFoundError: No module named 'six'
      [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.

I took a look at your setup.py and it looks to me that six is in fact not required, thus I've removed it from setup.py entirely. I've also added a pyproject.toml file in which setuptools is declared as your project's build system. This informs installers which packages are needed in order to build the project. Its presence will also cause pip to default to PEP 517 mode for your project, which will help to ensure your project will continue to install correctly with modern pip (and alternative installers like uv pip).

If you have any questions, I'd be happy to answer them! It doesn't matter if they're about the pip deprecation specifically or modern Python packaging in general. Thank you!

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

Successfully merging this pull request may close these issues.

1 participant