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

[Proposal] Refactor project structure #616

Open
3 tasks
cvanelteren opened this issue Feb 19, 2025 · 3 comments
Open
3 tasks

[Proposal] Refactor project structure #616

cvanelteren opened this issue Feb 19, 2025 · 3 comments

Comments

@cvanelteren
Copy link
Contributor

After the CI build is merged (#614 #613), I believe the package structure needs to be addressed. Currently, the package structure obfuscates the build structure which makes contributing as a new developer is challenging. I would therefore propose to refactor the build structure to address these concerns. This would address point 3 raised here. The following structure would work:

/basemap
├── basemap/
├── data/
│   ├── basemap_data/
│   ├── basemap_hires/
├── pyproject.toml
├── build scripts
└── README.md
└── examples

To achieve this, we need to

  • update the CI builds with the new structure
  • Unify the setup.py and setup.cfg in pyproject.toml for a single point of entry to understand how the package is built
  • Move towards implicit namespaces

This restructuring would create a better user experience, allow for easier maintenance, consistent versioning, and simplify the build process.

Happy to hear your thoughts!

@DWesl
Copy link
Contributor

DWesl commented Mar 1, 2025

I don't know that a pyproject.toml-only setup is possible quite yet, since setuptools is still working out how to specify C extension modules there, so at least that would still need setup.py. Most of the rest of setup.cfg supports pyproject.toml now.

I also like the src layout to make it a bit harder to make certain kinds of mistakes in development, but CI will catch some of them and the build-from-sdist CI will catch more

@cvanelteren
Copy link
Contributor Author

I also like the src layout to make it a bit harder to make certain kinds of mistakes in development, but CI will catch some of them and the build-from-sdist CI will catch more

Could you elaborate on this?

@molinav
Copy link
Member

molinav commented Mar 1, 2025

The src layout is a safeguard to ensure that the test phase is performed on the installed basemap wheel and not on the basemap folder that you would have in the flat space. Otherwise, if your working directory is the package root, the basemap folder gets preference over the installed wheel when imported in the tests, and it could be that the basemap folder works but the wheel does not (i.e. because the wheels forgets to include something from the package tree), and you would not notice it.

The build-from-sdist is a safeguard to ensure that the wheels can be properly built from the source distribution that is uploaded to PyPI. Building the wheels directly from the package tree does not check that the sdist contains everything needed to build the wheel, and this may result in broken packages for the people that make pip install basemap without a precompiled wheel available (e.g. Cygwin). Indeed, this already occurred in the past (due to my lack of knowledge about it at the time), because the requirements file were not listed in the MANIFEST.in file and they were not included in the sdist.

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