feat(2to3)!: update to Python 3 and HyLang 1.2.0#34
Conversation
Modernize project structure, build system, and toolchain - Migrate from setup.py/requirements.txt to pyproject.toml (PEP 621) - Migrate test suite from unittest to pytest and pytest-twiste d - Replace yapf with ruff for linting and formatting - Add mypy for static type checking and initial type annotations in MockSSH.py - Update Hy DSL and examples for compatibility with modern Hy versions - Add docs/wiki as a git submodule for project documentation - Overhaul Makefile to support virtual environments and the new toolchain - Implement pre-commit hooks for automated ruff and mypy checks
Introduces GitHub Actions workflows and Gemini CLI command configurations to automate issue triage, pull request reviews, and plan execution. Adds a GEMINI.md file to provide project-specific context for the AI agent. - Create workflows for dispatch, invoke, plan-execute, review, and triage. - Define Gemini command templates in .github/commands/. - Add GEMINI.md with project architecture and development conventions. - Update .gitignore to ignore .gemini/ directory and credentials.
There was a problem hiding this comment.
Code Review
This pull request modernizes the MockSSH library by migrating it to Python 3.12+, adopting pyproject.toml for build management, and replacing unittest with pytest. Key changes include the addition of type hints, updated SSH security configurations (ciphers/MACs), and a transition from pycrypto to the cryptography library for host key generation. Feedback highlights critical race conditions in command instantiation, invalid dependency version constraints in the project configuration, and the use of mutable default arguments. Additionally, improvements were suggested regarding error handling in library functions and the removal of debug print statements.
There was a problem hiding this comment.
Pull request overview
Modernizes MockSSH for a Python 3 / modern tooling workflow, including packaging, lint/type-check automation, updated Hy DSL support, and a pytest-based test suite.
Changes:
- Migrates packaging/build metadata to
pyproject.tomland updates development workflow (Makefile, pre-commit, Ruff/mypy). - Updates core MockSSH server implementation for Python 3, newer Twisted/Paramiko expectations, and new host key generation.
- Reworks tests and examples for pytest + updated Hy DSL/macros.
Reviewed changes
Copilot reviewed 19 out of 23 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_mock_hy.py |
Adds an end-to-end test that runs the Hy example server in a subprocess and validates SSH interaction. |
tests/test_mock_cisco.py |
Migrates Cisco example tests from unittest to pytest with fixtures and Paramiko interaction. |
tests/test_mock_F5.py |
Migrates F5 example tests from unittest to pytest with fixtures and Paramiko interaction. |
tests/conftest.py |
Introduces a session-scoped autouse fixture to run the Twisted reactor in a background thread. |
tests/__init__.py |
Test package marker (no functional changes). |
test_macros.hy |
Adds a Hy macro file at repo root (appears currently unreferenced). |
setup.py (removed) |
Removes legacy setuptools build script. |
requirements.txt (removed) |
Removes legacy requirements pin file. |
pyproject.toml |
Adds PEP 621-style project metadata, dependencies, and tool configuration (pytest/ruff/mypy). |
mocksshy/language.hy |
Updates Hy DSL macros to modern Hy syntax and updated MockSSH API expectations. |
mocksshy/kwzip.hy |
Updates Hy helper utilities (keyword detection, grouping logic) for modern Hy models. |
generated-keys/.gitkeep |
Ensures the default host-key directory exists in git. |
examples/mock_cisco.py |
Updates example code formatting/strings for Python 3 and current MockSSH API usage. |
examples/mock_F5.py |
Updates example code formatting/strings for Python 3 and current MockSSH API usage. |
examples/mock.hy |
Updates Hy example to use new require style and dict access patterns. |
README.md |
Updates installation/dev instructions, mentions pytest/pytest-twisted, and updates license/docs notes. |
MockSSH.py |
Major Python 3 update: typing, modern key generation, updated Twisted integration, threading helpers. |
Makefile |
Replaces yapf workflow with Ruff + mypy targets; updates build/test commands; adds key cleanup. |
.style.yapf (removed) |
Removes yapf config (replaced by Ruff). |
.pre-commit-config.yaml |
Adds pre-commit hooks for Ruff and mypy. |
.gitmodules |
Adds docs/wiki git submodule configuration. |
.gitignore |
Adds venv ignore entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Updates documentation and build configuration to support Gemini-powered automation and resolves testing warnings. Adds local pre-commit hooks to ensure build and test integrity. - Update GEMINI.md and README.md with details on AI-powered automation. - Fix Makefile's clean_keys target to correctly handle generated-keys/. - Resolve PytestUnknownMarkWarning by adding pytest-timeout to pyproject.toml. - Add local pre-commit hooks for 'make tests' and 'make clean'.
Fixed a critical race condition in PromptingCommand and ArgumentValidatingCommand by returning a new instance on each call to prevent state leakage between concurrent sessions. - Added a native HyLang test for the MockSSH - DSL (tests/hy_dsl_test.hy) and updated conftest.py for HyLang ssupport - Improved test coverage for Cisco and F5 mock examples - New test cases for failure modes, edge cases, and interactive commands - Resolved testing warnings (PytestUnknownMarkWarning)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…2.0.0 delete secret chore: update licence details, authors, update to LGPL V3
Agent-Logs-Url: https://github.com/ncouture/MockSSH/sessions/e04e8c22-c18c-498b-9925-c0e734e6bdea Co-authored-by: ncouture <255054+ncouture@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ncouture/MockSSH/sessions/be2de50d-5765-46c2-8e1e-6226a712f0cf Co-authored-by: ncouture <255054+ncouture@users.noreply.github.com>
|
/gemini summary |
Summary of ChangesThis pull request represents a comprehensive modernization of the MockSSH project. The primary goal is to transition the codebase to modern Python standards, improve maintainability through static analysis and automated testing, and integrate advanced AI-driven development workflows. These changes enhance the project's robustness, security, and developer experience while maintaining compatibility with existing DSL features. Highlights
Ignored Files
Activity
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request modernizes MockSSH for Python 3.12+, adopting a pyproject.toml build system, pytest with pytest-twisted, and Ruff/mypy for quality control. It also adds Gemini CLI automation for project workflows. Feedback focuses on securing generated host key file permissions, removing duplicated prompt instructions, transitioning from print() to proper logging, and aligning advertised SSH ciphers and host keys with the actual implementation.
…st_mock_hy Agent-Logs-Url: https://github.com/ncouture/MockSSH/sessions/670d08f1-dedd-4a8d-86c1-37b45c5d3a48 Co-authored-by: ncouture <255054+ncouture@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Modernize project structure, build system, and toolchain