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 deprecation system #2294

Open
egede opened this issue Feb 22, 2024 · 7 comments
Open

Add deprecation system #2294

egede opened this issue Feb 22, 2024 · 7 comments

Comments

@egede
Copy link
Member

egede commented Feb 22, 2024

A deprecation system should be developed for Ganga. It should

  • Have a well defined way of marking plugins, functions etc as deprecated with a warning about when they will be removed.
  • Run tests in the testing framework that will alert developers to that certain parts of the code can now be removed.
  • Apply the deprecation system to parts of the code that is already deprecated.
@alexanderrichards
Copy link
Contributor

possibly https://pypi.org/project/Deprecated/

@egede
Copy link
Member Author

egede commented Feb 26, 2024

Looks interesting. Maybe add to this some way where the CI testing will start to fail a test if there are old "deprecations" that has not been removed. So maybe the decorator should have a way of marking the deprecation period. In the example below

@deprecated(version='8.6.9', reason="Singularity is the old name, use Apptainer instead", expiry=datetime.date(2024,7,1))

would then if used give the message

WARNING: Deprecated in version 8.6.9. Singularity is the old name, use Apptainer instead. Class will be removed in first release after 2024-07-01.

@egede
Copy link
Member Author

egede commented Feb 26, 2024

The CI testing will then just have a test that starts failing if it finds any line with an expiry date that is before the current date. Should probably be made as a separate section in the testing (that is not required to pass) to avoid messing up the test of some unrelated PR. Or maybe we could do some of the same kind of magic as we have for the PEP8 testing where a PR is automatically created with the deprecated functions marked for removal.

@alexanderrichards
Copy link
Contributor

makes sense

@dg1223
Copy link
Contributor

dg1223 commented Feb 27, 2024

possibly https://pypi.org/project/Deprecated/

@alexanderrichards I think I am gonna borrow this idea for #2293 :)

@egede
Copy link
Member Author

egede commented Feb 27, 2024

Links somewhat in with #2149. The issue here is related to Ganga code that gets deprecated, while the other one is related to python syntax that gets deprecated.

@egede
Copy link
Member Author

egede commented May 2, 2024

Suggested steps for developing this. @YilinZhao6 Let us know if you start working on this.

  • Investigate if Deprecated is the correct thing to base this on, or if there is something better.
  • If "yes", extend the package (probably through inheritance) to include the extra features we requested. It seems like it might only be the removal date as the "version" stuff seems already there. The code should go into Decorators.py if it is just a few lines, or else into a file of its own in the same directory.
  • Update dependencies of Ganga to include the Deprecated package.
  • Write some test cases that demonstrates that it is working. The test cases should go into the directory GangaCore/test/Unit/Utility.
  • Apply it to the Singularity class as the first example.
  • The continuous integration test should be modified to identify code that we already deprecated and that is now ripe for removal. This should probably be done as part of a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants