Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Full pep 508 / pypa dependency specifier support in starlark #2826

Closed
2 of 2 issues completed
Closed
@rickeylev

Description

@rickeylev

This issue is to track a starlark implementation for the pypa-spec for requirements line parsing and metadata Requires-Dist parsing.

Right now, we have a partial implementation in pep508_evaluate.bzl.

Some relevant docs:

TODO

  • python_version - use the X.Y python version
  • python_full_version - use the X.Y.Z python version
  • os_name - use a value derived from @platforms//os:<name> values
  • sys_platform - use a value derived from @platforms//os:<name> values
  • platform_release - use "" for the value
  • platform_system - use a value derived from @platforms//os:<name> values
  • platform_version - uses "" for the value, missed the fact that we should default to 0
  • platform_machine - use a value derived from @platforms//cpu:<name> values
  • platform_python_implementation - Use CPython constant.
  • implementation_name - Use cpython constant.
  • Support * in version comparison (see https://peps.python.org/pep-0440/#compatible-release)

Some keys seem tedious to support

platform_release, platform_version

For pip, this is simply the host machine value. For bazel, it would mean whatever the target platform would return. Using the bazel host machine value wouldn't be correct for cross builds, but will probably have to suffice as the first impl and in the short term.

Long term, I think we'll need a --platform_{release,version} flag (or toolchain?), which points to a target that can provide the appropriate value.

Notable bits from the spec:


Variables whose value cannot be calculated on a given Python implementation should evaluate to 0 for versions, and an empty string for all other variables.

src


cc @aignas @groodt

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions