Modernize project structure to current Python packaging standards#37
Merged
Modernize project structure to current Python packaging standards#37
Conversation
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>
976d7b4 to
b3d57b6
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__version__now fromimportlib.metadata), remove duplicateCellEntryimport, updatesetuptoolsconstraint to>=70, unpinmatplotlib, lowercaserequests, moveopencv-python/raytracingto optional extrasrequires-python = ">=3.11", fix PyPI classifiers, add[project.urls], replaceos.system()withsubprocess.run()in__main__.py, wrap CLI inmain(), add GitHub Actions CI (Ubuntu/macOS/Windows × Python 3.11–3.13), addruffandpytestconfig__init__.py, add__all__to define the public API, replace wildcard import in__main__.pywith explicitfrom mytk import Bindable, removesys.pathhacks from tests and docs, switch Sphinx theme fromsphinx_rtd_themetofuroTest plan
pip install -e .installs cleanly with updatedsetuptoolsand unpinned depspip install -e ".[video]"andpip install -e ".[optics]"install optional depspython -m mytk -llists examples correctlypython -m mytk -truns tests viasubprocess.runwith correct exit codepython -m mytk -cprints Graphviz class hierarchyfrom mytk import *only exports names listed in__all__mytk.__version__returns"0.9.15"(from package metadata)🤖 Generated with Claude Code