Update packaging, add hatch for tests, maybe fix tests - #200
Merged
Conversation
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Reviewer's GuideModernizes packaging, testing, and CI by introducing Hatch-based environments and updated Python support, while applying ruff/format-driven code cleanups (import grouping, f-strings, minor refactors) across widgets and tests to keep behavior but improve consistency. Sequence diagram for running tests via Hatch environmentssequenceDiagram
actor Developer
participant Hatch as hatch
participant Pytest as pytest
participant Selenium as selenium_grid
Developer->>Hatch: hatch run test
Hatch->>Pytest: invoke pytest testing with BROWSER=firefox
Pytest->>Selenium: create remote WebDriver(session)
Selenium-->>Pytest: provide browser session
Pytest-->>Hatch: test results
Hatch-->>Developer: report exit status and output
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/deploy.yml" line_range="21-26" />
<code_context>
- name: Install dependencies
- run: pip install twine
+ run: pip install pip twine -U
- name: Build a wheel
run: pip wheel --no-deps -w dist .
+ - name: Test package
+ run: twine check dist/*
</code_context>
<issue_to_address>
**suggestion:** The publish job only builds wheels; consider also building an sdist via `python -m build` for broader compatibility.
Currently the job only builds wheels with `pip wheel` and uploads whatever is in `dist/`. Some consumers (e.g. distro packagers or unusual platforms) expect an sdist as well. Using `python -m build` (after `pip install build` if needed) will produce both wheel and sdist, and `pypa/gh-action-pypi-publish` will upload both automatically.
```suggestion
- name: Install dependencies
run: pip install --upgrade pip build twine
- name: Build distributions
run: python -m build
- name: Test package
run: twine check dist/*
```
</issue_to_address>
### Comment 2
<location path="docs/conf.py" line_range="14" />
<code_context>
import os
import sys
+from sphinx.ext.apidoc import main as apidoc_main
+
modules_path = os.path.abspath("../src/widgetastic_patternfly4")
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Importing `sphinx.ext.apidoc` at module import time can make `conf.py` more fragile outside the Sphinx runtime.
This import used to be inside `run_apidoc`, so tools could import `conf.py` without Sphinx installed as long as they didn’t call that function. Moving it to the module level forces all consumers of `conf.py` to have `sphinx.ext.apidoc` available. To keep `conf.py` usable in non-docs contexts, either move the import back inside `run_apidoc` or wrap it in a try/except ImportError.
Suggested implementation:
```python
import os
import sys
modules_path = os.path.abspath("../src/widgetastic_patternfly4")
```
```python
def run_apidoc(_):
from sphinx.ext.apidoc import main as apidoc_main
cur_dir = os.path.abspath(".")
output_path = os.path.join(cur_dir, "source")
apidoc_main(["-e", "-f", "-o", output_path, modules_path, "--force"])
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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 by Sourcery
Modernize packaging, linting, and CI configuration, introduce Hatch-managed test and coverage environments, and apply minor code cleanups for consistency and Python 3.10+ support.
New Features:
Enhancements:
Build:
CI:
Documentation: