Skip to content

Migrate to src/ layout#664

Merged
hugovk merged 2 commits intoultrajson:mainfrom
hugovk:src-layout
Jun 16, 2025
Merged

Migrate to src/ layout#664
hugovk merged 2 commits intoultrajson:mainfrom
hugovk:src-layout

Conversation

@hugovk
Copy link
Copy Markdown
Member

@hugovk hugovk commented Apr 24, 2025

Rather than building with python/, lib/ and dep/ in the root, move them to src/ujson/.

@hugovk hugovk added the changelog: Changed For changes in existing functionality label Apr 24, 2025
@bwoodsend
Copy link
Copy Markdown
Collaborator

Is there anything we get out of doing this? To me, it just means more traversal every time I want to open a file. It's also going to be a lot of faff for all the repackagers out there.

@hugovk
Copy link
Copy Markdown
Member Author

hugovk commented Jun 9, 2025

It's a first step to migrating the build config from setup.cfg to pyproject.toml.

We'd get an error with the current layout:

      error: Multiple top-level packages discovered in a flat-layout: ['lib', 'deps'].
      
      To avoid accidental inclusion of unwanted files or directories,
      setuptools will not proceed with this build.
      
      If you are trying to create a single distribution with multiple packages
      on purpose, you should not rely on automatic discovery.
      Instead, consider the following options:
      
      1. set up custom discovery (`find` directive with `include` or `exclude`)
      2. use a `src-layout`
      3. explicitly set `py_modules` or `packages` with a list of names
      
      To find more information, look for "package discovery" on setuptools docs.

It lists two other options, however src layout is a common recommended structure for Python projects:

@bwoodsend
Copy link
Copy Markdown
Collaborator

I personally prefer the

[tool.setuptools.packages.find]
include = ["xxx"]

approach but I'm not that fussed.

@bwoodsend
Copy link
Copy Markdown
Collaborator

Does it make a difference to your all-repos changes?

@hugovk
Copy link
Copy Markdown
Member Author

hugovk commented Jun 12, 2025

I've not used all-repos for a while, but it probably wouldn't make a difference for that.

@bwoodsend
Copy link
Copy Markdown
Collaborator

Up to you then.

@hugovk hugovk merged commit 233216d into ultrajson:main Jun 16, 2025
24 checks passed
@hugovk hugovk deleted the src-layout branch June 16, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Changed For changes in existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants