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
* Unused imports should be removed where possible.
100
+
- Anything imported into a (sub)module can also be imported from that submodule.
101
+
- As a result, removing unused imports may break compatibility, and should be done in compatibility breaking releases (see `deprecations.md`).
102
+
* Unused imports will give a lint warning. These can be handled the following ways:
103
+
- If these imports are inteded to be imported from other modules, they can be done included in a definition for `__all__`. This will override and define the symbols imported when performing a star import, eg `from module import *`.
104
+
- Otherwise, with a comment like `# noqa: <explanation>`.
The NVDA API must maintain compatibility with add-ons throughout yearly development cycles.
2
+
The first release of a year, i.e. `20XX.1`, is when the NVDA API can introduce breaking changes.
3
+
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.
5
+
6
+
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
+
```python
8
+
from buildVersion import version_year
9
+
if version_year <NEXT_YEAR:
10
+
foo = bar
11
+
```
12
+
13
+
To ensure a module retains the same symbol names being importable, check across versions what is imported using the NVDA python console.
14
+
```python
15
+
import controlTypes
16
+
dir(controlTypes)
17
+
```
18
+
19
+
Changes different to moving or renaming symbols need to be considered carefully with a different approach.
20
+
21
+
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.
0 commit comments