Skip to content

Conversation

@pre-commit-ci
Copy link
Contributor

@pre-commit-ci pre-commit-ci bot commented Apr 1, 2024

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.0 → v0.3.4](astral-sh/ruff-pre-commit@v0.3.0...v0.3.4)
- [github.com/scientific-python/cookie: 2024.01.24 → 2024.03.10](scientific-python/cookie@2024.01.24...2024.03.10)
@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2024

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@pllim pllim added this to the v6.1.0 milestone Apr 1, 2024
@pllim
Copy link
Member

pllim commented Apr 1, 2024

pre-commit auto PR fails pre-commit check? 🤯

Copy link
Member

@eerovaher eerovaher left a comment

Choose a reason for hiding this comment

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

The Ruff rule UP032 can automatically convert str.format() calls to f-strings. Before v0.3.2 Ruff avoided making changes if the naive conversion produced lines that exceeded the line length limit (88 characters in our case), but now it is more aggressive. I am not convinced that the automatic edits are the best and I think that manually addressing UP032 would be worth it.

I can't tell what went wrong with sp-repo-review, but it is clear that the failure was catastrophic.

"{}.__init__ had {} remaining unhandled arguments".format(
self.__class__.__name__, len(args)
)
f"{self.__class__.__name__}.__init__ had {len(args)} remaining unhandled arguments"
Copy link
Member

Choose a reason for hiding this comment

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

This can be shortened slightly:

Suggested change
f"{self.__class__.__name__}.__init__ had {len(args)} remaining unhandled arguments"
f"{type(self).__name__}.__init__ had {len(args)} remaining unhandled arguments"

Copy link
Member

Choose a reason for hiding this comment

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

@eerovaher , does that mean this is another one where someone needs to make extra changes from their fork? If so, I will close this PR without merge. Please advise. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Ruff is converting str.format() calls to f-strings in the simplest possible way, but I don't think that simplest is best in many cases. I will update the relevant code manually.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. Appreciate it!

"declare_metadata: private-key = {} metadata = {}".format(
private_key, str(metadata)
)
f"declare_metadata: private-key = {private_key} metadata = {str(metadata)}"
Copy link
Member

Choose a reason for hiding this comment

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

This can be shortened:

Suggested change
f"declare_metadata: private-key = {private_key} metadata = {str(metadata)}"
f"declare_metadata: private-key = {private_key} {metadata = !s}"

@pllim
Copy link
Member

pllim commented Apr 2, 2024

Re: repo-review -- maybe @henryiii or @WilliamJamieson can advise? 🙏

@henryiii
Copy link
Contributor

henryiii commented Apr 2, 2024

From a local run:

AttributeError: 'float' object has no attribute 'split'

We are assuming this is a string:

[tool.pytest.ini_options]
minversion = 7.0

But it's an float. Does pytest support that? Version numbers aren't floats, generally.

I can look into reducing the output, not sure I like Rich's error formatter.

@pllim
Copy link
Member

pllim commented Apr 2, 2024

Looks like it is a string if within pyproject.toml in https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml but not in other forms of config. 🤔 Might have been a translation oversight during the move from setup.cfg to pyproject.toml (it is very subtle!) though the build didn't get tripped by this. 🤷‍♀️

@henryiii
Copy link
Contributor

henryiii commented Apr 3, 2024

I bet it's valid, it probably calls stingifies on everything in ini_options. A quick fix and correct fix is to make it a string (3.10 is not "3.10", after all) and I'll fix this to match pytest in sp-repo-review.

@eerovaher eerovaher closed this Apr 3, 2024
henryiii added a commit to henryiii/astropy that referenced this pull request Apr 3, 2024
@henryiii henryiii mentioned this pull request Apr 3, 2024
1 task
@pllim pllim deleted the pre-commit-ci-update-config branch April 3, 2024 16:37
d-giles referenced this pull request in d-giles/astropy-abdufork Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-automation skip-changelog-checks Tells bot to skip changlog checks testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants