note sys.platform requirements in contributing

This commit is contained in:
A_D committed 2022-01-26 18:51:50 +02:00
1 parent f160acfe57
commit 7bcf3a6f4d
1 file changed
+15
+15
View File
@@ -228,6 +228,7 @@ handy if you want to step through the testing code to be sure of anything.
Otherwise, see the [pytest documentation](https://docs.pytest.org/en/stable/contents.html).
---
## Debugging network sends
Rather than risk sending bad data to a remote service, even if only through
@@ -484,6 +485,20 @@ Please be verbose here, more info about weird choices is always prefered over ma
Additionally, if your hack is over around 5 lines, please include a `# HACK END` or similar comment to indicate the end of the hack.
# Use `sys.platform` for platform guards
`mypy` (and `pylance`) understand platform guards and will show unreachable code / resolve imports correctly
for platform specific things. However, this only works if you directly reference `sys.platform`, importantly
the following does not work:
```py
from sys import platform
if platform == 'darwin':
...
```
It **MUST** be `if sys.platform`.
---
## Build process