Skip to content

feat: support pyproject.toml in compile_pip_requirements - #1519

Merged
rickeylev merged 7 commits into
bazel-contrib:mainfrom
aignas:feat/pyproject-toml-support
Nov 3, 2023
Merged

feat: support pyproject.toml in compile_pip_requirements#1519
rickeylev merged 7 commits into
bazel-contrib:mainfrom
aignas:feat/pyproject-toml-support

Conversation

@aignas

@aignas aignas commented Oct 27, 2023

Copy link
Copy Markdown
Collaborator

With this PR we can also use pyproject.toml in addition
to requirements.in which helps in making the requirements
in a more structured form. For example, we could parse the
toml itself and create aliases in the hub repos only for the
packages outlined in the pyproject.toml file. The same for
gazelle, we could restrict gazelle_python.yaml contents
to only the dependencies listed in pyproject.toml.

Examples can be migrated once we agree on the interface.

Summary:

  • feat: support pyproject.toml in compile_pip_requirements
  • chore: use pyproject.toml for sphinx doc requirements

@aignas
aignas requested a review from rickeylev as a code owner October 27, 2023 06:00
@aignas
aignas marked this pull request as draft October 27, 2023 07:38
@aignas
aignas force-pushed the feat/pyproject-toml-support branch from 8454c1c to dff8198 Compare November 1, 2023 00:17
@aignas
aignas marked this pull request as ready for review November 1, 2023 03:42
@aignas
aignas requested a review from f0rmiga as a code owner November 1, 2023 03:42

@groodt groodt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I think in the description, could be worth clarifying that it's support PEP-621 project.dependencies https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata only. It shouldn't imply support of any other TOML tables that may exist, or tool specific tables such as tool.black or tool.poetry etc

@rickeylev

Copy link
Copy Markdown
Collaborator

LGTM. I pushed a small update to the src arg doc.

The only comment, more question, I have is: should src default to requirements.in or pyproject.toml? If I understand correctly, toml files are the newer, better way?

@aignas
aignas force-pushed the feat/pyproject-toml-support branch from e31955a to b746642 Compare November 2, 2023 04:35
@aignas

aignas commented Nov 2, 2023

Copy link
Copy Markdown
Collaborator Author

I have changed the code to default to pyproject.toml as I agree that people who are new to rules_python should use by default new standards, but that may cause issues for older users who were relying on default behaviour.

If you are OK with the changes, explanation, feel free to merge it during your working hours.

@rickeylev
rickeylev added this pull request to the merge queue Nov 3, 2023
Merged via the queue into bazel-contrib:main with commit cb56a0f Nov 3, 2023
@aignas
aignas deleted the feat/pyproject-toml-support branch May 13, 2024 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants