-
-
Notifications
You must be signed in to change notification settings - Fork 32
Feat/tox python 3.14 #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat/tox python 3.14 #240
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
66d12dd
fix: trying some approaches
vinitkumar 83ec1b4
fix: make test setup better
vinitkumar 2e42334
fix: lint
vinitkumar 4ee6454
fix: types and tests
vinitkumar b1d3101
test: Achieve 99% test coverage for dicttoxml module with comprehensi…
vinitkumar 0a6304e
Merge branch 'master' into feat/tox-python-3.14
vinitkumar 54ddb2f
fix: imports
vinitkumar aca64b2
Merge remote-tracking branch 'origin/feat/tox-python-3.14' into feat/…
vinitkumar 04c1619
fix: crash issues
vinitkumar e89aaec
fix: crash issues
vinitkumar 0adfd22
fix: cache crash
vinitkumar f7f9f71
fix: mypy types issue
vinitkumar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# json2xml AGENT.md | ||
|
||
## Build/Test Commands | ||
- Test: `pytest -vv` (all tests) or `pytest tests/test_<name>.py -vv` (single test file) | ||
- Test with coverage: `pytest --cov=json2xml --cov-report=xml:coverage/reports/coverage.xml --cov-report=term -xvs` | ||
- Lint: `ruff check json2xml tests` | ||
- Type check: `mypy json2xml tests` | ||
- Test all Python versions: `tox` | ||
- Clean artifacts: `make clean` | ||
|
||
## Architecture | ||
- Main module: `json2xml/` with `json2xml.py` (main converter), `dicttoxml.py` (core conversion), `utils.py` (utilities) | ||
- Core functionality: JSON to XML conversion via `Json2xml` class wrapping `dicttoxml` | ||
- Tests: `tests/` with test files following `test_*.py` pattern | ||
|
||
## Code Style (from .cursorrules) | ||
- Always add typing annotations to functions/classes with descriptive docstrings (PEP 257) | ||
- Use pytest (no unittest), all tests in `./tests/` with typing annotations | ||
- Import typing fixtures when TYPE_CHECKING: `CaptureFixture`, `FixtureRequest`, `LogCaptureFixture`, `MonkeyPatch`, `MockerFixture` | ||
- Ruff formatting: line length 119, ignores E501, F403, E701, F401 | ||
- Python 3.10+ required, supports up to 3.14 | ||
- Dependencies: defusedxml, urllib3, xmltodict, pytest, pytest-cov |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env python3 | ||
"""Development script for running tests, linting, and type checking.""" | ||
|
||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
|
||
def run_command(cmd: list[str], description: str) -> bool: | ||
"""Run a command and return True if successful.""" | ||
print(f"\n🔍 {description}...") | ||
try: | ||
result = subprocess.run(cmd, check=True, cwd=Path(__file__).parent) | ||
print(f"✅ {description} passed!") | ||
return True | ||
except subprocess.CalledProcessError as e: | ||
print(f"❌ {description} failed with exit code {e.returncode}") | ||
return False | ||
|
||
|
||
def main() -> None: | ||
"""Run development checks.""" | ||
if len(sys.argv) > 1: | ||
command = sys.argv[1] | ||
else: | ||
command = "all" | ||
|
||
success = True | ||
|
||
if command in ("lint", "all"): | ||
success &= run_command(["ruff", "check", "json2xml", "tests"], "Linting") | ||
|
||
if command in ("test", "all"): | ||
success &= run_command([ | ||
"pytest", "--cov=json2xml", "--cov-report=term", | ||
"-xvs", "tests", "-n", "auto" | ||
], "Tests") | ||
|
||
if command in ("typecheck", "all"): | ||
success &= run_command(["mypy", "json2xml", "tests"], "Type checking") | ||
|
||
if command == "help": | ||
print("Usage: python dev.py [command]") | ||
print("Commands:") | ||
print(" all - Run all checks (default)") | ||
print(" lint - Run linting only") | ||
print(" test - Run tests only") | ||
print(" typecheck - Run type checking only") | ||
print(" help - Show this help") | ||
return | ||
|
||
if not success: | ||
print(f"\n❌ Some checks failed!") | ||
sys.exit(1) | ||
else: | ||
print(f"\n🎉 All checks passed!") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Check notice
Code scanning / CodeQL
Unused local variable Note
Copilot Autofix
AI 4 months ago
To fix the issue, we will remove the unused variable
result
from the code. Since the assignment toresult
does not have any side effects and is not used elsewhere in the function, we can safely remove the left-hand side of the assignment while keeping the call tosubprocess.run
. This ensures that the function's behavior remains unchanged.