Skip to content

BREAKING: releasing v1.0.0, adopt Typer as main frame#1

Merged
RyoNakagami merged 2 commits into
mainfrom
develop
Dec 11, 2025
Merged

BREAKING: releasing v1.0.0, adopt Typer as main frame#1
RyoNakagami merged 2 commits into
mainfrom
develop

Conversation

@RyoNakagami
Copy link
Copy Markdown
Owner

Summary

  • This PR introduces a complete refactor of the yamlcli command-line interface using Typer, replacing the previous argparse-based implementation.
  • It consolidates entry points, ensures consistent error handling, and adds a version flag while improving overall code organization.

Related Issue

  • Closes / References: #IssueNumber

Type of Change

  • Bug fix
  • New feature
  • Refactoring / Code cleanup
  • Documentation update
  • Other:

Description

  • Migrated CLI implementation from argparse to Typer, enabling improved UX, clearer commands, and standardized exit/error handling.
  • Introduced a single main command converter under the yamlcli CLI app, aligning with modern Python CLI practices.
  • Added --version / -v flag with callback logic, providing version and Python information.
  • Improved file existence checks, mutually exclusive option handling, and exception messages.
  • Refactored imports and moved conversion logic to yamlcli_core and version handling to library/version.
  • Removed the standalone main.py and replaced it with a clean Typer-based entry point via cli.py.

Changes Made

New Modules / Classes

  • Introduced yamlcli.library.version for centralized version storage.
  • Confirmed architecture using yamlcli.yamlcli_core for conversion logic.

Moved / Refactored

  • Fully replaced argparse CLI (main.py) with Typer-powered cli.py.
  • Consolidated entry points: both main() and __main__ now invoke app().

Enhanced / Fixed

  • Improved YAML/JSON error handling using Typer's Exit mechanism.
  • Better UX for incorrect flag combinations: explicit message and exit code 1.
  • Added robust version display callback printing yamlcli + Python version.
  • Ensured consistency between CLI calls and internal function API.

Removed / Deprecated

  • Removed the argparse-based CLI system (main.py).
  • Removed redundant path checks and exception duplication from previous implementation.

Additional Notes

  • The new CLI is fully compatible with CliRunner for pytest, eliminating issues caused by runpy in earlier tests.
  • This PR prepares the codebase for future subcommands (e.g., validation utilities, formatting, schema checks).
  • No breaking changes for end users, except improved flag requirements.

Tests

Unit Tests

  • New unit tests added based on CliRunner.
  • Tests updated from previous argparse assumptions.
  • All unit tests pass locally.
% uv run pytest --tb=no                              
================================ test session starts =================================
platform linux -- Python 3.13.7, pytest-8.4.2, pluggy-1.6.0
rootdir: .../yamlcli
configfile: pyproject.toml
testpaths: tests
plugins: cov-7.0.0
collected 15 items                                                                   

tests/test_coremodule.py .......                                               [ 46%]
tests/test_yamlcli.py ........                                                 [100%]

=================================== tests coverage ===================================
__________________ coverage: platform linux, python 3.13.7-final-0 ___________________

Name                                 Stmts   Miss  Cover   Missing
------------------------------------------------------------------
src/yamlcli/__init__.py                  2      0   100%
src/yamlcli/cli.py                      38     11    71%   24-26, 64-70, 74, 77
src/yamlcli/library/__init__.py          0      0   100%
src/yamlcli/library/helper_func.py      21     15    29%   19-37
src/yamlcli/library/version.py           2      0   100%
src/yamlcli/yamlcli_core.py             17      0   100%
------------------------------------------------------------------
TOTAL                                   80     26    68%

Checklist

  • Code follows Python style guidelines.
  • Docstrings updated for Typer-based CLI.
  • Type hints preserved / updated where applicable.
  • Logging and error handling consistent with Typer expectations.
  • Dependencies checked (PyYAML, Typer).
  • Breaking changes documented.
  • Related issue referenced in this PR.

@RyoNakagami RyoNakagami added the release Preparing or finalizing a release label Dec 11, 2025
@RyoNakagami RyoNakagami changed the title BREAKING: adopt Typer as main frame BREAKING: releasing v1.0.0, adopt Typer as main frame Dec 11, 2025
@RyoNakagami RyoNakagami merged commit 3b88c14 into main Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Preparing or finalizing a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant