Skip to content

chore: remove isort and old setup.cfg #1625

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

Merged
merged 2 commits into from
Mar 23, 2025

Conversation

wyardley
Copy link
Contributor

@wyardley wyardley commented Mar 2, 2025

Followup to #1611

  • Remove isort from pre-commit config
  • Use builtin isort rules within ruff
  • Select F and most E class rules in ruff explicitly
  • Remove setup.cfg and move most of its configuration into pyproject.toml
  • Remove Python 3.8 hack in version.py
  • ruff isort auto-fixes

wyardley added 2 commits March 2, 2025 11:41
- Remove isort from pre-commit config
- Use builtin isort rules within ruff
- Select F and most E class rules in ruff explicitly
- Remove `setup.cfg` and move most of its configuration into
  `pyproject.toml`
- Remove Python 3.8 hack in `version.py`
known_first_party = Alerters,Loggers,Monitors,envconfig,util,simplemonitor
line_length=88
multi_line_output=3
include_trailing_comma=True
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not all of these have config equivalents in ruff, but doesn't seem to cause any complaints in terms of existing formatting.

@@ -1,21 +0,0 @@
[metadata]
version = attr: simplemonitor.__version__
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this I'm not 100% sure on - I think the static version in pyproject.toml [project] will be sufficient here?
From a quick look, I don't think that one is supposed to be dynamic, but should be hard-coded? I assume everything that needs to get updated already does as part of how it's released?

Copy link
Owner

Choose a reason for hiding this comment

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

I think so, but from memory this is also one of those things where I was trying a bunch of stuff out to see what worked for me and what didn't :)

[tool.ruff.lint]
ignore = ["F401"]
# Ruff defaults (F + some E), as well as I (isort) and W.
# Maybe consider adding some subset of "D" here as well
select = ["E4", "E7", "E9", "F", "I", "W"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not 100% sure if select overrides defaults or is additive, but seemed best to just be explicit here.

Copy link
Owner

Choose a reason for hiding this comment

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

"Explicit is better than implicit." :)

@@ -1,4 +1,4 @@
from importlib_metadata import version # compat lib for < 3.8
from importlib.metadata import version
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think switching to . from _ is what that 3.8 comment was about? Not sure what should really be in this file. Seemed like this line was needed, but not sure if line 3 should be removed or left there commented out.

Copy link
Owner

Choose a reason for hiding this comment

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

I think that maybe goes with my earlier comment about trying a bunch of things to see what stuck - possibly in combination with supporting older Pythons at the time.

@wyardley
Copy link
Contributor Author

Should also see if this resolves issues with dependabot not being able to parse pyproject.toml -- if not, I can take a look and try to figure out why.

@jamesoff jamesoff merged commit 2337ab7 into jamesoff:develop Mar 23, 2025
33 of 34 checks passed
@jamesoff
Copy link
Owner

Thanks again for the effort on this :)

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.

2 participants