Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Python 3.13 support #1052

Merged
merged 2 commits into from
Jul 28, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
- "pypy-3.8"
- "pypy-3.9"
include:
Expand Down
1 change: 1 addition & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changelog

2024-xx-xx • `full history <https://github.com/gorakhargosh/watchdog/compare/v4.0.1...HEAD>`__

- Add support for Python 3.13 (`#1052 <https://github.com/gorakhargosh/watchdog/pull/1052>`__)
- [core] Run ``ruff``, apply several fixes (`#1033 <https://github.com/gorakhargosh/watchdog/pull/1033>`__)
- [fsevents] Add missing ``event_filter`` keyword-argument to ``FSEventsObserver.schedule()`` (`#1049 <https://github.com/gorakhargosh/watchdog/pull/1049>`__)
- Thanks to our beloved contributors: @BoboTiG
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
eventlet
eventlet; python_version < "3.13"
flaky
pytest
pytest-cov
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: C",
"Topic :: Software Development :: Libraries",
Expand Down
10 changes: 5 additions & 5 deletions src/watchdog/observers/read_directory_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class WindowsApiEmitter(EventEmitter):
def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT, event_filter=None):
super().__init__(event_queue, watch, timeout, event_filter)
self._lock = threading.Lock()
self._handle = None
self._whandle = None

def on_thread_start(self):
self._handle = get_directory_handle(self.watch.path)
self._whandle = get_directory_handle(self.watch.path)

if platform.python_implementation() == "PyPy":

Expand All @@ -62,11 +62,11 @@ def start(self):
sleep(0.01)

def on_thread_stop(self):
if self._handle:
close_directory_handle(self._handle)
if self._whandle:
close_directory_handle(self._whandle)

def _read_events(self):
return read_events(self._handle, self.watch.path, self.watch.is_recursive)
return read_events(self._whandle, self.watch.path, self.watch.is_recursive)

def queue_events(self, timeout):
winapi_events = self._read_events()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_observers_winapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_root_deleted(event_queue, emitter):
File "watchdog\observers\read_directory_changes.py", line 76, in queue_events
winapi_events = self._read_events()
File "watchdog\observers\read_directory_changes.py", line 73, in _read_events
return read_events(self._handle, self.watch.path, self.watch.is_recursive)
return read_events(self._whandle, self.watch.path, self.watch.is_recursive)
File "watchdog\observers\winapi.py", line 387, in read_events
buf, nbytes = read_directory_changes(handle, path, recursive)
File "watchdog\observers\winapi.py", line 340, in read_directory_changes
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py3{8,9,10,11,12}
py3{8,9,10,11,12,13}
pypy3
docs
types
Expand Down
Loading