|
| 1 | +.. _deprecating: |
| 2 | + |
| 3 | +Deprecating a library |
| 4 | +===================== |
| 5 | + |
| 6 | +As time passes, some libraries may become outdated or replaced by better alternatives. |
| 7 | +When this happens, it is important to deprecate the old library properly to ensure users |
| 8 | +are aware of the change and can transition smoothly. |
| 9 | + |
| 10 | +For the PyAnsys ecosystem, follow this specific process for deprecating libraries. |
| 11 | +This process helps maintain clarity and consistency across the projects. |
| 12 | + |
| 13 | +Maintainer tasks |
| 14 | +---------------- |
| 15 | + |
| 16 | +If you are a maintainer of a library that is being deprecated, please follow these steps. As |
| 17 | +an illustrative example, the deprecation of `PyAdditive Widgets <https://github.com/ansys/pyadditive-widgets>`_ |
| 18 | +is used in this guide. |
| 19 | + |
| 20 | +1. **Inform the PyAnsys Core team**: Before proceeding with the deprecation, it is essential to |
| 21 | + inform the PyAnsys Core team. This can be done by sending an email to |
| 22 | + the team at ` [email protected] < pyansys_core_email_>`_. This step ensures that the |
| 23 | + deprecation is communicated effectively and that the team can assist with any necessary |
| 24 | + changes in the PyAnsys ecosystem. |
| 25 | + |
| 26 | +2. **Close all open issues and pull requests**: Before deprecating the library, ensure that all |
| 27 | + open issues and pull requests in the library's repository are closed. This helps to avoid |
| 28 | + confusion and ensures that users are aware that the library is no longer actively maintained. |
| 29 | + You can close issues and pull requests with a comment explaining that the library is being |
| 30 | + deprecated and is no longer be supported. |
| 31 | + |
| 32 | +3. **Create a deprecation issue**: Open an issue in the library's repository to announce the |
| 33 | + deprecation. This issue should explain why the library is being deprecated, what alternatives |
| 34 | + are available, and any relevant timelines. See a template below for the issue content. |
| 35 | + |
| 36 | + .. warning:: |
| 37 | + |
| 38 | + Make sure to adapt the template to your specific library and situation. |
| 39 | + |
| 40 | + .. code:: markdown |
| 41 | +
|
| 42 | + ## ⚠️ Project Deprecation Notice |
| 43 | +
|
| 44 | + **This repository is no longer maintained as of [DATE].** |
| 45 | +
|
| 46 | + ### Reason for deprecation |
| 47 | + [Explain briefly why the project is being deprecated — e.g. better alternatives, no time to maintain, outdated use case.] |
| 48 | +
|
| 49 | + ### Alternatives |
| 50 | + If you're looking for a maintained alternative, consider: |
| 51 | + - [Alternative 1](https://...) |
| 52 | + - [Alternative 2](https://...) |
| 53 | +
|
| 54 | + ### What this means |
| 55 | + - No further updates, bug fixes, or pull request reviews |
| 56 | + - Issues will be closed |
| 57 | + - The repository will be archived |
| 58 | +
|
| 59 | + Thank you to everyone who contributed, used, or supported this project! |
| 60 | +
|
| 61 | + This issue serves as a permanent record of the deprecation and provide users with |
| 62 | + necessary information about alternatives. |
| 63 | + |
| 64 | + Make sure to pin the issue to the top of the repository so that it is easily visible to users. |
| 65 | + This can be done by selecting the "Pin issue" option in the issue's right-side menu, on GitHub. |
| 66 | + |
| 67 | + See an example at `PyAdditive Widgets deprecation issue`_. |
| 68 | + |
| 69 | +4. **Adapt the README**: Update the library's ``README`` file to reflect the deprecation. |
| 70 | + This should include a clear notice at the top of the ``README``, informing users that the |
| 71 | + library is deprecated. See an example at `PyAdditive Widgets README`_. |
| 72 | + |
| 73 | +5. **(Optional) Add a warning in the code**: If applicable, add a warning in the code itself to inform users |
| 74 | + that the library is deprecated. This can be done using Python's `warnings` module. For example: |
| 75 | + |
| 76 | + .. note:: |
| 77 | + |
| 78 | + Make sure to adapt the URL in the warning message. |
| 79 | + |
| 80 | + .. code:: python |
| 81 | +
|
| 82 | + # At the top of your main module or package (i.e. src/ansys/<...>/__init__.py) |
| 83 | +
|
| 84 | + import warnings |
| 85 | +
|
| 86 | + warnings.warn( |
| 87 | + "This library is deprecated and will no longer be maintained. " |
| 88 | + "Please consider using alternatives. " |
| 89 | + "For more information check https://github.com/ansys/<repository>/issues/<number>", |
| 90 | + DeprecationWarning, |
| 91 | + ) |
| 92 | +
|
| 93 | + See an example at `PyAdditive Widgets deprecation warning`_. |
| 94 | + |
| 95 | +6. **(Optional) Adapt the documentation**: PyAnsys libraries host documentation in GitHub Pages through |
| 96 | + the ``gh-pages`` branch. If your library has documentation, consider adding a deprecation notice |
| 97 | + to the documentation as well. A similar note to the one in the ``README`` can be added at the landing |
| 98 | + page of the documentation. If you main landing page is an ``.rst`` file, you can add the |
| 99 | + deprecation notice as a note directive: |
| 100 | + |
| 101 | + .. code:: rst |
| 102 | +
|
| 103 | + .. warning:: |
| 104 | +
|
| 105 | + This library is deprecated and will no longer be maintained. Please consider using alternatives. |
| 106 | + For more information, check the `deprecation issue <URL>`_. |
| 107 | +
|
| 108 | +7. **(Optional) Make a last release**: If you carried out steps 5 and 6, consider making a final release |
| 109 | + of the library that includes the deprecation warning. This ensures that users who install |
| 110 | + the library in the future see the warning immediately. |
| 111 | + |
| 112 | +8. **Archive the repository**: Once the deprecation issue is created and the ``README`` is updated, |
| 113 | + you can archive the repository. This prevents any further changes to the repository and |
| 114 | + signals to users that the library is no longer maintained. To archive a repository, go to the |
| 115 | + repository settings and select "Archive this repository." |
| 116 | + |
| 117 | +These steps ensure that the deprecation process is clear and transparent, allowing users to |
| 118 | +transition smoothly to alternatives while maintaining the integrity of the PyAnsys ecosystem. |
| 119 | + |
| 120 | +.. note:: |
| 121 | + |
| 122 | + The deprecation process may vary slightly depending on the specific library and its |
| 123 | + context. However, the core principles should remain consistent across all deprecations. |
| 124 | + |
| 125 | +Core team tasks |
| 126 | +--------------- |
| 127 | + |
| 128 | +The PyAnsys Core team is responsible for assisting with the deprecation process by: |
| 129 | + |
| 130 | +- Reviewing the deprecation issue to ensure it meets the project's standards. |
| 131 | +- Assisting with the above steps, if necessary. |
| 132 | +- Remove from PyPI the configuration (PyPI token or trusted publisher) for the library. |
| 133 | +- Archive the project on PyPI. See `PyAdditive Widgets PyPI archive`_. |
| 134 | +- Removing the library from the `PyAnsys metapackage <metapackage_>`_, automation project |
| 135 | + and the ``pyansys-dev`` repository. See example pull requests: |
| 136 | + |
| 137 | + - `Metapackage deprecation PR`_ |
| 138 | + - `PyAnsys Dev deprecation PR`_ |
| 139 | + - `Automation project deprecation PR`_ |
0 commit comments