Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
be89320
Update Ruff and simplify configs
Avasam Nov 9, 2025
e231f97
Replace pycln with F401+allowed-unused-imports
Avasam Nov 9, 2025
a12a77d
Delete uv.lock
Avasam Nov 9, 2025
ed35396
Merge branch 'main' of https://github.com/mhammond/pywin32 into Updat…
Avasam Nov 26, 2025
7b4a46a
Update adodbapi/apibase.py
Avasam Nov 26, 2025
644dc81
Merge branch 'main' into Update-Ruff-and-simplify-configs
Avasam Dec 9, 2025
478b473
Discard changes to adodbapi/apibase.py
Avasam Dec 9, 2025
44a5453
Discard changes to adodbapi/adodbapi.py
Avasam Dec 9, 2025
8dd978d
Re-enable C4 on adodbapi
Avasam Dec 9, 2025
5a340b0
Merge branch 'Update-Ruff-and-simplify-configs' of https://github.com…
Avasam Dec 9, 2025
4645566
post-merge re-update ruff
Avasam Dec 9, 2025
616c225
Run Ruff on more file extensions
Avasam Dec 10, 2025
806665d
Update `Pythonwin/start_pythonwin.pyw`
Avasam Dec 10, 2025
eb7318e
Merge branch 'Run-Ruff-on-more-file-extensions' of https://github.com…
Avasam Dec 10, 2025
65549f9
Merge branch 'main' of https://github.com/mhammond/pywin32 into Updat…
Avasam Dec 18, 2025
d29c159
Add noqa in a pys script
Avasam Dec 18, 2025
3631260
Set git line endings for pys pyw
Avasam Dec 18, 2025
0e63fb8
Add lint.future-annotations = true
Avasam Dec 20, 2025
9b06c81
Merge branch 'main' of https://github.com/mhammond/pywin32 into Updat…
Avasam Feb 5, 2026
c52c2c5
Bump Ruff to 0.15
Avasam Feb 5, 2026
afa70ac
Update .pre-commit-config.yaml
Avasam Feb 5, 2026
7fcf8d8
forgot a file
Avasam Feb 5, 2026
c828c98
Merge branch 'Update-Ruff-and-simplify-configs' of https://github.com…
Avasam Feb 5, 2026
766edd9
Renormalize pyproject.toml
Avasam Feb 12, 2026
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ AutoDuck/*.fmt text eol=crlf
*.dsp text eol=crlf
*.dsw text eol=crlf
*.py text eol=crlf
*.pyw text eol=crlf
*.pys text eol=crlf

# Files that can't be in UTF-8 encoding
com/TestSources/PyCOMTest/PyCOMTest.idl working-tree-encoding=latin1
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For all bugs, please provide the following information:
3. ...

```python

```

## System information
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ jobs:
- run: uv pip install --group=checkers

# !cancelled(): Show issues even if the previous steps failed. But still fail the job
- run: pycln . --config=pycln.toml --check

- name: Run Ruff linter
uses: astral-sh/ruff-action@v3
if: ${{ !cancelled() }}
Expand Down
8 changes: 1 addition & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ repos:
args: [--autofix, --indent, "2", --offset, "2", --preserve-quotes]
- id: pretty-format-ini
args: [--autofix]
- repo: https://github.com/hadialqattan/pycln
rev: v2.4.0
hooks:
- id: pycln
args: [--config=pycln.toml]
verbose: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.0
rev: v0.15.0
hooks:
- id: ruff # Run the linter.
args: [--fix]
Expand Down
6 changes: 3 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ Build 300, released 2020-11-14
(ie, not when normal params were passed) For example:

```python
arg1 = VARIANT(pythoncom.VT_R4 | pythoncom.VT_BYREF, 2.0)
arg2 = VARIANT(pythoncom.VT_BOOL | pythoncom.VT_BYREF, True)
object.SomeFunction(arg1, arg2)
arg1 = VARIANT(pythoncom.VT_R4 | pythoncom.VT_BYREF, 2.0)
arg2 = VARIANT(pythoncom.VT_BOOL | pythoncom.VT_BYREF, True)
object.SomeFunction(arg1, arg2)
```

after this call, `arg1.value` was actually the value for `arg2`, and
Expand Down
5 changes: 2 additions & 3 deletions Pythonwin/pywin/Demos/openGLDemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ def OnSize(self, params):
self.oldrect = self.oldrect[0], self.oldrect[1], cx, cy

def OnInitialUpdate(self):
self.SetScaleToFitSize(
(100, 100)
) # or SetScrollSizes() - A Pythonwin requirement
self.SetScaleToFitSize((100, 100))
# or SetScrollSizes() - A Pythonwin requirement
return self._obj_.OnInitialUpdate()

# return rc
Expand Down
97 changes: 53 additions & 44 deletions Pythonwin/pywin/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The format of this file is very similar to a Windows INI file.
# Sections are identified with [Section] lines, but comments
# use the standatd Python # character. Depending on the section,
# use the standard Python # character. Depending on the section,
# lines may not be in the standard "key=value" format.

# NOTE: You should not need to modify this file.
Expand Down Expand Up @@ -47,9 +47,9 @@ Ctrl+Shift+F = ViewFixedFont

# Auto-complete, call-tips, etc.
Alt+/ = <<expand-word>>
Ctrl+Space = <<expand-word>>
( = <<paren-open>>
) = <<paren-close>>
Ctrl+Space = <<expand-word>>
( = <<paren-open>>
) = <<paren-close>>
Up = <<check-calltip-cancel>>
Down = <<check-calltip-cancel>>
Left = <<check-calltip-cancel>>
Expand Down Expand Up @@ -134,53 +134,59 @@ Ctrl+Shift+Tab = MDIPrev

# Add a simple file/class/function simple banner
def AddBanner(editor_window, event):
text = editor_window.text
big_line = "#" * 70
banner = "%s\n## \n## \n## \n%s\n" % (big_line, big_line)

text = editor_window.text
big_line = "#" * 70
banner = "%s\n## \n## \n## \n%s\n" % (big_line, big_line)
# Insert at the start of the current line.
pos = text.index("insert linestart")

# Insert at the start of the current line.
pos = text.index("insert linestart")
text.undo_block_start() # Allow action to be undone as a single unit.
text.insert(pos, banner)
text.undo_block_stop()

text.undo_block_start() # Allow action to be undone as a single unit.
text.insert(pos, banner)
text.undo_block_stop()

# Now set the insert point to the middle of the banner.
line, col = [int(s) for s in pos.split(".")]
text.mark_set("insert", "%d.1 lineend" % (line+2, ) )
# Now set the insert point to the middle of the banner.
line, col = [int(s) for s in pos.split(".")]
text.mark_set("insert", "%d.1 lineend" % (line + 2,))


# Here is a sample event bound to the "Home" key in the
# interactive window
def InteractiveHome(editor_window, event):
return _DoInteractiveHome(editor_window.text, 0)
return _DoInteractiveHome(editor_window.text, 0)


def InteractiveHomeExtend(editor_window, event):
return _DoInteractiveHome(editor_window.text, 1)
return _DoInteractiveHome(editor_window.text, 1)


def _DoInteractiveHome(text, extend):
import sys
# If Scintilla has an autocomplete window open, then let Scintilla handle it.
if text.edit.SCIAutoCActive():
return 1
of_interest = "insert linestart + %d c" % len(sys.ps1)
if not text.compare("insert", "==", of_interest) and \
text.get("insert linestart", of_interest) in [sys.ps1, sys.ps2]: # Not sys.ps? line
end = of_interest
else:
end = "insert linestart"

if extend: start = "insert"
else: start = end
text.tag_add("sel", start, end)
import sys

# If Scintilla has an autocomplete window open, then let Scintilla handle it.
if text.edit.SCIAutoCActive():
return 1
of_interest = "insert linestart + %d c" % len(sys.ps1)
if not text.compare("insert", "==", of_interest) and text.get(
"insert linestart", of_interest
) in [sys.ps1, sys.ps2]:
# Not sys.ps? line
end = of_interest
else:
end = "insert linestart"

if extend:
start = "insert"
else:
start = end
text.tag_add("sel", start, end)


# From Niki Spahie
def AutoFindNext(editor_window, event):
"find selected text or word under cursor"
"""find selected text or word under cursor"""

from pywin.scintilla import find
from pywin.scintilla import scintillacon
from pywin.scintilla import find, scintillacon

try:
sci = editor_window.edit
Expand All @@ -189,26 +195,29 @@ def AutoFindNext(editor_window, event):
find.lastSearch.findText = word
find.lastSearch.sel = sci.GetSel()
else:
pos = sci.SendScintilla( scintillacon.SCI_GETCURRENTPOS )
start = sci.SendScintilla( scintillacon.SCI_WORDSTARTPOSITION, pos, 1 )
end = sci.SendScintilla( scintillacon.SCI_WORDENDPOSITION, pos, 1 )
word = sci.GetTextRange( start, end )
pos = sci.SendScintilla(scintillacon.SCI_GETCURRENTPOS)
start = sci.SendScintilla(scintillacon.SCI_WORDSTARTPOSITION, pos, 1)
end = sci.SendScintilla(scintillacon.SCI_WORDENDPOSITION, pos, 1)
word = sci.GetTextRange(start, end)
if word:
find.lastSearch.findText = word
find.lastSearch.sel = (start,end)
find.lastSearch.sel = (start, end)
except Exception:
import traceback

traceback.print_exc()
find.FindNext()


# A couple of generic events.
def Beep(editor_window, event):
editor_window.text.beep()
editor_window.text.beep()


def DoNothing(editor_window, event):
pass
pass


def ContinueEvent(editor_window, event):
# Almost an "unbind" - allows Pythonwin/MFC to handle the keystroke
return 1
# Almost an "unbind" - allows Pythonwin/MFC to handle the keystroke
return 1
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ def SetEditorFontOption(option, newValue):
SetEditorOption(option, str(newValue))


from pywin.framework.editor.color.coloreditor import ( # nopycln: import
from pywin.framework.editor.color.coloreditor import (
editorTemplate as editorTemplate, # Adds doc template & Re-export
)
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pywin.framework.app
import pywin.scintilla.control
import pywin.scintilla.formatter
import pywin.scintilla.IDLEenvironment # nopycln: import # Injects fast_readline into the IDLE auto-indent extension
import pywin.scintilla.IDLEenvironment # Injects fast_readline into the IDLE auto-indent extension
import win32api
import win32clipboard
import win32con
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/intpydde.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import traceback

import win32ui
from dde import ( # nopycln: import # Re-exported for intpyapp.py
from dde import ( # PLC0414: Re-exported for intpyapp.py
CBF_FAIL_SELFCONNECTIONS as CBF_FAIL_SELFCONNECTIONS, # noqa: PLC0414
CreateConversation as CreateConversation, # noqa: PLC0414
CreateServer,
Expand Down
5 changes: 3 additions & 2 deletions Pythonwin/pywin/scintilla/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
import win32con
import win32ui

from . import ( # nopycln: import # Injects fast_readline into the IDLE auto-indent extension
IDLEenvironment,
from . import (
# https://github.com/astral-sh/ruff/issues/15705
IDLEenvironment, # noqa: F401 # Injects fast_readline into the IDLE auto-indent extension
Comment on lines +9 to +11
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

astral-sh/ruff#15705
This was also already affecting pycln

)

HANDLER_ARGS_GUESS = 0
Expand Down
9 changes: 4 additions & 5 deletions Pythonwin/pywin/scintilla/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pywin.mfc import afxres, docview

from . import (
IDLEenvironment, # nopycln: import # Injects fast_readline into the IDLE auto-indent extension
IDLEenvironment, # Injects fast_readline into the IDLE auto-indent extension
bindings,
control,
scintillacon,
Expand Down Expand Up @@ -187,14 +187,13 @@ def GetTabWidth(self):
def HookHandlers(self):
# Create events for all the menu names.
for name, val in event_commands:
# handler = lambda id, code, tosend=val, parent=parent: parent.OnCommand(tosend, 0) and 0
# handler = lambda id, code, tosend=val, parent=parent: parent.OnCommand(tosend, 0) and 0
self.bindings.bind(name, None, cid=val)

# Hook commands that do nothing other than send Scintilla messages.
for command, reflection in command_reflectors:
handler = (
lambda id, code, ss=self.SendScintilla, tosend=reflection: ss(tosend)
and 0
handler = lambda id, code, ss=self.SendScintilla, tosend=reflection: (
ss(tosend) and 0
)
self.HookCommand(handler, command)

Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/test/test_pywin.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def OnPaint(self):

w = PaintWnd()
w.Create("Test Paint MDI Child")
self.addCleanup(lambda: (o.cnt_ondestroy or w.DestroyWindow()))
self.addCleanup(lambda: o.cnt_ondestroy or w.DestroyWindow())
win32gui.PumpWaitingMessages()
dc = w.GetDC()
self.assertGreater(
Expand Down Expand Up @@ -379,7 +379,7 @@ def test_ia(self):
def test_docedit(self):
import tempfile

import pywin.scintilla.IDLEenvironment # nopycln: import # Injects fast_readline into the IDLE auto-indent extension
import pywin.scintilla.IDLEenvironment # Injects fast_readline into the IDLE auto-indent extension

##doc = pywin.framework.editor.editorTemplate.OpenDocumentFile(None)
def t_print(*args):
Expand Down
8 changes: 3 additions & 5 deletions Pythonwin/start_pythonwin.pyw
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# A Python file that can be used to start Pythonwin, instead of using
# pythonwin.exe
"""A Python file that can be used to start Pythonwin, instead of using pythonwin.exe"""

import os
import sys

import pywin.framework.intpyapp # noqa: F401 # InteractivePythonApp()
import win32ui

import pywin.framework.intpyapp # InteractivePythonApp()

assert pywin.framework.intpyapp # not unused
# Pretend this script doesn't exist, or pythonwin tries to edit it
sys.argv[:] = sys.argv[1:] or [""] # like PySys_SetArgv(Ex)
if sys.path[0] not in ("", ".", os.getcwd()):
Expand Down
1 change: 0 additions & 1 deletion adodbapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# nopycln: file # undecidable cases due to explicit re-exports https://github.com/hadialqattan/pycln/issues/205
"""adodbapi - A python DB API 2.0 (PEP 249) interface to Microsoft ADO

Copyright (C) 2002 Henrik Ekelund, version 2.1 by Vernon Cole
Expand Down
Loading
Loading