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

RF/MNT: Remove some rust #915

Closed
wants to merge 9 commits into from
Closed

RF/MNT: Remove some rust #915

wants to merge 9 commits into from

Conversation

jond01
Copy link
Contributor

@jond01 jond01 commented May 24, 2020

Might be a bit rude because there was no prior discussion... but we can discuss here :-)

@jond01 jond01 marked this pull request as draft May 24, 2020 21:43
@codecov
Copy link

codecov bot commented May 24, 2020

Codecov Report

Merging #915 into master will increase coverage by 0.40%.
The diff coverage is 74.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #915      +/-   ##
==========================================
+ Coverage   91.73%   92.14%   +0.40%     
==========================================
  Files          97       97              
  Lines       12359    12268      -91     
  Branches     2177     2162      -15     
==========================================
- Hits        11338    11304      -34     
+ Misses        684      627      -57     
  Partials      337      337              
Impacted Files Coverage Δ
nibabel/_version.py 100.00% <ø> (ø)
nibabel/arrayproxy.py 100.00% <ø> (+0.75%) ⬆️
nibabel/cifti2/parse_cifti2.py 83.86% <ø> (ø)
nibabel/cmdline/dicomfs.py 18.96% <0.00%> (ø)
nibabel/cmdline/diff.py 93.70% <ø> (ø)
nibabel/fileslice.py 97.26% <0.00%> (ø)
nibabel/minc1.py 90.30% <ø> (-0.35%) ⬇️
nibabel/minc2.py 89.87% <ø> (ø)
nibabel/nicom/dwiparams.py 71.15% <ø> (ø)
nibabel/nicom/structreader.py 100.00% <ø> (ø)
... and 58 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 feff50b...c389b80. Read the comment docs.

@effigies
Copy link
Member

Hi, thanks a lot for these suggestions!

* `flip_axis` in orientations module -> `np.flip` + deprecation

Sounds good to me. Generally we go next major + 1, to be extra conservative about removing things.

* Remove v3.0 deprecations (+ related tests)

I'd considered doing this for 3.1 in #854, but the ExpiredDeprecationError is more informative than an ImportError will be, so I postponed removing 3.0 deprecations until 4.0.

This wasn't highly principled, but I imagined there's a reasonable likelihood somebody might have missed 3.0.0 and 3.0.1 and moved straight to 3.1.0. Also, in the run-up to 4.0 we'll have to effect the deprecations scheduled then, so it might be cleanest to make a big sweep and clear out the dead-as-of-3.0 code then, too.

Anyway, happy to discuss making a coherent policy. It might be that 3.2, which will be ~6 months after 3.0, is far enough along.

* Refactor py2 prints, imports and modules
* Docstrings: use triple _double_-quoted string - change `''' ... '''` to `""" ... """`
* F-strings: change string formatting with `%` / `.format` to f-strings (there's still some work in this point)

👍

Might be a bit rude because there was no prior discussion... but we can discuss here :-)

Not at all! I appreciate the initiative.

One thing that might be worth considering is splitting out the efforts into separate, focused PRs. That way, a trivial change that hits many files, like using double quotes on docstrings, can be reviewed separately from a more consequential one in a single file, such as the np.flip one.

@jond01
Copy link
Contributor Author

jond01 commented May 25, 2020

Thanks for the reply!

I agree that separate PRs are better, let's do this.

Regarding the deprecations - deferring is ok, but I do not get the reason behind a special error for over-deprecated objects. It means that these deprecations will stay forever in the package. Don't we want to remove them at some point?

@effigies
Copy link
Member

Regarding the deprecations - deferring is ok, but I do not get the reason behind a special error for over-deprecated objects.

It gives people who ignored warnings an informative error. We usually try to direct them to the replacement.

Don't we want to remove them at some point?

Yes. I figured a major version (~1 year; see #734) would be a reasonable interval to expect even pretty slow-moving ecosystems to run into it.

@jond01
Copy link
Contributor Author

jond01 commented May 25, 2020

Sounds good.
So do we want to defer v3.0 deprecations to v4.0? (in a separate PR)

@effigies
Copy link
Member

Do you mean changes like the following?

     @property
-    @deprecate_with_version('ArrayProxy.header deprecated', '2.2', '3.0')
+    @deprecate_with_version('ArrayProxy.header deprecated', '2.2', '4.0')
     def header(self):
         return self._header

If so, no. That would revert the exception (which breaks things) to a warning (which can be ignored). The idea of not removing immediately is to break things, but with an informative error. In the run-up to 4.0, we can clear out all the code.

If not, could you clarify what you mean?

@jond01
Copy link
Contributor Author

jond01 commented May 25, 2020

Yes, that what I meant, and no problem.
Unfortunately, I have already deferred one deprecation in #916 in order to pass the CI:
164d46c

@effigies
Copy link
Member

With that one, because of the missing comma, the docstring was actually rendered:

orientation_affine deprecated. Please use inv_ornt_aff instead1.3

    deprecated from version: 3.0

Instead of raising a warning between 1.3 and then an error at 3.0, it only started raising a warning at 3.0.

Because we did attempt to deprecate it at 1.3, I'm a bit inclined to fast-track it and target 4.0 rather than 5.0 for raising an ExpiredDeprecationError.

@jond01 jond01 closed this May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants