Move astropy to ``src`` directory
See original GitHub issueDescription
Having the following package structure is considered much safer.
astropy/
├── pyproject.toml
├── ...
├── src/
│ └── astropy/
Additional context
https://packaging.python.org/en/latest/tutorials/packaging-projects/#creating-the-package-files https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:19 (17 by maintainers)
Top Results From Across the Web
Configuration System (astropy.config)
The astropy configuration system is designed to give users control of various parameters used in astropy or affiliated packages without delving into the...
Read more >Source code for astropy.config.paths
Raises ------ OSError If the home directory cannot be located - usually means you are running Astropy on some obscure platform that doesn't...
Read more >How to create and maintain an Astropy affiliated package
git submodule add https://github.com/astropy/astropy-helpers.git astropy_helpers ... Move the main source directory to reflect the name of your package.
Read more >2. The basic structure of a Python package
For example, astropy provides a cookiecutter package template specific to ... The standard method for installing a package from its source directory (the ......
Read more >PermissionError: [WinError 32] with fits files - Stack Overflow
This warning in the documentation should answer your question (perhaps the warning should be moved elsewhere since it's not specific just to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Basically src-layout makes it much easier to test the installed version of a package (and thus to test that the package has been packaged/installed correctly), by ensuring that the package cannot be imported from the local directory. With a flat-layout it can be very difficult to do so, because amongst other of pytest’s way to discover
conftest.py
and test files.More info on src-layout: https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure Also ref https://github.com/astropy/package-template/issues/522
For astropy the current way to test the installed package only works because pytest-astropy-header is importing astropy (without needing it) before pytest runs the conftest and test discovery (!!): https://github.com/astropy/pytest-astropy-header/issues/41 (especially https://github.com/astropy/pytest-astropy-header/issues/41#issuecomment-1002705819 which summarizes the thing …) https://github.com/astropy/pytest-astropy-header/pull/43 (nice fix 😄)
I lost hours on this testing the installed package thing for various packages, it’s often painful to do unless you use a src-layout … (for flat-layout it depends if the test files are in the package or not, if using
conftest.py
in the root directory, and probably other things I forgot). So yeah src-layout may look weird at first but for my mental health it’s now my preferred choice 😉.But, we have so many open PRs and stuff… This is something that needs to be coordinated well to happen without making everyone else cry.