Skip to content

STYLE: add check to keep black version in sync between .pre-commit-config.yaml and environment.yaml #46561

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

Closed
MarcoGorelli opened this issue Mar 29, 2022 · 4 comments
Labels
Code Style Code style, linting, code_checks

Comments

@MarcoGorelli
Copy link
Member

Might be possible to adapt

https://github.com/pandas-dev/pandas/blob/3cb70a5f0d1dc386f7806fca75abff6f098b1539/scripts/sync_flake8_versions.py

for this

Task is to have a check which makes sure that the black version here

rev: 22.1.0

and here

- black=22.1.0

are in sync

@MarcoGorelli MarcoGorelli added the Code Style Code style, linting, code_checks label Mar 29, 2022
@mroeschke
Copy link
Member

Larger question: Is there a reason to have black in environment.yml at all since pre-commit runs black as part of the dev workflow?

@MarcoGorelli
Copy link
Member Author

MarcoGorelli commented Mar 29, 2022

Personally, I'd remove all linters and formatter from environment.yml and just leave them to be run via pre-commit

I remember that some had objections, though arguably if they want a linter/ formatter in their environment they can always install it on top of the current dependencies?

cc @simonjayhawkins IIRC you'd weighed in on this in the past?

Perhaps this is one for the next dev meeting

@simonjayhawkins
Copy link
Member

simonjayhawkins commented Apr 2, 2022

Personally, I'd remove all linters and formatter from environment.yml and just leave them to be run via pre-commit

makes sense if users are comfortable with pre-commit. I had some issues with pre-commit integration with VSCode in the past that I never got to the bottom of. So, personally I have it switched off and do the sort imports and black format manually and try to remember to run pre-commit run -a && mypy pandas --no-incremental before submitting a PR.

but nbd for me if need to install black and the rest manually. Not sure about the Docker container though. IIUC we would need to change our DockerFile to work properly with GH Codespaces (and I don't know the state of the discussion on that one - I requested the preview but was not accepted so never tested). So it maybe that there is an advantage to having the linting tools pre-installed in the dev environment for GH Codespaces with VSCode integration.

@MarcoGorelli
Copy link
Member Author

this is solved by having required_version in pyproject.toml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

No branches or pull requests

3 participants