Skip to content

Allow outputs to STDOUT#2

Merged
Vini2 merged 9 commits into
Vini2:mainfrom
linsalrob:main
Jun 17, 2026
Merged

Allow outputs to STDOUT#2
Vini2 merged 9 commits into
Vini2:mainfrom
linsalrob:main

Conversation

@linsalrob

Copy link
Copy Markdown
Contributor

This pull request enhances the output handling in the agtools CLI and commands by introducing a standardized way to support writing output to either a file or stdout (using -). It refactors all relevant command modules to use a new context manager, improves logging behavior when writing to stdout, and updates dependencies for development and testing.

Output handling improvements:

  • Added a new open_output_file context manager in src/agtools/commands/_output.py to unify and simplify writing output to either a file or stdout, and updated all command modules to use this function instead of manual file handling. (src/agtools/commands/_output.py, src/agtools/commands/asqg2gfa.py, src/agtools/commands/concat.py, src/agtools/commands/fastg2gfa.py, src/agtools/commands/gfa2adj.py, src/agtools/commands/gfa2asqg.py, src/agtools/commands/gfa2dot.py, src/agtools/commands/gfa2fasta.py, src/agtools/commands/gfa2fastg.py, src/agtools/commands/rename.py, src/agtools/commands/stats.py, src/agtools/core/gfa_filter.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27]

  • The CLI --output option now explicitly allows - to write to stdout, and the help text is updated accordingly. (src/agtools/cli.py)

Logging improvements:

  • The logger configuration is updated to emit logs to stderr when output is routed to stdout, preventing log messages from mixing with command output. (src/agtools/cli.py, src/agtools/log_config.py) [1] [2]

Development and testing:

  • While testing the changes, the development install was failing because the dev extra depended on agtools[test], which caused pip/flit to install the released PyPI package before symlinking the local checkout. This left an existing site-packages/agtools directory and caused flit install --symlink to fail with FileExistsError. The fix removes the self-referential dependency and lists the test dependencies directly in the dev extra, so local development installs use the checked-out branch correctly.
  • Updated the development dependencies in pyproject.toml to include pytest, pytest-cov, and pytest-xdist for improved testing. (pyproject.toml)

Other changes:

  • Bumped the version number in src/agtools/__init__.py from 1.1.0 to 1.1.1.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 12 high

Alerts:
⚠ 12 issues (≤ 0 issues of at least minor severity)

Results:
12 new issues

Category Results
ErrorProne 1 high
Security 11 high

View in Codacy

🟢 Metrics 4 complexity · 3 duplication

Metric Results
Complexity 4
Duplication 3

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@Vini2 Vini2 merged commit 16ad2a8 into Vini2:main Jun 17, 2026
4 of 13 checks passed
@Vini2 Vini2 mentioned this pull request Jun 17, 2026
Merged
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.

3 participants