bazel-contrib / bazel-contrib/rules_python

gazelle_python.yaml can only use one pip_repository

Aberta
#1,971 3 comentários 3 reações 0 responsáveis Ver no GitHub
gazelle help wanted type: feature request
Linguagem predominante
Starlark
Estrelas
688
Forks
721
Merge médio
15h 7min
PRs com merge (30d)
76

Descrição

The `modules_mapping` rule accepts a list of wheels, but then the [manifest generator](https://github.com/bazelbuild/rules_python/blob/7a437cc94ff722d8c088ab6140b0cd940d28c4d7/gazelle/manifest/manifest.go#L150) assumes that all those modules come from a single `pip.parse` call.

Since many Python projects separate dependencies, i.e. https://pip-tools.readthedocs.io/en/stable/#workflow-for-layered-requirements
it's often the case that some users have different requirements repositories, even for the same folder.

For example, in https://github.com/alexeagle/bazel_python_repro/blob/18f4504adcdef9187f68397ea20a4f6672badcc2/app/BUILD.bazel gazelle has generated line 28 as `@pip//python_dotenv`. However that wheel came from [test.in](https://github.com/alexeagle/bazel_python_repro/blob/18f4504adcdef9187f68397ea20a4f6672badcc2/requirements/test.in#L4) installed at [pip.test](https://github.com/alexeagle/bazel_python_repro/blob/18f4504adcdef9187f68397ea20a4f6672badcc2/MODULE.bazel#L28) - so it should have generated `@pip.test//python_dotenv`.
Of course since the wheels were combined in the [modules_mapping]( https://github.com/alexeagle/bazel_python_repro/blob/18f4504adcdef9187f68397ea20a4f6672badcc2/BUILD.bazel#L31) this information is lost and the `gazelle_python.yaml` can't indicate which repo should be used for a given import (no matter what folder the gazelle_python.yaml were to appear in)

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece pela regra modules_mapping e pelo gerador de manifestos em gazelle/manifest/manifest.go, concentrando-se em como as fontes wheel são associadas aos labels gerados. Use o exemplo de requirements em camadas para rastrear as informações do repositório que foram perdidas; o trabalho estará concluído quando os imports de diferentes repositórios pip gerarem labels como @pip.test//python_dotenv em vez de sempre usarem @pip//.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
build-system
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
38/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.