You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The NVDA API must maintain compatibility with add-ons throughout yearly development cycles.
2
6
The first release of a year, i.e. `20XX.1`, is when the NVDA API can introduce breaking changes.
3
7
4
-
In order to improve the NVDA API, changes that will break future compatibility can be implemented, as long they retain backwards compatibility until the `20XX.1` release.
8
+
## Deprecations
9
+
Where possible, ensure the NVDA API maintains backwards compatibility.
10
+
If no removal is required or proposed, backwards compatibility can be maintained via the following snippet:
11
+
12
+
```py
13
+
import globalVars
14
+
def__getattr__(attrName: str) -> Any:
15
+
"""Module level `__getattr__` used to preserve backward compatibility."""
16
+
if attrName =="deprecatedSymbolName"and globalVars._allowDeprecatedAPI:
17
+
# Note: this should only log in situations where it will not be excessively noisy.
18
+
log.warning(
19
+
"Importing deprecatedSymbolName from here is deprecated. "
20
+
"Import X instead and do Y. "
21
+
)
22
+
# Ensure the API of deprecatedSymbolNameReplacement is the same as the deprecated symbol.
23
+
return deprecatedSymbolNameReplacement
24
+
raiseAttributeError(f"module {repr(__name__)} has no attribute {repr(attrName)}")
25
+
```
26
+
27
+
28
+
## Required API breaking changes
29
+
In order to improve the NVDA API, changes that will break future compatibility may be implemented, as long they retain backwards compatibility until the `20XX.1` release.
5
30
6
31
This can be done by using a version check to automate deprecation. For example, if you wish to replace usages of `foo` with `bar`. When we begin work on `NEXT_YEAR`, `foo` will no longer be part of the NVDA API and all internal usages must be removed prior.
7
32
```python
8
33
from buildVersion import version_year
9
-
if version_year <NEXT_YEAR:
34
+
import globalVars
35
+
if version_year <NEXT_YEARand globalVars._allowDeprecatedAPI:
10
36
foo = bar
11
37
```
12
38
39
+
## Testing backwards compatibility
40
+
13
41
To ensure a module retains the same symbol names being importable, check across versions what is imported using the NVDA python console.
14
42
```python
15
43
import controlTypes
@@ -19,3 +47,7 @@ dir(controlTypes)
19
47
Changes different to moving or renaming symbols need to be considered carefully with a different approach.
20
48
21
49
Any API breaking changes such as deprecations marked for removal should be commented with the year of intended removal, and notes on how to implement the API change as an add-on developer and NVDA developer.
50
+
51
+
## Announcements
52
+
Deprecations should be announced via the [NVDA API mailing list](https://groups.google.com/a/nvaccess.org/g/nvda-api/about).
This guide provides information concerning NVDA development, including translation and the development of components for NVDA.
14
14
15
+
++ API stability ++[API]
16
+
The NVDA API only includes symbols which are not marked with prefixing underscores.
17
+
18
+
The NVDA Add-on API changes over time, such as removals, deprecations and new features.
19
+
Important changes to the API are announced on the [NVDA API mailing list https://groups.google.com/a/nvaccess.org/g/nvda-api/about].
20
+
Changes relevant to developers are also announced via the [NVDA changes file](https://www.nvaccess.org/files/nvda/documentation/changes.html).
21
+
Any changes to the API policy outlined in this section will be conveyed via these two channels.
22
+
23
+
API breaking releases happen at most once per year, these are ``.1`` releases, e.g. ``2022.1``.
24
+
The API remains backwards compatible between breaking releases.
25
+
API breaking changes should be considered relatively stable in the first beta: e.g. ``2022.1.beta1``.
26
+
27
+
API features may become deprecated over time.
28
+
Deprecated API features may have a scheduled removal date, a future breaking release (e.g. ``2022.1``).
29
+
Deprecations may also have no scheduled removal date, and will remain supported until it is no longer reasonable.
30
+
Note, the roadmap for removals is 'best effort' and may be subject to change.
31
+
Please open a GitHub issue if these changes stop the API from meeting your needs.
32
+
15
33
++ A Note About Python ++
16
34
NVDA and its components are primarily written in the Python programming language.
17
35
It is not the goal of this guide to teach you Python, though examples are provided through out this guide which will help to familiarise you with the Python syntax.
Copy file name to clipboardExpand all lines: user_docs/en/changes.t2t
+4-6Lines changed: 4 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -40,15 +40,13 @@ What's New in NVDA
40
40
41
41
42
42
== Changes for Developers ==
43
+
Please refer to [the developer guide https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#API] for information on NVDA's API deprecation and removal process.
44
+
45
+
- The [NVDA API Announcement mailing list https://groups.google.com/a/nvaccess.org/g/nvda-api/about] was created. (#13999)
46
+
-
43
47
44
48
45
49
=== Deprecations ===
46
-
These are proposed API breaking changes.
47
-
The deprecated part of the API will continue to be available until the specified release.
48
-
If no release is specified, the plan for removal has not been determined.
49
-
Note, the roadmap for removals is 'best effort' and may be subject to change.
50
-
Please test the new API and provide feedback.
51
-
For add-on authors, please open a GitHub issue if these changes stop the API from meeting your needs.
0 commit comments