Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple pyproject.toml files #851

Closed
jossh-h opened this issue Jan 8, 2025 · 3 comments
Closed

Support for multiple pyproject.toml files #851

jossh-h opened this issue Jan 8, 2025 · 3 comments

Comments

@jossh-h
Copy link

jossh-h commented Jan 8, 2025

We have a situation where we have multiple packages per repository, and the packaging system we use has its package definition file nested within the python namespace, ideally our PIP projects would follow the same structure eg:

  MyProject
 ┗ src
   ┗ libs
      ┣ foo
      ┃  ┣  main.py
      ┃  ┗ pyproject.toml
      ┗ bar
         ┣  main.py
         ┗ pyproject.toml

This hierarchy is not officially supported by setuptools or any other front/backends from what I can find,

If we use flit then we can have two separate *pyproject.toml files at the root:

  MyProject
 ┣ foo_pyproject.toml
 ┣ bar_pyproject.toml
 ┗ src
   ┗ libs
      ┣ foo
      ┃  ┗  main.py
      ┗ bar.py 
         ┗ main.py

Then build with the -f flag and pass in the input config file eg: flit -f foo_pyproject.toml build
This works but ideally we would use the same front/backend as our other package projects which is build/setuptools.

What are the chances of adding support for this? I am happy to work on this feature but wanted to gauge the feeling on adding this feature.

@uranusjr
Copy link
Member

uranusjr commented Jan 9, 2025

Doesn’t uv support your first tree with workspaces? (You need an additional pyproject.toml in the root.

@jossh-h
Copy link
Author

jossh-h commented Jan 9, 2025

Doesn’t uv support your first tree with workspaces? (You need an additional pyproject.toml in the root.

I couldn't get that tree working with uv and workspaces,

  MyProject
 ┗ src
   ┗ libs
      ┣ foo
      ┃  ┣  main.py
      ┃  ┗ pyproject.toml
      ┗ bar
         ┣  main.py
         ┗ pyproject.toml

One of the problems with the first tree is when setting the root of the namespace to ../../../src eg:

/MyProject/src/libs/foo/pyproject.toml

[project]
name = "foo-package"
...
...
[tool.setuptools.packages.find]
where =   ["../../../src"]
include = ["libs.foo"]

I get some odd behavior, for example building the wheel from the sdist via python -m build will error, but passing the --wheel and or --dist flag will build fine.

@layday
Copy link
Member

layday commented Jan 9, 2025

pyproject.toml canonically marks the root of the project source tree. The flit flag is non-standard and most likely predates pyproject.toml. You might just have to bite the bullet and nest each package under its own project folder.

@layday layday closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2025
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

No branches or pull requests

3 participants