Skip to content

ci: annotating launcher, convert and commands files - #3935

Merged
germa89 merged 23 commits into
mainfrom
maint/annotating-some-files
May 22, 2025
Merged

germa89 merged 23 commits into
mainfrom
maint/annotating-some-files

Conversation

@germa89

@germa89 germa89 commented May 19, 2025 •

Copy link
Copy Markdown
Collaborator

Description

Using MyPy for typing annotations checks on the files: launcher, conver and commands.

Issue linked

Related to #3480

Checklist

Summary by Sourcery

Enforce static type checking with MyPy and add missing type annotations in core files

Enhancements:

  • Simplify version retrieval by importing version directly and annotate SUPPORTED_ANSYS_VERSIONS with Dict type
  • Add return type hints to internal helper functions _check_has_ansys and _apply_default_theme

CI:

  • Add MyPy hook to pre-commit configuration for strict type checking

@germa89
germa89 requested a review from a team as a code owner May 19, 2025 15:55
@ansys-reviewer-bot

Copy link
Copy Markdown
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@sourcery-ai

sourcery-ai Bot commented May 19, 2025 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Integrates static typing checks by adding MyPy to pre-commit, refactors version retrieval logic, and adds type annotations across core modules.

File-Level Changes

Change Details Files
Integrate MyPy into pre-commit workflow
  • Add mypy hook configuration to .pre-commit-config.yaml
  • Enable disallow-untyped-defs, incomplete-defs, untyped-calls flags
  • Ignore missing imports in MyPy settings
.pre-commit-config.yaml
Refactor version retrieval in core module
  • Remove importlib.metadata fallback logic
  • Import version directly from ansys.mapdl.core
src/ansys/mapdl/core/_version.py
Add type hints to variables and function signatures
  • Annotate SUPPORTED_ANSYS_VERSIONS with Dict[int, str]
  • Add return type bool to _check_has_ansys
  • Add return type None to _apply_default_theme
src/ansys/mapdl/core/_version.py
src/ansys/mapdl/core/misc.py
src/ansys/mapdl/core/plotting/theme.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@germa89 germa89 self-assigned this May 19, 2025
@germa89 germa89 changed the title Maint/annotating some files ci: Adding mypy support May 19, 2025
@germa89 germa89 changed the title ci: Adding mypy support ci: adding mypy support May 19, 2025

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @germa89 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .pre-commit-config.yaml Outdated
Comment thread src/ansys/mapdl/core/_version.py Outdated
@github-actions github-actions Bot added the CI/CD Related with CICD, Github Actions, etc label May 20, 2025
@github-actions github-actions Bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 20, 2025
@codecov

codecov Bot commented May 20, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 89.37729% with 29 lines in your changes missing coverage. Please review.

Project coverage is 88.28%. Comparing base (a8de41a) to head (eb168e7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3935      +/-   ##
==========================================
+ Coverage   88.27%   88.28%   +0.01%     
==========================================
  Files         187      187              
  Lines       14840    14906      +66     
==========================================
+ Hits        13100    13160      +60     
- Misses       1740     1746       +6     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 20, 2025
@germa89

germa89 commented May 20, 2025 •

Copy link
Copy Markdown
Collaborator Author

@github-actions github-actions Bot added dependencies maintenance General maintenance of the repo (libraries, cicd, etc) CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 20, 2025
@github-actions github-actions Bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 21, 2025
@germa89

germa89 commented May 21, 2025

Copy link
Copy Markdown
Collaborator Author

MyPy support is added on the local precommit. But I had to disable it in the CICD because it keeps trying to analyse all the repository.

@germa89 germa89 changed the title ci: adding mypy support ci: annotating launcher, convert and commands files May 21, 2025
@github-actions github-actions Bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 21, 2025
@github-actions github-actions Bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 21, 2025
@github-actions github-actions Bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 21, 2025
@github-actions github-actions Bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc dependencies maintenance General maintenance of the repo (libraries, cicd, etc) labels May 22, 2025
@github-actions github-actions Bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 22, 2025
@germa89

germa89 commented May 22, 2025

Copy link
Copy Markdown
Collaborator Author

@pyansys-ci-bot LGTM.

@germa89
germa89 enabled auto-merge (squash) May 22, 2025 11:07

@pyansys-ci-bot pyansys-ci-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Approving this PR because germa89 said so in here 😬

LGTM

@germa89
germa89 merged commit e0e6f05 into main May 22, 2025
@germa89
germa89 deleted the maint/annotating-some-files branch May 22, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD Related with CICD, Github Actions, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants