Skip to content

[Question] install from source without build isolation requires setuptools>=77 for PEP 639 #229

@BwL1289

Description

@BwL1289

Required prerequisites

What version of OpTree are you using?

0.16.0

System information

>>> print(sys.version, sys.platform)
3.12.7 (main, Nov 22 2024, 15:13:20) [Clang 20.0.0git ] linux

Problem description

When installing optree from sdist and --no-build-isolation and newer versions of setuptools this will result in an error.

Collecting optree==0.16.0
  Downloading optree-0.16.0.tar.gz (161 kB)
  Running command Preparing metadata (pyproject.toml)
  configuration error: `project.license` must be valid exactly by one definition (2 matches found):

      - keys:
          'file': {type: string}
        required: ['file']
      - keys:
          'text': {type: string}
        required: ['text']

  DESCRIPTION:
      `Project license <https://peps.python.org/pep-0621/#license>`_.

  GIVEN VALUE:
      "Apache-2.0"

  OFFENDING RULE: 'oneOf'

  DEFINITION:
      {
          "oneOf": [
              {
                  "properties": {
                      "file": {
                          "type": "string",
                          "$$description": [
                              "Relative path to the file (UTF-8) which contains the license for the",
                              "project."
                          ]
                      }
                  },
                  "required": [
                      "file"
                  ]
              },
              {
                  "properties": {
                      "text": {
                          "type": "string",
                          "$$description": [
                              "The license of the project whose meaning is that of the",
                              "`License field from the core metadata",
                              "<https://packaging.python.org/specifications/core-metadata/#license>`_."
                          ]
                      }
                  },
                  "required": [
                      "text"
                  ]
              }
          ]
      }
  Traceback (most recent call last):
    File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/usr/local/lib/python3.12/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.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.12/site-packages/setuptools/build_meta.py", line 377, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "/usr/local/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
      exec(code, locals())
    File "<string>", line 268, in <module>
    File "/usr/local/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 157, in setup
      dist.parse_config_files()
    File "/usr/local/lib/python3.12/site-packages/setuptools/dist.py", line 648, in parse_config_files
      pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
    File "/usr/local/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 72, in apply_configuration
      config = read_configuration(filepath, True, ignore_option_errors, dist)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 140, in read_configuration
      validate(subset, filepath)
    File "/usr/local/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 61, in validate
      raise ValueError(f"{error}\n{summary}") from None
  ValueError: invalid pyproject.toml config: `project.license`.
  configuration error: `project.license` must be valid exactly by one definition (2 matches found):

      - keys:
          'file': {type: string}
        required: ['file']
      - keys:
          'text': {type: string}
        required: ['text']

  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

Reproducible example code

pip3 install optree==0.16.0 --verbose --compile --no-deps --no-cache-dir --no-build-isolation --no-binary :all:

Traceback

Expected behavior

Installation and compilation works as expected

Additional context

In pyproject.toml change license to be one of:

[project]
license = { text = "Apache-2.0" }

# OR
license = { file = "LICENSE" }

Metadata

Metadata

Assignees

Labels

dependenciesPull requests that update a dependency filequestionFurther information is requestedupstreamSomething related to upstream projects

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions