Skip to content

Conversation

@mwtoews
Copy link
Contributor

@mwtoews mwtoews commented Jul 22, 2025

There are two key changes in this PR:

  1. Change build backend from setuptools to hatchling. See "Why Hatch?" for some motivation.
  2. Move source code to a src layout.

I've checked both sdist and bdist wheels, and the file structures are nearly identical. The primary "shapefile.py" still gets installed in the usual place.

@mwtoews mwtoews force-pushed the hatchling-src-layout branch 2 times, most recently from f7bad1a to 3649433 Compare July 22, 2025 21:55
@mwtoews
Copy link
Contributor Author

mwtoews commented Jul 22, 2025

Is there any reason why development isn't going to master? There are no CI tests to be configured on other branches.

@JamesParrott
Copy link
Collaborator

The CI should run on pushes to all branches (just not on PRs) I'm just keeping master on v2.4.0 until the publishing to PyPi process is fixed. It'll happen in a week or so.

@JamesParrott JamesParrott force-pushed the hatchling-src-layout branch from 3649433 to 7fca605 Compare July 23, 2025 00:50
@JamesParrott
Copy link
Collaborator

JamesParrott commented Jul 23, 2025

Thanks for this Mike. Hatchling is my personal preference also, so I have no objection. The src layout really is helpful too - it let me test a wheel (that I built from this PR without any problem) using test_shapefile.py, now that it's not in the same directory as shapefile.py.

But I'm going to hang back for now, to give other maintainers opportunity to object, and for the following additional reason:
currently the main CI test Custom Action only tests an editable install from a local repo.

I know it's only a single file library, and the build is all but trivial. But if we're going to change how our wheels are built, we should test the resulting wheels before shipping them. I don't think the tests will be noticeably slowed down if a build step is included before the editable install, and testing from a built wheel is more representative and reproducible.

Let me know if you want to tackle that, but I should remove the Python 2 mock server steps from this branch anyway so I'm happy to change the Action.

[Edit] Actually it's probably best if I do this, I'll change the action now on this branch. It's probably best, just in case it creates one of those tricky situations where the test workflow fails, but fails because it should fail (for a good reason, e.g. a bug elsewhere, not because there's anything wrong with the workflow).~~

[Edit 2] Change to Github Action now done.

@JamesParrott JamesParrott force-pushed the hatchling-src-layout branch from 7fca605 to 9ed7ff2 Compare July 23, 2025 14:27
@JamesParrott JamesParrott force-pushed the hatchling-src-layout branch from 5e77af3 to f983462 Compare July 25, 2025 11:06
@JamesParrott
Copy link
Collaborator

On reflection, this PR works nicely with the changes I've now made to the CI tests, and the ability to run the doctests from test_shapefile.py. Testing the wheels we actually ship, and clarity about what exactly the code under test is, are much more important than sticking to the tried and tested setup.py system for fear of breaking something. This is quite old fashioned now anyway, and a pyproject.toml /src layout is a great fit for the whole Python 3 modernisation effort.

@JamesParrott JamesParrott merged commit d8e120d into GeospatialPython:3.0.0-alpha Jul 25, 2025
21 checks passed
@mwtoews mwtoews deleted the hatchling-src-layout branch July 25, 2025 19:06
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.

2 participants