Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions check.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Small script to ensure quality checks pass before submitting a commit/PR.
#
$ErrorActionPreference = "Stop"

python -m ruff format docs src
python -m ruff check --fix --unsafe-fixes docs src

# "--platform win32" to not fail on ctypes.windll (it does not affect the overall check on other OSes)
python -m mypy --platform win32 src docs/source/examples
8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

import ctypes

# Monkey-patch PROT_READ into mmap if missing (Windows), so that we can
# import mss.linux.xshmgetimage while building the documentation.
import mmap

if not hasattr(mmap, "PROT_READ"):
mmap.PROT_READ = 1 # type:ignore[attr-defined]

import mss

# -- General configuration ------------------------------------------------
Expand Down Expand Up @@ -44,7 +51,6 @@
ctypes.WINFUNCTYPE = ctypes.CFUNCTYPE # type:ignore[attr-defined]
ctypes.WinError = lambda _code=None, _descr=None: OSError() # type:ignore[attr-defined]


# -- Options for HTML output ----------------------------------------------

html_theme = "shibuya"
Expand Down
3 changes: 2 additions & 1 deletion docs/source/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Code Quality
To ensure the code quality is correct enough::

$ python -m pip install -e '.[dev]'
$ ./check.sh
$ ./check.sh # Linux/macOS
$ .\check.ps1 # Windows (PowerShell)


Documentation
Expand Down