Modernize codebase to Python 3.13+ and updated libraries#1
Modernize codebase to Python 3.13+ and updated libraries#1
Conversation
…aries - Restructured project to use standard `src` layout with `pyproject.toml`. - Migrated from Python 2 to Python 3. - Updated `SQLAlchemy` to 2.0 (Declarative Base). - Updated `Twisted` (replaced deprecated `getPage` with `Agent`). - Updated `desktopSLED` for `wxPython` Phoenix compatibility. - Migrated tests to `pytest` and fixed reactor state handling. - Added `tox` and GitHub Actions CI configuration. - Applied `ruff` formatting and linting. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…aries - Restructured project to use standard `src` layout with `pyproject.toml`. - Migrated from Python 2 to Python 3. - Updated `SQLAlchemy` to 2.0 (Declarative Base). - Updated `Twisted` (replaced deprecated `getPage` with `Agent` and fixed encoding). - Updated `desktopSLED` for `wxPython` Phoenix compatibility. - Migrated tests to `pytest` and fixed reactor state handling. - Added `tox`, `ruff` (lint/format), and `pyright` (type check) configuration. - Added GitHub Actions CI workflow. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Fixed critical regression where `render_GET` returned `str` instead of `bytes` in Twisted Web resources. - Updated `src/orbLib/OaF.py` and `src/orbLib/SLOaf.py` to return encoded bytes. - Added comprehensive unit tests in `tests/test_OaF.py` and `tests/test_SLOaf.py` to verify correct rendering types. - Fixed `AttributeError` in `SLNotifier` tests. - Re-verified all tests pass and linting is clean. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Added `.github/copilot-instructions.md` with guidelines for Python 3.13, Twisted, and SQLAlchemy 2.0. - Cleaned up build artifacts (`__pycache__`, `egg-info`). Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Added `mdformat` to `dev` dependencies in `pyproject.toml`. - Configured `tox` to run `mdformat` in `lint` environment and added `format` environment. - Updated CI workflow to check markdown formatting. - Formatted `README.md` and `.github/copilot-instructions.md`. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Fixed critical XSS vulnerability in `src/orbLib/OaF.py` by escaping user input in HTML generation. - Fixed potential `UnboundLocalError` in `src/orbLib/SerialIndy.py` by initializing global variables. - Cleaned up minor code style issues. - Updated tests to match corrected behavior. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Created `docs/user_guide.md` covering core concepts, installation, and usage. - Created `docs/developer_guide.md` covering architecture, setup, and extending the framework. - Linked new documentation from `README.md`. - Updated `mdformat` configuration in `pyproject.toml` and CI to cover the `docs/` directory. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
There was a problem hiding this comment.
.pyc files are not normally committed, what is this here?
There was a problem hiding this comment.
You're absolutely right, my mistake. I have removed the .pyc and __pycache__ directories from version control and added a .gitignore file to prevent this in the future.
There was a problem hiding this comment.
Is egg-info needed with modern python packaging?
There was a problem hiding this comment.
Good catch. The .egg-info directory is an artifact generated during the local editable install (pip install -e .) or build process. It should not be committed to the repository. I have removed it from version control and added it to the new .gitignore.
- Added standard Python `.gitignore`. - Removed accidentally committed `__pycache__` and `*.egg-info` directories. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Updated `src/db/__init__.py` to remove deprecated `Session.query` usage in favor of `Session.get` and `Session.scalars`. - Refactored `get_page` in `src/orbLib/OaF.py` to use `async def` and `await` with `twisted.web.client.Agent`. - Replaced deprecated `xmlrpc.Proxy` in `src/orbLib/SLOaf.py` with `twisted.web.client.Agent` and standard `xmlrpc.client`, using `inlineCallbacks`. - Verified all tests and linters pass. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
.github/workflows/ci.yml
Outdated
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12"] |
There was a problem hiding this comment.
If we modernized to Python 3.13 shouldn't it be included as a test version?
There was a problem hiding this comment.
Good point. I have added Python 3.13 to the CI test matrix in .github/workflows/ci.yml and also added it to the tox environments in pyproject.toml.
- Added `3.13` to the GitHub Actions test matrix. - Added `py313` to `tox` environments. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Applied modernization (Python 3 conversions, Twisted async Agent, correct bytes handling for Twisted Web) to the newly merged files (`src/SLOaFService.py`, `src/orbLib/ambient.py`). - Updated `TestService.py` and `test_live.py` to be compatible with Python 3 and Twisted requirements. - Fixed `AttributeError` for `setState` in `TestService` by ensuring `Notifier` provides it or uses subclasses appropriately. - Re-formatted `README.md` per `mdformat`. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Configured `ruff` to allow Twisted's `camelCase` naming conventions by ignoring conflicting PEP 8 rules (`N802`, `N815`, etc.). - Updated `.github/copilot-instructions.md` to document the Twisted style preference. - Integrated `pytest-cov` and set a baseline `--cov-fail-under` in `pyproject.toml` to prevent test coverage from dropping. - Added `tests/test_db.py` to test SQLAlchemy 2.0 models and improve test coverage. - Addressed PR review feedback: Removed `tmp_oaf.py`, added `desktopSLED/__main__.py` for module execution, and refactored `MailOaf.py` protocols to use `async/await`. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Evaluated `mypy` vs `pyright`, deciding to keep `pyright` due to better handling of legacy imports and wxPython structure without extensive stubbing. - Adopted `MkDocs` with `mkdocs-material` for documentation generation. - Created `mkdocs.yml` and moved `README.md` content to `docs/index.md`. - Wrote `docs/tooling_evaluation.md` explaining the rationale behind choosing `ruff`, `pytest`, `tox`, `pyright`, and `MkDocs`. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Added `docs/twisted_async_evolution.md` explaining the transition from classic `Deferred` callbacks to modern Python `async`/`await` patterns within Twisted. - Included code examples contrasting old and new usage. - Added documentation to `mkdocs.yml` navigation. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Added `codespell` to dev dependencies and `tox` lint environment to enforce correct spelling in markdown files. - Fixed numerous typos in `README.md` and `docs/index.md` inherited from the original codebase (e.g., "depescendant" -> "descendant", "inferface" -> "interface"). Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
- Moved tox, pytest, ruff, and pyright configurations fully natively into `pyproject.toml`. - Replaced the legacy tox ini block with `tool.tox` PEP-621 format. - Ensure redundant standalone config files are non-existent. - Verified all configurations work correctly using `tox -e lint` and the test suite. Co-authored-by: Ciemaar <1388496+Ciemaar@users.noreply.github.com>
This PR modernizes the
orbLibcodebase to meet current Python standards (3.10-3.13). It includes a major restructuring of the project layout, updates to all core dependencies, and the introduction of modern development tooling.Key Changes:
src/directory and addedpyproject.tomlfor build and dependency management.Twistedinteractions) and updating standard library imports.mapper()style to modern Declarative 2.0 ORM.client.getPagewithtwisted.web.client.AgentandreadBody.desktopSLEDcode to useBind()instead of legacyEVT_*macros forwxPythonPhoenix compatibility.pytest. FixedDirtyReactorAggregateErrorin tests by properly stoppingLoopingCallinstances.toxconfiguration for local testing/linting and a GitHub Actions workflow.rufffor linting and formatting.Verification:
pytestpasses all tests.tox -e lintpasses.PR created automatically by Jules for task 5268991383469252729 started by @Ciemaar