astropy / package-template

Template for packages that use Astropy. Maintainer: @astrofrog
http://docs.astropy.org/projects/package-template/en/latest/
Other
60 stars 62 forks source link

Switch to the `src/` based layout? #522

Closed maxnoe closed 1 year ago

maxnoe commented 2 years ago

There is a wide range of opinions on this, but I now more and more came to the conclusion that there are only upsides and basically no downsides to having the main python package not in the root of the directory but in a src/ subdirectory.

The current python packaging guide recommends this layout here: https://packaging.python.org/en/latest/tutorials/packaging-projects/ and in their sample package here: https://github.com/pypa/sampleproject

A list of reasons can be found here (2014 / update in 2019):

Note: Opposed to this guide's recommendation, I prefer tests in tree, so users can run the tests for the installed package.

nstarman commented 2 years ago

Any interest in jointly proposing this for astropy as well? It's something I've been considering.

astrofrog commented 2 years ago

no downsides

😅

maxnoe commented 2 years ago

@astrofrog No downsides for new projects, changing this for astropy would probably be a huge pain in the ...

pllim commented 2 years ago

I thought we are favoring OpenAstronomy template over this one now? See #519

But they don't use src there either, cc @Cadair

saimn commented 2 years ago

@astrofrog No downsides for new projects, changing this for astropy would probably be a huge pain in the ...

I'm not sure if it would be painful to do but at least switching to a src layout should allow to test the installed package without having to import astropy in pytest-astropy-header :thinking: : https://github.com/astropy/pytest-astropy-header/issues/41

pllim commented 1 year ago

https://github.com/astropy/package-template#deprecation-warning