Skip to content

Commit dd51e67

Browse files
authored
Merge pull request #8 from richardkoehler/feat/cleanup-config
Cleanup project configuration
2 parents a35f685 + 9f43e57 commit dd51e67

53 files changed

Lines changed: 1400 additions & 1589 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.15.9
4+
hooks:
5+
- id: ruff-check
6+
args: ["--fix", "--exclude", "tests"]

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11.5
1+
3.11.15

pyproject.toml

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[project]
22
name = "clinical-dbs-annotator"
3-
version = "0.1.0"
4-
description = "A PyQt5-based tool for annotating DBS clinical programming sessions"
3+
description = "A graphical user interface for annotating DBS clinical programming sessions"
54
readme = "README.md"
6-
requires-python = ">=3.11"
5+
requires-python = ">=3.11,<3.14"
76
authors = [
87
{ name = "Lucia Poma", email = "lpoma@mgh.harvard.edu" }
98
]
109
keywords = ["dbs", "clinical", "annotation", "neuroscience", "deep-brain-stimulation"]
10+
dynamic = ["version"]
1111
classifiers = [
1212
"Development Status :: 4 - Beta",
1313
"Intended Audience :: Healthcare Industry",
@@ -16,14 +16,14 @@ classifiers = [
1616
"Programming Language :: Python :: 3",
1717
"Programming Language :: Python :: 3.11",
1818
"Programming Language :: Python :: 3.12",
19+
"Programming Language :: Python :: 3.13",
1920
"License :: OSI Approved :: MIT License",
2021
"Environment :: X11 Applications :: Qt",
2122
"Operating System :: OS Independent",
2223
]
23-
2424
dependencies = [
25-
"pyqt5==5.15.10",
26-
"pyqt5-qt5==5.15.2",
25+
"pyqt5",
26+
"pyqt5-qt5<=5.15.2",
2727
"pytz>=2025.2",
2828
"pandas>=2.1",
2929
"python-docx>=1.1",
@@ -32,12 +32,11 @@ dependencies = [
3232
"pyqtgraph>=0.14.0",
3333
]
3434

35-
[project.optional-dependencies]
35+
[dependency-groups]
3636
dev = [
3737
"pytest>=8.0.0",
3838
"pytest-qt>=4.4.0",
3939
"pytest-cov>=4.1.0",
40-
"black>=24.0.0",
4140
"ruff>=0.1.0",
4241
# "mypy>=1.8.0",
4342
"pre-commit>=3.6",
@@ -47,7 +46,10 @@ build = [
4746
"opencv-python-headless>=4.12.0.88",
4847
"nuitka>=4.0.7",
4948
]
50-
docs = ["sphinx", "sphinx-rtd-theme"]
49+
docs = [
50+
"sphinx",
51+
"sphinx-rtd-theme",
52+
]
5153

5254
[project.scripts]
5355
clinical-dbs-annotator = "clinical_dbs_annotator.__main__:main"
@@ -61,6 +63,9 @@ Documentation = "https://github.com/bml/clinical-dbs-annotator/blob/main/README.
6163
requires = ["hatchling"]
6264
build-backend = "hatchling.build"
6365

66+
[tool.hatch.version]
67+
path = "src/clinical_dbs_annotator/__init__.py"
68+
6469
[tool.hatch.build.targets.wheel]
6570
packages = ["src/clinical_dbs_annotator"]
6671

@@ -76,25 +81,19 @@ addopts = [
7681
"--cov-report=term-missing",
7782
]
7883

79-
[tool.black]
80-
line-length = 88
81-
target-version = ["py311"]
82-
include = '\.pyi?$'
83-
extend-exclude = '''
84-
/(
85-
# directories
86-
\.eggs
87-
| \.git
88-
| \.hatch
89-
| \.venv
90-
| build
91-
| dist
92-
)/
93-
'''
94-
9584
[tool.ruff]
9685
line-length = 88
9786
target-version = "py311"
87+
extend-exclude = [
88+
".eggs",
89+
".git",
90+
".hatch",
91+
".venv",
92+
"build",
93+
"dist",
94+
]
95+
96+
[tool.ruff.lint]
9897
select = [
9998
"E", # pycodestyle errors
10099
"W", # pycodestyle warnings
@@ -106,7 +105,7 @@ select = [
106105
"C4", # flake8-comprehensions
107106
]
108107
ignore = [
109-
"E501", # line too long (handled by black)
108+
"E501", # line too long (handled by formatter/line-length)
110109
]
111110

112111
[tool.mypy]
@@ -125,8 +124,3 @@ strict_optional = true
125124
[[tool.mypy.overrides]]
126125
module = "PyQt5.*"
127126
ignore_missing_imports = true
128-
129-
[dependency-groups]
130-
dev = [
131-
"pyinstaller>=6.15.0",
132-
]

run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"""
1010

1111
import sys
12+
1213
from clinical_dbs_annotator.__main__ import main
1314

1415
if __name__ == "__main__":

scripts/build_macos.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
This script builds a standalone macOS .app bundle with all necessary resources.
55
"""
66

7+
import argparse
8+
import shutil
79
import subprocess
810
import sys
911
from pathlib import Path
10-
import argparse
11-
import shutil
1212

1313
# Get project root directory
1414
PROJECT_ROOT = Path(__file__).parent.parent
@@ -113,7 +113,7 @@ def build_macos_app(*, console: bool, onefile: bool):
113113
# Run PyInstaller
114114
try:
115115
subprocess.run(cmd, check=True, cwd=PROJECT_ROOT)
116-
print(f"\n✓ Build successful!")
116+
print("\n✓ Build successful!")
117117
if onefile:
118118
artifact_path = DIST_DIR / f"{name}.app"
119119
print(f" Expected app bundle: {artifact_path}")

scripts/build_quick.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ def run_command(cmd, cwd=None):
3838
# Nuitka: onefile, no console
3939
cmd = [sys.executable, "scripts/build_windows_nuitka.py", "--onefile"]
4040
run_command(cmd, cwd=PROJECT_ROOT)
41-
41+
4242
elif target == "windows-debug":
4343
# Nuitka: onedir, with console
4444
cmd = [sys.executable, "scripts/build_windows_nuitka.py", "--console"]
4545
run_command(cmd, cwd=PROJECT_ROOT)
46-
46+
4747
elif target == "windows-pyinstaller":
4848
# Fallback to PyInstaller
4949
cmd = [sys.executable, "scripts/build_windows.py"]
5050
run_command(cmd, cwd=PROJECT_ROOT)
51-
51+
5252
else:
5353
print(f"Unknown target: {target}")
5454
sys.exit(1)

scripts/build_windows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
This script builds a standalone Windows executable with all necessary resources.
55
"""
66

7+
import argparse
78
import subprocess
89
import sys
910
from pathlib import Path
10-
import argparse
1111

1212
# Get project root directory
1313
PROJECT_ROOT = Path(__file__).parent.parent
@@ -76,7 +76,7 @@ def build_windows_exe(*, console: bool, onefile: bool) -> bool:
7676
# Run PyInstaller
7777
try:
7878
subprocess.run(cmd, check=True, cwd=PROJECT_ROOT)
79-
print(f"\n✓ Build successful!")
79+
print("\n✓ Build successful!")
8080
if onefile:
8181
exe_path = DIST_DIR / f"{name}.exe"
8282
else:

scripts/build_windows_nuitka.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"""
1515

1616
import argparse
17-
import os
1817
import sys
1918
from pathlib import Path
2019

@@ -143,19 +142,19 @@ def build_nuitka(console: bool = False, onefile: bool = False) -> None:
143142
import subprocess
144143
result = subprocess.run(cmd, check=True, cwd=PROJECT_ROOT)
145144
print("\n✅ Build completed successfully!")
146-
145+
147146
# Show output location
148147
if onefile:
149148
exe_path = DIST_DIR / f"{NAME}.exe"
150149
else:
151150
exe_path = DIST_DIR / f"{NAME}.dist" / f"{NAME}.exe"
152-
151+
153152
if exe_path.exists():
154153
print(f"📦 Executable: {exe_path}")
155154
print(f"📊 Size: {exe_path.stat().st_size / (1024*1024):.1f} MB")
156155
else:
157156
print("⚠️ Executable not found at expected location")
158-
157+
159158
except subprocess.CalledProcessError as e:
160159
print(f"\n❌ Build failed with exit code {e.returncode}")
161160
sys.exit(1)
@@ -166,16 +165,16 @@ def build_nuitka(console: bool = False, onefile: bool = False) -> None:
166165
# -------------------------------------------------------------------------
167166
if __name__ == "__main__":
168167
parser = argparse.ArgumentParser(description="Build Windows executable with Nuitka")
169-
parser.add_argument("--console", action="store_true",
168+
parser.add_argument("--console", action="store_true",
170169
help="Include console window (useful for debugging)")
171-
parser.add_argument("--onefile", action="store_true",
170+
parser.add_argument("--onefile", action="store_true",
172171
help="Create single .exe file (default: directory bundle)")
173-
172+
174173
args = parser.parse_args()
175-
174+
176175
print("=== Clinical DBS Annotator Nuitka Build ===")
177176
print(f"Console: {'Yes' if args.console else 'No'}")
178177
print(f"Onefile: {'Yes' if args.onefile else 'No'}")
179178
print()
180-
179+
181180
build_nuitka(console=args.console, onefile=args.onefile)

src/clinical_dbs_annotator/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""
22
Clinical DBS Annotator - A tool for annotating DBS clinical programming sessions.
33
4-
This package provides a PyQt5-based GUI application for recording and managing
4+
This package provides a GUI for recording and managing
55
clinical data during Deep Brain Stimulation programming sessions.
66
"""
77

8-
__version__ = "0.3_testing"
8+
__version__ = "0.3.0-beta"
99
__app_name__ = "Clinical DBS Annotator"
1010
__author__ = "BML"
1111

src/clinical_dbs_annotator/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
and main window creation.
66
"""
77

8-
import sys
9-
import traceback
108
import os
9+
import sys
1110
import tempfile
11+
import traceback
1212

1313
from PyQt5.QtCore import Qt
1414
from PyQt5.QtWidgets import QApplication
@@ -57,8 +57,8 @@ def main() -> int:
5757

5858
# Run application
5959
return app.exec_()
60-
61-
except Exception as e:
60+
61+
except Exception:
6262
print("FATAL ERROR:")
6363
traceback.print_exc()
6464
try:

0 commit comments

Comments
 (0)