Skip to content

Commit 1a6f055

Browse files
RobPasMueklmcadamsSMoraisAnsys
authored
docs: deprecating a library (#606)
* docs: deprecating a library * docs: missing explanation * fix: vale issues * fix: pre-commit * Update doc/source/how-to/deprecating.rst * fix: removing ref * fix: remove line * Apply suggestions from code review Co-authored-by: Kerry McAdams <[email protected]> * Apply suggestions from code review Co-authored-by: Sébastien Morais <[email protected]> * Apply suggestions from code review * Update doc/source/how-to/deprecating.rst Co-authored-by: Sébastien Morais <[email protected]> * docs: adding documentation banner --------- Co-authored-by: Kerry McAdams <[email protected]> Co-authored-by: Sébastien Morais <[email protected]>
1 parent e0bc16c commit 1a6f055

File tree

4 files changed

+157
-2
lines changed

4 files changed

+157
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repos:
44
- repo: https://github.com/astral-sh/ruff-pre-commit
55
rev: v0.11.13
66
hooks:
7-
- id: ruff
7+
- id: ruff-check
88
- id: ruff-format
99

1010
- repo: https://github.com/adamchainz/blacken-docs

doc/source/how-to/deprecating.rst

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
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`_

doc/source/how-to/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ and app APIs.
106106

107107
How to handle vulnerabilities in PyAnsys packages.
108108

109+
.. grid-item-card:: :fas:`fa-solid fa-bug` Deprecating a library
110+
:link: deprecating
111+
:link-type: doc
112+
:padding: 2 2 2 2
113+
114+
How to deprecate a PyAnsys library.
109115

110116
.. toctree::
111117
:maxdepth: 3
@@ -125,3 +131,4 @@ and app APIs.
125131
dns-configuration
126132
compatibility
127133
vulnerabilities
134+
deprecating

doc/source/links.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,20 @@
213213
.. _PyPI API token: https://pypi.org/help/#apitoken
214214

215215
.. #Vulnerabilities
216-
.. _metapackage: https://github.com/pyansys/pyansys
216+
.. _metapackage: https://github.com/ansys/pyansys
217217
.. _CVE: https://www.cve.org/
218218
.. _Safety: https://pyup.io/safety/
219219
.. _Bandit: https://bandit.readthedocs.io/en/latest/
220220
.. _the action's documentation: https://actions.docs.ansys.com/version/stable/vulnerability-actions/index.html#check-vulnerabilities-action
221221
.. _PyACP security considerations: https://acp.docs.pyansys.com/version/dev/user_guide/security_considerations.html
222222
.. _Github's documentation: https://docs.github.com/en/code-security/security-advisories/working-with-repository-security-advisories/collaborating-in-a-temporary-private-fork-to-resolve-a-repository-security-vulnerability
223223
.. _PyAnsys Geometry subprocess advisory: https://github.com/ansys/pyansys-geometry/security/advisories/GHSA-38jr-29fh-w9vm
224+
225+
.. #Deprecation
226+
.. _PyAdditive Widgets README: https://github.com/ansys/pyadditive-widgets/blob/main/README.rst
227+
.. _PyAdditive Widgets deprecation issue: https://github.com/ansys/pyadditive-widgets/issues/102
228+
.. _PyAdditive Widgets deprecation warning: https://github.com/ansys/pyadditive-widgets/blob/600915a8db2dbb02088266c17ba2be53584079d0/src/ansys/additive/widgets/__init__.py#L24-L31
229+
.. _PyAdditive Widgets PyPI archive: https://pypi.org/project/ansys-additive-widgets/
230+
.. _Metapackage deprecation PR: https://github.com/ansys/pyansys/pull/968
231+
.. _PyAnsys Dev deprecation PR: https://github.com/ansys-internal/pyansys-dev/pull/44
232+
.. _Automation project deprecation PR: https://github.com/ansys-internal/pyansys-maintenance-automation/pull/79

0 commit comments

Comments
 (0)