Skip to content

feat: add uv support and modernize CLI#18

Merged
shaonianche merged 5 commits intomainfrom
feature/uv-support
Feb 1, 2026
Merged

feat: add uv support and modernize CLI#18
shaonianche merged 5 commits intomainfrom
feature/uv-support

Conversation

@shaonianche
Copy link
Owner

  • Add fit_tool/cli.py as the new CLI entry point
  • Update pyproject.toml: rename command from 'fittool' to 'fit-tool'
  • Remove legacy bin/fittool and setup.py
  • Update README.md with uv installation and usage instructions

Amp-Thread-ID: https://ampcode.com/threads/T-019c16e3-e389-71f9-9c5e-8d7fa2bdd176

- Add fit_tool/cli.py as the new CLI entry point
- Update pyproject.toml: rename command from 'fittool' to 'fit-tool'
- Remove legacy bin/fittool and setup.py
- Update README.md with uv installation and usage instructions

Amp-Thread-ID: https://ampcode.com/threads/T-019c16e3-e389-71f9-9c5e-8d7fa2bdd176
Co-authored-by: Amp <amp@ampcode.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @shaonianche, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the project's packaging and command-line interface. It integrates uv for streamlined dependency management and installation, consolidates the CLI logic into a dedicated Python module, and removes outdated build configurations, enhancing the project's maintainability and user experience.

Highlights

  • CLI Modernization: The command-line interface has been refactored into a dedicated Python module (fit_tool/cli.py), and the executable name has been standardized from fittool to fit-tool.
  • Build System Update: Legacy build files, specifically bin/fittool and setup.py, have been removed, indicating a shift towards pyproject.toml for project configuration and build management.
  • UV Support: The project now officially supports and recommends uv for installation, with updated instructions in the README.md.
  • Documentation Updates: The README.md has been updated to reflect the new installation methods and CLI usage examples.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modernizes the project's command-line interface and packaging by migrating from setup.py to pyproject.toml, introducing a new CLI entry point, and adding support for the uv package manager. The changes are well-structured and improve the project's maintainability. I've identified a critical issue in the new CLI script where a binary file is incorrectly opened in text mode, which could lead to data corruption. I've provided suggestions to fix this, along with a minor improvement for logging consistency.

Comment on lines 18 to 23
parser.add_argument(
'fitfile',
metavar='FILE',
type=argparse.FileType('r'),
help='FIT file to process'
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using argparse.FileType('r') opens the file in text mode, which can corrupt binary FIT files due to newline translation. It also causes the file to be opened twice: once by argparse and again by FitFile.from_file. It's better to pass the filename as a string and let FitFile.from_file handle all file operations in the correct mode.

    parser.add_argument(
        'fitfile',
        metavar='FILE',
        help='FIT file to process'
    )

fit_tool/cli.py Outdated
Comment on lines 61 to 62
logger.info(f'Loading fit file {args.fitfile.name}...')
fit_filename = args.fitfile.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Following the change to accept the filename as a string from argparse, args.fitfile will be the path string itself, not a file object. Therefore, you should use args.fitfile directly instead of accessing the .name attribute.

    logger.info(f'Loading fit file {args.fitfile}...')
    fit_filename = args.fitfile

Comment on lines 56 to 58
if args.verbose:
handler = logging.StreamHandler()
logger.addHandler(handler)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The StreamHandler for verbose output currently uses the default logging format, which is inconsistent with the FileHandler. You should add a formatter to ensure log messages have the same structure, whether they are displayed on the console or written to a file.

    if args.verbose:
        handler = logging.StreamHandler()
        handler.setFormatter(logging.Formatter(fmt="%(asctime)s %(levelname)s %(message)s"))
        logger.addHandler(handler)

@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.69%. Comparing base (623e190) to head (5fd0538).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #18      +/-   ##
==========================================
+ Coverage   89.02%   89.69%   +0.67%     
==========================================
  Files          20       21       +1     
  Lines        1358     1398      +40     
==========================================
+ Hits         1209     1254      +45     
+ Misses        149      144       -5     

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

shaonianche and others added 4 commits February 1, 2026 02:25
argparse.FileType('r') opens files in text mode which can corrupt
binary FIT files due to newline translation. Now passing the filename
as a string and letting FitFile.from_file handle file operations.

Amp-Thread-ID: https://ampcode.com/threads/T-019c16e3-e389-71f9-9c5e-8d7fa2bdd176
Co-authored-by: Amp <amp@ampcode.com>
@shaonianche shaonianche merged commit aefb0ae into main Feb 1, 2026
8 checks passed
shaonianche added a commit that referenced this pull request Feb 5, 2026
@shaonianche shaonianche deleted the feature/uv-support branch February 5, 2026 08:38
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.

1 participant