Skip to content

MAINT: Add keewis/blackdoc pre-commit hook - #3002

Merged
VeckoTheGecko merged 3 commits into
Parcels-code:mainfrom
VeckoTheGecko:push-zlktxrxxkyyy
Oct 22, 2026
Merged

VeckoTheGecko merged 3 commits into
Parcels-code:mainfrom
VeckoTheGecko:push-zlktxrxxkyyy

Conversation

@VeckoTheGecko

@VeckoTheGecko VeckoTheGecko commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR only introduces tooling and formatting changes.

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
    • Describe how you used it (e.g., by pasting your prompt): doc fixes

@erikvansebille erikvansebille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the setup. Very nice fixes to the documentation code. I have only one (small) comment below

def Age(particles, fieldset):
particles.age += particles.dt


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the only change I don't really like. Is it really necessary that functions are surrounded by two white lines? Is there a way to ignore this rule? Or better to keep the full ruleset? It's not a dealbreaker if we keep this rule too...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#empty-lines

It will also insert proper spacing before and after function definitions. It’s one line before and after inner functions and two lines before and after module-level functions and classes

Black's tagline is "The uncompromising Python code formatter". Which is great, since they're no rules to configure! But there's the downside of there being no rules to configure.

Just a note: Formatting and linting are different. Formatting in the community has pretty much settled on Black and Ruff formatting (where Ruff is actually just a Rust implementation of Black), where there's very limited customisation (e.g, "quote style" vs 'quote style', and line lengths for wrapping). Linting is basically everything else, and result in physical changes to the Python AST (and allows you to pick rules etc. ).

@VeckoTheGecko
VeckoTheGecko enabled auto-merge (squash) October 22, 2026 09:46
@VeckoTheGecko
VeckoTheGecko merged commit 8d6ccd3 into Parcels-code:main Oct 22, 2026
3 of 5 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Parcels development Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add pre-commit hook for documentation code formatting

2 participants