fusion-energy / openmc-plasma-source

Creates a plasma source as an openmc.source object from input parameters that describe the plasma
MIT License
26 stars 11 forks source link

Update to package configuration #39

Closed LiamPattinson closed 2 years ago

LiamPattinson commented 2 years ago

This update aims to bring openmc-plasma-source in line with PEP 517 recommendations for packaging etc. The build/install details in setup.py are moved to setup.cfg and pyproject.toml as simple input files. Rather than calling:

One should instead call:

Rather than using a requirements file, the project requirements may be listed in setup.cfg, and optional dependencies may be installed using:

This update also introduces automatic version inference, meaning the git tag is the 'single source of truth' for versioning. The version is updated with developer tags when between patch versions, i.e. one commit after 0.5.3 will be 0.5.4.dev0+[git commit].d[date].

codecov[bot] commented 2 years ago

Codecov Report

Merging #39 (4889184) into develop (ca46cab) will decrease coverage by 2.66%. The diff coverage is 78.57%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #39      +/-   ##
===========================================
- Coverage    96.34%   93.67%   -2.67%     
===========================================
  Files            6        6              
  Lines          164      174      +10     
===========================================
+ Hits           158      163       +5     
- Misses           6       11       +5     
Impacted Files Coverage Δ
openmc_plasma_source/plotting/__init__.py 100.00% <ø> (ø)
openmc_plasma_source/__init__.py 61.53% <50.00%> (-38.47%) :arrow_down:
openmc_plasma_source/point_source.py 86.66% <80.00%> (ø)
openmc_plasma_source/ring_source.py 88.88% <80.00%> (ø)
openmc_plasma_source/tokamak_source.py 97.87% <90.00%> (ø)
...enmc_plasma_source/plotting/plot_tokamak_source.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1a09eb2...4889184. Read the comment docs.

shimwell commented 2 years ago

Great to have this all in one place. Looking forward to making use of this elsewhere as well. @RemDelaporteMathurin we have a similar PR on the Paramak that has been merged already and I think this one is good to go if you are happy with it

RemDelaporteMathurin commented 2 years ago

@shimwell @LiamPattinson thanks again for this. For some reason the CI/ testing workflow failed, does it need updating too?

LiamPattinson commented 2 years ago

Going to be honest, I'm really not sure why that failed. It's odd that pytest ran fine, but the python calls didn't. All I can think of is that circleci might be using Python 3 for pip calls, and Python 2.7 for direct python calls. I've made it explicit, and we'll see how it goes.

LiamPattinson commented 2 years ago

I had to play around in the openmc docker image to get to the root of this, and I think it might be as simple as doing a proper install rather than a 'develop' install in the CI. Calling pip install -e . in a locally hosted docker container led to similar issues of openmc-plasma-source not being included in the python path.

RemDelaporteMathurin commented 2 years ago

@LiamPattinson for some reason there seem to be some conflicts with this PR and I can't run the workflow until there are fixed

LiamPattinson commented 2 years ago

Sorry about that, the latest fix seems to have done it.