Skip to content

fix: print results when running ulid as a module - #68

Merged
mdomke merged 5 commits into
mdomke:mainfrom
tongwentao:fix/module-cli-output
Oct 27, 2026
Merged

mdomke merged 5 commits into
mdomke:mainfrom
tongwentao:fix/module-cli-output

Conversation

@tongwentao

@tongwentao tongwentao commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

python -m ulid build --from-int 0 exits successfully without printing its result on the original implementation. The module entry point calls main() and discards its return value, while the installed ulid command prints it correctly.

Changes

  • Route module execution through the existing output entry point so generated and converted values reach stdout.
  • Accept an optional program name in entrypoint() to retain python -m ulid in module usage text. The installed console entry point keeps its existing default.
  • Add actual subprocess regressions for build and show, each with arguments and piped stdin. Cover help/no-argument usage and the existing console entry point as controls.
  • Add an Unreleased changelog entry.

For example, both python -m ulid build --from-int 0 and ulid build --from-int 0 should print 00000000000000000000000000. The subprocess tests exercise the real module boundary rather than calling main() directly. The four output regressions were confirmed failing before the source fix during the original implementation.

Validation

Latest local validation on Linux / Python 3.14.6, after incorporating the maintainer's upstream merges and removing the temporary metadata restrictions:

  • uv run poe fmt and uv run poe check: passed, including Ruff, Pyrefly and doc8.
  • uv run poe test: 94 passed; CLI module coverage 100%, total reported coverage 99%.
  • uv run prek run --all-files: all configured hooks passed.
  • uv run poe build: wheel and source distribution built successfully. Both declare core metadata 2.5 and retain the upstream Requires-Python: >=3.11 requirement.
  • Both distributions passed twine check --strict using Twine 7.0.0 and packaging 26.3, matching the versions pinned by the upstream package-check action. The wheel also passed check-wheel-contents 0.6.3.
  • Installed the built wheel in an isolated environment outside the checkout: module and console build/show commands produced matching expected output (4 smoke checks passed).
  • git diff --check: passed.

Other Python versions and operating systems were not rerun locally for this review revision; the current hosted results are reported in the Checks tab.

Review follow-up

Removed both core-metadata-version = "2.4" overrides as requested. The maintainer has upgraded the upstream package-check action to v3.0.2, so these compatibility restrictions are no longer necessary. pyproject.toml now matches the upstream base; this PR retains only the CLI fix, its regression tests, and the changelog entry.

Codex assisted with the implementation, tests, automated validation, and this description.

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (059e8f6) to head (0f618f9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #68   +/-   ##
=======================================
  Coverage   98.65%   98.65%           
=======================================
  Files           4        4           
  Lines         372      372           
  Branches       61       61           
=======================================
  Hits          367      367           
  Misses          3        3           
  Partials        2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread pyproject.toml Outdated
@sonarqubecloud

Copy link
Copy Markdown

@mdomke
mdomke merged commit 06707c1 into mdomke:main Oct 27, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants