Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Ruff #821

Merged
merged 18 commits into from
Mar 1, 2024
Merged

Introduce Ruff #821

merged 18 commits into from
Mar 1, 2024

Conversation

glatterf42
Copy link
Collaborator

@glatterf42 glatterf42 commented Feb 29, 2024

Please confirm that this PR has done the following:

  • [ ] Tests Added But updated black CI workflow
  • Documentation Added
  • Name of contributors Added to AUTHORS.rst
  • Description in RELEASE_NOTES.md Added

Description of PR

As suggested by #820 (comment), this PR cherry-picks the commits from #820 that refer to ruff and amends some of them that got mixed with Python mentions.

@glatterf42
Copy link
Collaborator Author

Should we add some mention of ruff to the docs?

Also, in ixmp4, we have an optional dependency group called "dev" in pyproject.toml and that includes a minimum version for ruff. Should we add something similar here?

@danielhuppmann
Copy link
Member

Should we add some mention of ruff to the docs?

Please also add the badge to index.rst, should be sufficient.

Also, in ixmp4, we have an optional dependency group called "dev" in pyproject.toml and that includes a minimum version for ruff. Should we add something similar here?

Yes, please.

Copy link
Contributor

@phackstock phackstock left a comment

Choose a reason for hiding this comment

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

Looks quite good overall, a few small comments in line. Maybe you could mention ruff the PULL_REQUEST_TEMPLATE.md or CONTRIBUTING.rst

.github/workflows/ruff.yml Outdated Show resolved Hide resolved
pyam/index.py Outdated Show resolved Hide resolved
pyproject.toml Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Just so that I understand it correctly, we will now have a setup.cfg, setup.py and pyproject.toml?
Could you combine everything into a pyproject.toml or move the ruff settings to setup.cfg or setup.py?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems that you can also use a ruff.toml or .ruff.toml file (https://github.com/astral-sh/ruff?tab=readme-ov-file#configuration). I'd prefer that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, ruff won't read configuration from setup.cfg or setup.py. My intention with using pyproject.toml was to next use #823 to migrate to poetry, which will read all settings from pyproject.toml, so that way the files will be combined. Let me clean up this PR as per your suggestions and then create one with poetry and then we can decide: if you don't like poetry, I can migrate the settings here to ruff.toml.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see your point. I'd prefer though if you use ruff.toml for now and then in a future PR integrate setup.cfg and setup.py into one pyproject.toml.

tests/test_feature_aggregate.py Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
@glatterf42 glatterf42 mentioned this pull request Mar 1, 2024
4 tasks
@danielhuppmann
Copy link
Member

You also have to use the ruff-badge in docs/index.rst on line 8.

Copy link
Member

@danielhuppmann danielhuppmann left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 99.36709% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 94.8%. Comparing base (10933de) to head (079d345).

Files Patch % Lines
pyam/run_control.py 66.6% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #821   +/-   ##
=====================================
  Coverage   94.8%   94.8%           
=====================================
  Files         64      64           
  Lines       6089    6092    +3     
=====================================
+ Hits        5775    5778    +3     
  Misses       314     314           

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

Copy link
Contributor

@phackstock phackstock left a comment

Choose a reason for hiding this comment

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

Good to merge from my side if you change the pyproject.toml to ruff.toml

@glatterf42
Copy link
Collaborator Author

I can't merge it myself though, don't have permissions for that, so please go ahead.

@phackstock phackstock merged commit c798e2c into IAMconsortium:main Mar 1, 2024
11 checks passed
@glatterf42 glatterf42 deleted the include/ruff branch March 1, 2024 10:13
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