RadioAstronomySoftwareGroup / pyradiosky

Python objects and interfaces for representing diffuse, extended and compact astrophysical radio sources
https://pyradiosky.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
14 stars 5 forks source link

Change package structure #206

Closed bhazelton closed 1 year ago

bhazelton commented 1 year ago

Description

Use the src layout to ensure that we're testing the package as it is installed for users.

Also update the github actions to use current versions of actions and update the release date of the last version in the changelog

Motivation and Context

The "flat" layout we were using before made it so that we were not actually testing the package as it would be installed by most users. This was revealed by the coverage issues in #203.

After doing a bunch of reading on these issues and talking with other RASG folks on telecons, we decided the best approach was to move to the src layout. We're doing it here first to work out the sticking points in a relatively simple python-only package.

I initially tried to also update to the most current packaging practices, using the pyproj.toml file and removing the setup.py file. I ran into trouble with this because setuptools_scm does not currently support defining custom versioning schemes using the pyproj.toml (see the issue log in that repo for several related issues). The primary developer on that package says support for that will be included in the next version of setuptools_scm, we can re-visit the packaging at that point.

In order to make our current versioning scheme work with this new layout I actually had to copy the code for it to two places (yuck!) but that seemed to be the only way to be able to get it to work without modifying the python path in setup.py which we really do not want to do (among other issues, it causes us to not be testing the installed package). If anyone has a better approach, please let me know!

A major issue was getting the coverage reports to be properly generated in the actions. Many things messed that up, and one obvious approach (setting --cov=src/pyradiosky) does not work because it leads to us not actually testing the installed package. The solution I came up with was to set --cov=. but then it also picks up the docs folder and the setup.py file in the coverage reports. The docs folder was easy to fix by adding it to the omit list in our .coveragerc file. But for some reason, adding setup.py to that list results in coverage reports not being generated in CI. So I added pragma: no cover markers to cover all the lines of setup.py. It's an ugly solution, if anyone has a better approach please tell me!

Checklists:

Build/CI Change Checklist:

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.14 :tada:

Comparison is base (957afd3) 99.85% compared to head (8ecc7f2) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #206 +/- ## =========================================== + Coverage 99.85% 100.00% +0.14% =========================================== Files 6 5 -1 Lines 2074 2066 -8 Branches 0 556 +556 =========================================== - Hits 2071 2066 -5 + Misses 3 0 -3 ``` | [Impacted Files](https://app.codecov.io/gh/RadioAstronomySoftwareGroup/pyradiosky/pull/206?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RadioAstronomySoftwareGroup) | Coverage Δ | | |---|---|---| | [src/pyradiosky/data/\_\_init\_\_.py](https://app.codecov.io/gh/RadioAstronomySoftwareGroup/pyradiosky/pull/206?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RadioAstronomySoftwareGroup#diff-c3JjL3B5cmFkaW9za3kvZGF0YS9fX2luaXRfXy5weQ==) | `100.00% <ø> (ø)` | | | [src/pyradiosky/spherical\_coords\_transforms.py](https://app.codecov.io/gh/RadioAstronomySoftwareGroup/pyradiosky/pull/206?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RadioAstronomySoftwareGroup#diff-c3JjL3B5cmFkaW9za3kvc3BoZXJpY2FsX2Nvb3Jkc190cmFuc2Zvcm1zLnB5) | `100.00% <ø> (ø)` | | | [src/pyradiosky/utils.py](https://app.codecov.io/gh/RadioAstronomySoftwareGroup/pyradiosky/pull/206?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RadioAstronomySoftwareGroup#diff-c3JjL3B5cmFkaW9za3kvdXRpbHMucHk=) | `100.00% <ø> (ø)` | | | [src/pyradiosky/\_\_init\_\_.py](https://app.codecov.io/gh/RadioAstronomySoftwareGroup/pyradiosky/pull/206?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RadioAstronomySoftwareGroup#diff-c3JjL3B5cmFkaW9za3kvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | | [src/pyradiosky/skymodel.py](https://app.codecov.io/gh/RadioAstronomySoftwareGroup/pyradiosky/pull/206?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RadioAstronomySoftwareGroup#diff-c3JjL3B5cmFkaW9za3kvc2t5bW9kZWwucHk=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.