| Message ID | 20260812194433.40594-1-chris.laplante@agilent.com |
|---|---|
| State | New |
| Headers | show |
| Series | [1/2] pyproject.toml: add setuptools to requires; fix project structure | expand |
Hi Chris, Thanks for pointing this out! I think it was a mistake for me to include the project and build-system sections in pyproject.toml. I had it in there originally to try to improve the versioning, but we chose to implement it a different way. It is only needed if you intend to do packaging which is something we are trying not to do with bitbake itself. We have a separate pyproject.toml file for bitbake-setup, which we do want to package for convenience. If we remove those sections does that fix the problem you see with PyCharm? Regards, Rob On Wed, Aug 12, 2026 at 3:44 PM Chris Laplante via lists.openembedded.org <chris.laplante=agilent.com@lists.openembedded.org> wrote: > From: Chris Laplante <chris.laplante@agilent.com> > > setuptools is listed as the build backend but wasn't in 'requires'. > > We also need to tell setuptools to look for our modules in 'lib' since > otherwise > it chokes on our non-standard layout with: > > [stderr] > error: Multiple top-level packages discovered in a flat-layout: > ['lib', 'conf', 'vendor', 'contrib', 'classes']. > > With these changes, 'uv sync' works and IDEs such as PyCharm can > properly analyze the project. > > Signed-off-by: Chris Laplante <chris.laplante@agilent.com> > --- > pyproject.toml | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/pyproject.toml b/pyproject.toml > index 93508d92e..886753f14 100644 > --- a/pyproject.toml > +++ b/pyproject.toml > @@ -1,10 +1,17 @@ > [build-system] > -requires = [] > +requires = ["setuptools>=64"] > build-backend = "setuptools.build_meta" > > [project] > name = "bitbake" > version = "2.19.0" > +requires-python = ">= 3.9" > + > +[tool.setuptools] > +package-dir = {"" = "lib"} > + > +[tool.setuptools.packages.find] > +where = ["lib"] > > [tool.vendoring] > destination = "lib/bb/_vendor" > -- > 2.43.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#19919): > https://lists.openembedded.org/g/bitbake-devel/message/19919 > Mute This Topic: https://lists.openembedded.org/mt/120723537/556952 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > rob.woolleywr@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
Hi Rob, > I think it was a mistake for me to include the project and build-system sections > in pyproject.toml. I had it in there originally to try to improve the versioning, > but we chose to implement it a different way. It is only needed if you intend to > do packaging which is something we are trying not to do with bitbake itself. > > We have a separate pyproject.toml file for bitbake-setup, which we do want to > package for convenience. > > If we remove those sections does that fix the problem you see with PyCharm? I gave it a try and getting rid of the 'build-system' section makes 'uv sync' work and PyCharm load the project. (I think we need to keep the 'project' section though.) With the 'build-system' stuff and 'tool.setuptools' gone though, PyCharm is back to not being able to resolve 'import bb' imports. In my case, a .env file containing: PYTHONPATH=lib did the trick. But that isn't something that should be committed to git. Ideally, we would be able to add barebones tool-specific config files to bitbake so IDEs can analyze it. e.g. .vscode/settings.json for VSCode or .idea/modules.xml for PyCharm. I'll work on a new set of patches for this. Thanks, Chris
diff --git a/pyproject.toml b/pyproject.toml index 93508d92e..886753f14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,17 @@ [build-system] -requires = [] +requires = ["setuptools>=64"] build-backend = "setuptools.build_meta" [project] name = "bitbake" version = "2.19.0" +requires-python = ">= 3.9" + +[tool.setuptools] +package-dir = {"" = "lib"} + +[tool.setuptools.packages.find] +where = ["lib"] [tool.vendoring] destination = "lib/bb/_vendor"