Clarifications needed re packaging flow from the perspective of a build backend
Mantenedores costumam responder em até 5 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 25/100
- Tipo de issue
- Documentação
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Stack de tecnologia
- python
- Domínio
- documentation
Direção de pesquisa
Comece revisando as referências da issue a pyproject.toml, PKG-INFO, wheel METADATA e PEP 725. Compare as questões levantadas sobre sdist e wheel com as especificações de packaging relevantes e, em seguida, determine qual texto da documentação ou das especificações precisa de esclarecimento e resuma os pontos não resolvidos para os maintainers.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Issue Description
I'm writing a build backend which aims to deliver these key features relevant to the discussion (among others):
- Sdists will only contain static metadata;
- The code for sdist-building and wheel-building is separable, such that, when an sdist is downloaded and installed automatically (e.g. by Pip), only the wheel-building code is needed as a build dependency;
- There is no legacy support - sdists contain a
PKG-INFOspecifying a core metadata version of 2.2 or higher (most likely 2.4) and apyproject.toml.
There are several confusing points I've encountered in the description of pyproject.toml and of the core metadata format, and how they are used in source trees (pyproject.toml only), sdists (both) and wheels (core metadata only). My goal here is to verify that I can accomplish my goals while remaining standards compliant.
The main conceptual problem I'm having is that pyproject.toml and core metadata are described as canonical metadata formats, yet a non-legacy sdist is expected to contain both. I have many questions as a result.
First, regarding sdist creation: my understanding is that in this process, the build backend:
- MUST faithfully represent static metadata (if any) from the source tree's
pyproject.tomlin thePKG-INFO; - MAY compute values for dynamic metadata and include these in the
PKG-INFOas well.
The question is, what happens to the version of pyproject.toml that ends up in the sdist?
It seems to me that it cannot in general be an exact copy of the source tree's pyproject.toml, because if I compute dynamic metadata then there is a conflict - the field is marked dynamic in pyproject.toml but provided statically in PKG-INFO.
Am I at liberty to create an entirely new pyproject.toml, as long as it follows the spec? For example, can I remove the [project] table (since in general this table isn't required to be present, and I've already fully "compiled" its information into PKG-INFO)? Can I change the [build-system] table, such that a different build backend will be used to create the wheel? (One implementation idea I had was to incorporate an in-tree, wheel-specific backend into the sdist.) Should [project] at least be edited to reflect the dynamic metadata values that were calculated (e.g. add the computed values as static keys, and remove the corresponding names from project.dynamic)?
Then, regarding wheel building. Regarding core metadata, it says that "Fields defined in the following specification should be considered valid, complete and not subject to change."
Does that imply that the wheel's METADATA MUST be a copy of the sdist's PKG-INFO?
Doesn't that prevent computing metadata values at wheel creation time? (Not applicable to me, but still worth raising the question.)
Doesn't that in turn imply that non-legacy sdists need to have all the dynamic metadata values computed, and they can't be deferred to wheel-building? (I think this is intentional, so that e.g. installers can figure out basic information about the package without building it. But as of 24.3.1, Pip still does the build first anyway, even when PKG-INFO declares the latest metadata version.)
Doesn't that cause a problem for PEP 725 – Specifying external dependencies in pyproject.toml, since they propose to give semantics to Requires-External metadata whereby the wheel's version could differ? (In particular: the wheel-building process could use a tool like cibuildwheel to vendor a compiled shared C library whose source is not included in the sdist; by my reading of the PEP, the intent is that PKG-INFO would describe the library as an external requirement, but METADATA would not.)
Also: when building the wheel, is it required to look at pyproject.toml at all, or to validate it? My understanding is that the only mandatory purpose pyproject.toml actually serves at this point in the process is to tell an installer what build backend to use (and what its statically-known dependencies are); the backend itself is free to use other files for configuration (i.e. the config isn't required to be in [tool], and other tools simply won't be invoked at this point), and the [project] metadata is either redundant with PKG-INFO or erroneous.
Bonus round:
Given that PEP 725 isn't accepted yet, is there any circumstance in which it would make sense for a modern build backend to output Requires-External or Supported-Platform values in core metadata? I can't think of any.
Code of Conduct
- I am aware that participants in this repository must follow the PSF Code of Conduct.
- Linguagem predominante
- Python
- Estrelas
- 1.7k
- Forks
- 1.8k
- Merge médio
- 5d 13h
- PRs com merge (30d)
- 2
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de pypa/packaging.python.org
-
Note greediness of PEP 723 reference parserTalvez já em andamento @jw9829 assumiu há 23 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
pypa/packaging.python.org#1960 · 4 comentários ·
Mantenedores costumam responder em até 5 dias
-
Document that sparse identifiers with whitespace are valid if quotedTalvez já em andamento @Herrtian assumiu há 163 dias. Abertacomponent: specifications good first issue type: enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
pypa/packaging.python.org#1226 · 3 comentários · 1 reação ·
Mantenedores costumam responder em até 5 dias
-
`test` vs. `tests`Talvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Abertacomponent: guides component: tutorials type: enhancement type: task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
pypa/packaging.python.org#1165 · 5 comentários ·
Mantenedores costumam responder em até 5 dias
-
type: task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
pypa/packaging.python.org#792 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 5 dias
-
Add pip.conf heads-up to PyPI.org migration guideTalvez já em andamento @harshitethic assumiu há 51 dias. Abertagood first issue help wanted type: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
pypa/packaging.python.org#463 · 5 comentários ·
Mantenedores costumam responder em até 5 dias
Todas as issues de pypa/packaging.python.org
Issues semelhantes
-
documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
Mantenedores costumam responder em até 1 dia
-
good first issue module-baseline needs triage ux
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
darnitdevorg/darnit#650 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
nyjc-computing/campus#938 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
nf-osi/nf-metadata-dictionary#1027 ·
Mantenedores costumam responder em até 1 dia
-
bug documentation
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
qatrackplus/qatrackplus#913 ·
Mantenedores costumam responder em até 3 dias