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

Add Deprecations #199

Merged
merged 7 commits into from
May 9, 2024
Merged

Add Deprecations #199

merged 7 commits into from
May 9, 2024

Conversation

CSSFrancis
Copy link
Member

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

  • The PR title is short, concise, and will make sense 1 year later.
  • New functions are imported in corresponding __init__.py.
  • New features, API changes, and deprecations are mentioned in the
    unreleased section in CHANGELOG.rst.
  • Contributor(s) are listed correctly in credits in diffsims/release_info.py and
    in .zenodo.json.

@CSSFrancis
Copy link
Member Author

CSSFrancis commented Oct 20, 2023

@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 :)

@CSSFrancis CSSFrancis mentioned this pull request Oct 20, 2023
16 tasks
@hakonanes
Copy link
Member

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:

Copy link
Member

@hakonanes hakonanes left a comment

Choose a reason for hiding this comment

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

Looks good. I have a few minor suggestions that could be addressed before merging.

@harripj
Copy link

harripj commented Oct 25, 2023

@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
Copy link
Member

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
Copy link
Member Author

pre-commit.ci autofix

@CSSFrancis
Copy link
Member Author

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

@hakonanes hakonanes merged commit 684828e into pyxem:main May 9, 2024
12 checks passed
hakonanes added a commit to hakonanes/diffsims that referenced this pull request May 9, 2024
Add Deprecations

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
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.

3 participants