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

Rename plasmapy.atomic to plasmapy.particles #742

Merged
merged 7 commits into from
Feb 4, 2020

Conversation

namurphy
Copy link
Member

As part of the changes associated with the forthcoming PLEP 7 (PlasmaPy/PlasmaPy-PLEPs#26), we decided to rename plasmapy.atomic to plasmapy.particles. One of the primary reasons for this is that this subpackage includes not just atomic data but also data and representations for fundamental particles. Needless to say, this PR is a huge API chance.

  • We used particles as a variable in a bunch of different places. I went through and changed these to avoid namespace conflicts.
  • I renamed ion_particle to ion in a few places in collisions.py, braginskii.py, and related files.
  • I used PyCharm to refactor and rename plasmapy.atomic to plasmapy.particles. This amazingly almost everything that was necessary in the code, and I only had to fix one test failure.
  • I went through the docstrings more manually, as we use the word "atomic" in a whole bunch of places and I wanted to make sure there weren't any unnecessary changes.
  • I went through the docs directory more carefully too, and changed a few section titles. Hopefully the docs build okay...
  • I made good use of grep to find any lingering places where atomic was used. I'm hugely grateful for Software Carpentry teaching me this command.

The rebase associated with #728 might be a pain since I had to update a bunch of files in plasmapy.atomic in small ways while rearranging some formatting things in plasmapy.utils. In order to (possibly? hopefully?) make rebasing easier, I'd suggest not doing a squash merge on this one so that git can decipher all of the little changes separately. Wish me luck! Or perhaps more specifically, wish me good luck....

In preparation for renaming `plasmapy.atomic` to `plasmapy.particles`,
I went through and changed variables named `particles` to `species` to
avoid the namespace conflicts that arose when I first trying the Great
Renaming.  While I was at it, I also changed `ion_particle` to `ion`
whenever it showed up.  This changes the API, in preparation for more
changes to the API.
PyCharm made this so easy!  The only thing I had to change manually
was a docstring example that imported plasmapy.atomic.  Now to check
the docstrings...  I'll be thanking Software Carpentry for teaching me
how to use grep.
@namurphy namurphy added plasmapy.particles Related to the plasmapy.particles subpackage docs PlasmaPy Docs at http://docs.plasmapy.org refactoring ♻️ Improving an implementation without adding new functionality plasmapy.formulary Related to the plasmapy.formulary subpackage transport Related to plasma transport phenomena breaking change For breaking changes, excluding deprecations and planned removals needs changelog entry See: https://docs.plasmapy.org/en/latest/contributing/changelog_guide.html labels Jan 28, 2020
@namurphy namurphy requested a review from rocco8773 January 28, 2020 22:02
@pep8speaks
Copy link

pep8speaks commented Jan 28, 2020

Hello @namurphy! Thanks for updating your pull request.

Line 77:48: E251 unexpected spaces around keyword / parameter equals
Line 77:50: E251 unexpected spaces around keyword / parameter equals
Line 78:64: E251 unexpected spaces around keyword / parameter equals
Line 78:66: E251 unexpected spaces around keyword / parameter equals

Comment last updated at 2020-02-04 20:23:31 UTC

@namurphy namurphy force-pushed the rename-atomic-to-particle branch from 26200c5 to a9581d1 Compare January 28, 2020 22:08
@codecov
Copy link

codecov bot commented Jan 28, 2020

Codecov Report

Merging #742 into master will increase coverage by 1.16%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #742      +/-   ##
==========================================
+ Coverage   95.06%   96.23%   +1.16%     
==========================================
  Files          56       55       -1     
  Lines        5047     4967      -80     
==========================================
- Hits         4798     4780      -18     
+ Misses        249      187      -62
Impacted Files Coverage Δ
plasmapy/diagnostics/langmuir.py 93.21% <ø> (-0.07%) ⬇️
plasmapy/utils/error_messages.py 89.23% <ø> (ø)
plasmapy/utils/pytest_helpers/__init__.py 100% <ø> (ø) ⬆️
plasmapy/formulary/quantum.py 65.85% <0%> (-2.44%) ⬇️
plasmapy/particles/particle_class.py 96.64% <100%> (ø) ⬆️
plasmapy/formulary/magnetostatics.py 100% <100%> (+0.78%) ⬆️
plasmapy/classes/sources/plasmablob.py 100% <100%> (ø) ⬆️
plasmapy/formulary/mathematics.py 100% <100%> (ø) ⬆️
plasmapy/utils/pytest_helpers/pytest_helpers.py 93.4% <100%> (ø) ⬆️
plasmapy/__init__.py 53.33% <100%> (-5.5%) ⬇️
... and 5 more

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 543c62f...f3c7f2b. Read the comment docs.

The only places where "plasmapy.atomic" should show up in the
repository are in the change log and release notes.  Those references
should stay as they are because they refer to past releases.
@StanczakDominik
Copy link
Member

What you could do here is merge this directly into the tester helpers pr first, then squash merge this, then squash merge the latter. I think git will handle it.

Also grep is great! Ripgrep is a bit nicer on the interface and faster, but that's personal preference. Glad you're picking these tricks up!

Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave these changes a cursory look through - I mean, they're mostly automatic anyway - and they look okay. What I'd like to suggest is keeping plasmapy.atomic around for one release (less than a year this time!) as an alias to particles that also DeprecationWarns. We actually have users for this part (ping the illustrious @wtbarnes ) and it'd be rude not to, I think.

@namurphy
Copy link
Member Author

What I'd like to suggest is keeping plasmapy.atomic around for one release (less than a year this time!) as an alias to particles that also DeprecationWarns. We actually have users for this part (ping the illustrious @wtbarnes ) and it'd be rude not to, I think.

Yes, that is a real issue. I raised an issue in the fiasco repository (wtbarnes/fiasco#52), and offered to submit a PR there to account for this API change after it gets included in a release. There might be one or two more repositories too. There has not yet been an official release of fiasco so the PR could suffice. @wtbarnes, if there's an approach to this that would work particularly well for you, please let us know!

Since atomic is not the only subpackage that's getting renamed in our reshuffle, perhaps we could release 0.2.1 with deprecation warnings for all of the things we're changing. Alternatively, we could do something like the following in __init__.py:

import particles
import particles as atomic
import formulary
import formulary as physics

...though we would want to had DeprecationWarnings in there too.

@namurphy
Copy link
Member Author

What you could do here is merge this directly into the tester helpers pr first, then squash merge this, then squash merge the latter. I think git will handle it.

🙀

@StanczakDominik
Copy link
Member

Admittedly I don't worry about formulary as much because I'm not aware of users for those yet - and if there are any, I'd imagine surface level data analysis to be easier to change than libraries e.g. fiasco.

@wtbarnes
Copy link

I sincerely appreciate the effort to accommodate fiasco but I think breaking changes between minor versions pre 1.0 is perfectly acceptable. By depending on a pre-1.0 package like plasmapy, fiasco is accepting the risk that things might break and that is ok! And as you say, fiasco has not even had a formal release yet so changing things up to accommodate upstream issues is not a problem at all. I’m happy to do it. I would recommend just doing whatever makes your life as a developer easiest! Thanks for keeping me in the koop!

@namurphy
Copy link
Member Author

Thank you for your flexibility and understanding, @wtbarnes! We are trying to get breaking changes done sooner rather than later.

I'll put the question about merging this on the agenda for next week's community meeting.

@StanczakDominik
Copy link
Member

Or, since @wtbarnes is being gloriously agile in mindset about this (and this is the first time I use the term non-sarcastically), we could simply do the brute force renaming :)

@namurphy namurphy merged commit 063c678 into PlasmaPy:master Feb 4, 2020
@namurphy namurphy deleted the rename-atomic-to-particle branch August 14, 2021 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change For breaking changes, excluding deprecations and planned removals docs PlasmaPy Docs at http://docs.plasmapy.org needs changelog entry See: https://docs.plasmapy.org/en/latest/contributing/changelog_guide.html plasmapy.formulary Related to the plasmapy.formulary subpackage plasmapy.particles Related to the plasmapy.particles subpackage refactoring ♻️ Improving an implementation without adding new functionality transport Related to plasma transport phenomena
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants