Skip to content

all: migrate to Gazelle's import_alias naming convention#2629

Merged
jayconrod merged 5 commits intobazel-contrib:masterfrom
jayconrod:gazelle
Aug 27, 2020
Merged

all: migrate to Gazelle's import_alias naming convention#2629
jayconrod merged 5 commits intobazel-contrib:masterfrom
jayconrod:gazelle

Conversation

@jayconrod
Copy link
Copy Markdown
Collaborator

Fixes #2616

@jayconrod jayconrod merged commit ac0a5a8 into bazel-contrib:master Aug 27, 2020
@jayconrod jayconrod deleted the gazelle branch August 27, 2020 19:52
yushan26 pushed a commit to yushan26/rules_go that referenced this pull request Jun 16, 2025
…ontrib#2692)

This implements the PEP508 compliant marker evaluation in starlark and
removes the need for the Python interpreter when evaluating requirements
files passed to `pip.parse`. This makes the evaluation faster and allows
us to fix a few known issues (bazel-contrib#2690).

In the future the intent is to move the `METADATA` parsing to pure
starlark so that the `RequiresDist` could be parsed in starlark at the
macro evaluation or analysis phases. This should make it possible to
more easily solve the design problem that more and more things need to
be passed to `whl_library` as args to have a robust dependency parsing:
* bazel-contrib#2319 needs the full Python version to have correct cross-platform
compatible `METADATA` parsing and passing it to `Python` and back makes
  it difficult/annoying to implement.
* Parsing the `METADATA` file requires the precise list of target
  platform or the list of available packages in the `requirements.txt`.
  This means that without it we cannot trim the dependency tree in the
  `whl_library`. Doing this at macro loading phase allows us to depend
  on `.bzl` files in the `hub_repository` and more effectively pass
  information.

I can remotely see that this could become useful in `py_wheel` or an
building
wheels from sdists as the environment markers may be present in various
source
metadata as well. What is more `uv.lock` file has the env markers as
part of
the lock file information, so this might be useful there.

Work towards bazel-contrib#2423
Work towards bazel-contrib#260
Split from bazel-contrib#2629
yushan26 pushed a commit to yushan26/rules_go that referenced this pull request Jun 16, 2025
These are just bugfixes to already merged code:
* Fix nested bracket parsing in PEP508 marker parser.
* Fix the sys_platform constants, which I noticed in bazel-contrib#2629 but they got
  also pointed out in bazel-contrib#2766.
* Port some of python tests for requirement parsing and improve the
  implementation. Those tests will be removed in bazel-contrib#2629.
* Move the platform related code to a separate file.
* Rename `pep508_req.bzl` to `pep508_requirement.bzl` to follow the
  convention.


All of the bug fixes have added tests.

Work towards bazel-contrib#2423.
yushan26 pushed a commit to yushan26/rules_go that referenced this pull request Jun 16, 2025
…ontrib#2629)

This PR starts using the newly introduced (bazel-contrib#2692) PEP508 compliant
requirement marker parser in starlark and moves the dependency
generation from the Python language (`whl_installer`) to the Starlark
in the `whl_library` repository rule.

This PR is (almost) a pure refactor where no bugs are fixed, but this is
foundational work that also adds notes on how things will be moved
to macros (i.e. analysis phase) so that we can fix a few long standing
bugs and prepare for stabilizing the `experimental_index_url` (bazel-contrib#260).

Refactor:
* I have migrated all of the unit tests from Python to starlark for deps
  generation from METADATA `Requires-Dist` fields.
* Read the `METADATA` file itself in Starlark.

Work towards bazel-contrib#260, bazel-contrib#2319, bazel-contrib#2241
Fixes bazel-contrib#2423
yushan26 pushed a commit to yushan26/rules_go that referenced this pull request Jun 16, 2025
…#2831)

This just adds the code back at the original state before the following
PRs have been made to remove them: bazel-contrib#2629, bazel-contrib#2781. This has not been
hooked up yet in `evaluate_markers` and `whl_library` yet and I'll need
extra PRs to do that.

No CHANGELOG entries for now, will be done once the integration is back.

Work towards bazel-contrib#2830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to Gazelle's import_alias convention for rules_go libraries and all dependencies

2 participants