pyxem / diffsims

An open-source Python library providing utilities for simulating diffraction
https://diffsims.readthedocs.io
GNU General Public License v3.0
46 stars 26 forks source link

Add Deprecations #199

Closed CSSFrancis closed 6 months ago

CSSFrancis commented 1 year ago

Description of the change

Adds in Deprecation wrappers.

See Kikchipy, pyxem, hyperspy etc.

Progress of the PR

Minimal example of the bug fix or new feature

>>> from diffsims.utils._deprecated import deprecate
>>> @deprecate(since=0.8, removal=0.9, alternative="bar")
>>> def foo(self, n):
>>>     return n + 1

>>> @property
>>> @deprecate(since=0.9, removal=0.10, alternative="another", is_function=True)
>>> def this_property(self):
>>>     return 2

For reviewers

CSSFrancis commented 1 year ago

@hakonanes Just adding these here so I can deprecate some code before tackling #198.

Should this be a Gist? or a small python package or??? I really like reusing this :)

hakonanes commented 1 year ago

Should this be a Gist?

Perhaps. Would that make it easier to copy, somehow? Or do you mean in terms of visibility?

As mentioned before, I took the bits I wanted from Matplotlib's and scikit-image's deprecation tools. @harripj improved it after I added it to orix. Did you, @CSSFrancis, add functionality as well at some point? You have my blessing to put it up as a Gist if you want. But, you need @harripj's blessing as well. If you do make a Gist of the these deprecation tools, I'm OK with you licensing it in accordance with Matplotlib and scikit-image, that is not being restricted by GPLv3.

I don't think we should put a package on PyPI, as there are already at least deprecation packages on there:

harripj commented 1 year ago

@hakonanes @CSSFrancis you have my blessing too. I wonder whether it is worth adding a reference back to orix somewhere in the Gist (header?)? I think that would be ample accreditation.

hakonanes commented 6 months ago

Can you make the suggested changes? I'll have a final look after that. Fairly certain we can merge after that again. I'd like to deprecate some old methods to get sets of {hkl} in #213.

CSSFrancis commented 6 months ago

pre-commit.ci autofix

CSSFrancis commented 6 months ago

Failing build is due to a Checksum not matching when using pip to install. Kind of a new one :)