Skip to content

Modernize project structure to current Python packaging standards#37

Merged
dccote merged 8 commits intomainfrom
claude-project-fix
Feb 23, 2026
Merged

Modernize project structure to current Python packaging standards#37
dccote merged 8 commits intomainfrom
claude-project-fix

Conversation

@dccote
Copy link
Copy Markdown
Contributor

@dccote dccote commented Feb 23, 2026

Summary

  • High priority: Fix version mismatch (__version__ now from importlib.metadata), remove duplicate CellEntry import, update setuptools constraint to >=70, unpin matplotlib, lowercase requests, move opencv-python/raytracing to optional extras
  • Medium priority: Add requires-python = ">=3.11", fix PyPI classifiers, add [project.urls], replace os.system() with subprocess.run() in __main__.py, wrap CLI in main(), add GitHub Actions CI (Ubuntu/macOS/Windows × Python 3.11–3.13), add ruff and pytest config
  • Low priority: Remove vestigial stdlib re-exports from __init__.py, add __all__ to define the public API, replace wildcard import in __main__.py with explicit from mytk import Bindable, remove sys.path hacks from tests and docs, switch Sphinx theme from sphinx_rtd_theme to furo

Test plan

  • pip install -e . installs cleanly with updated setuptools and unpinned deps
  • pip install -e ".[video]" and pip install -e ".[optics]" install optional deps
  • python -m mytk -l lists examples correctly
  • python -m mytk -t runs tests via subprocess.run with correct exit code
  • python -m mytk -c prints Graphviz class hierarchy
  • from mytk import * only exports names listed in __all__
  • mytk.__version__ returns "0.9.15" (from package metadata)

🤖 Generated with Claude Code

dccote and others added 5 commits February 23, 2026 09:47
High priority:
- Fix version mismatch: __version__ now read from importlib.metadata instead of hardcoded "0.9.12"
- Remove duplicate CellEntry import in __init__.py
- Update setuptools constraint from <69 to >=70
- Unpin matplotlib (==3.9.2 → >=3.9), lowercase requests, remove opencv-python and raytracing from core deps
- Add [project.optional-dependencies]: video (opencv-python), optics (raytracing)

Medium priority:
- Add requires-python = ">=3.11" (StrEnum requires 3.11+)
- Fix classifiers: remove wrong Build Tools topic, add Science/Research, correct Environment and License entries
- Add [project.urls] (Homepage, Repository, Bug Tracker)
- Replace os.system() with subprocess.run(cwd=) in __main__.py; wrap CLI logic in main()
- Add GitHub Actions CI workflow (Ubuntu/macOS/Windows × Python 3.11–3.13)
- Add [tool.ruff] and [tool.pytest.ini_options] to pyproject.toml

Low priority:
- Remove vestigial stdlib re-exports from __init__.py (partial, platform, time, signal, etc.)
- Add __all__ to __init__.py to define the explicit public API
- Replace wildcard import in __main__.py with explicit `from mytk import Bindable`
- Remove sys.path hack from mytk/tests/envtest.py (replaced by editable install)
- Remove sys.path hack from docs/source/conf.py; switch theme to furo
- Add docs optional dependency (furo, sphinx)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unused `timeout = 1000` variable in envtest.setUp()
- Replace hardcoded absolute path assertion in testImages with
  exists()/is_dir() checks on self.resource_directory
- Guard `import cv2` in videoview.py with try/except so the package
  imports cleanly when opencv-python is not installed (optional dep)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
auto_click was commented out in test_custom_window, causing diag.run()
to block indefinitely waiting for a manual button click. Restored
auto_click as a tuple with a 100ms timeout, consistent with the other
dialog tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove __all__ from __init__.py so that `from mytk import *` continues
  to re-export all tkinter names (IntVar, StringVar, etc.) as intended by
  the existing `from tkinter import *` statement.  Adding __all__ had
  silently blocked those names, breaking 17 tests with NameError.
- Add explicit `from functools import partial` to testMyApp.py; partial
  was previously available only via a vestigial re-export that we removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assigning StringVar() after the two-way binding was established caused
self.value to be overwritten by the StringVar's empty default. Initialize
StringVar with the provided value instead to prevent this.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dccote dccote force-pushed the claude-project-fix branch from 976d7b4 to b3d57b6 Compare February 23, 2026 16:13
dccote and others added 3 commits February 23, 2026 12:07
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Passing a copy of scheduled_tasks prevents after_cancel from
corrupting the iteration when it removes items from the same list,
which was silently leaving half the tasks uncancelled and causing
'invalid command name' Tcl errors after widget destruction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dccote dccote merged commit 3968ecf into main Feb 23, 2026
@dccote dccote deleted the claude-project-fix branch February 23, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant