Skip to content

Implement usethis show import-linter with --format=toml and --format=ini#1510

Closed
Copilot wants to merge 6 commits into
mainfrom
copilot/implement-usethis-show-import-linter
Closed

Implement usethis show import-linter with --format=toml and --format=ini#1510
Copilot wants to merge 6 commits into
mainfrom
copilot/implement-usethis-show-import-linter

Conversation

Copilot AI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor
  • Add ConfigFormatEnum type (toml/ini) in src/usethis/_types/config_format.py
  • Add show_import_linter_config() and related core functions in src/usethis/_core/show.py
  • Add import-linter CLI subcommand with --format option in src/usethis/_ui/interface/show.py
  • Fix plain_print to disable Rich markup interpretation (brackets were being stripped)
  • Add 6 tests for the new show import-linter command
  • Update CLI docs in docs/cli/reference.md
  • Run static checks (ruff + basedpyright + import-linter all pass)
  • Code review - feedback addressed
  • Security checks (CodeQL: 0 alerts)
Original prompt

This section details on the original issue you should resolve

<issue_title>Implement usethis show import-linter</issue_title>
<issue_description>With options --format=toml and --format=ini. It would just print the config to the console without side effects.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits March 25, 2026 01:58
…ml/ini

Adds a new `show import-linter` subcommand that prints the import-linter
configuration to the console without side effects. Supports TOML format
(for pyproject.toml) and INI format (for .importlinter files).

Also fixes plain_print to disable Rich markup interpretation, which was
stripping bracket-enclosed text from output.

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/2daf4a1c-b740-4d61-8a65-626982758292
- Rename `format` param to `format_` to avoid shadowing Python builtin
- Move deferred imports to top level (PLC0415)
- Extract `_get_layered_architecture_by_module_by_root_package` as standalone
  function to avoid calling private method on ImportLinterToolSpec
- Extract `_append_ini_list` helper to reduce branches (PLR0912)
- Add noqa: TC001 for Typer-required runtime import

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/2daf4a1c-b740-4d61-8a65-626982758292
…notation

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/2daf4a1c-b740-4d61-8a65-626982758292
Copilot AI changed the title [WIP] Add usethis show import-linter functionality with format options Implement usethis show import-linter with --format=toml and --format=ini Mar 25, 2026
Copilot AI requested a review from nathanjmcdougall March 25, 2026 02:09
Comment thread src/usethis/_console.py
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/f60236e0-9021-49b2-ade6-d3c6faaaace7
Comment thread src/usethis/_ui/interface/show.py Outdated
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/48aef893-ac67-4d59-8979-9268edf56808
@nathanjmcdougall

Copy link
Copy Markdown
Collaborator

I don't like this approach.

@codecov

codecov Bot commented Mar 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 14 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/usethis/_core/show.py 86.90% 11 Missing ⚠️
src/usethis/_ui/interface/show.py 81.25% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Mar 25, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/implement-usethis-show-import-linter (22b9cc7) with main (40cd6ef)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (5056e6e) during the generation of this report, so 40cd6ef was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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.

Implement usethis show import-linter

2 participants