Skip to content
This repository has been archived by the owner on Apr 4, 2020. It is now read-only.

Run black through pre-commit #3

Closed
benjaoming opened this issue Oct 30, 2019 · 7 comments
Closed

Run black through pre-commit #3

benjaoming opened this issue Oct 30, 2019 · 7 comments
Labels
question Further information is requested

Comments

@benjaoming
Copy link
Contributor

One of the design features of pre-commit is to create a separate Python environment for the linting tools. This means that Black can run outside of the development environment in some other Python version.

I would like to discuss the potential for replacing the need for this repository with "black through pre-commit", as per their official documentation. For more background on pre-commit, see the exchange here: psf/black#1073

CC: @indirectlylit @ralphiee22

@benjaoming benjaoming added the question Further information is requested label Oct 30, 2019
@benjaoming
Copy link
Contributor Author

This would perhaps also fix a recurring confusion: What version of Black are we even running? As per learningequality/kolibri#6004

@indirectlylit
Copy link
Contributor

Yup, I tried that first. Black is limited to python 3.6+, so we were unable to use that strategy because some developers run early versions of Python 3.

ref: psf/black#585

@benjaoming
Copy link
Contributor Author

@indirectlylit can developers not be restricted to systems with Python 3.6+? This doesn't pertain their development virtualenv since pre-commit creates its own.

The fall-back mode would be that linting is also run in CI, so a PR would still error out if the developer has skipped using pre-commit.

@benjaoming
Copy link
Contributor Author

The pre-commit hook is specified in the official PSF repo and doesn't pin Python 3.6.. but it has to be 3.6+, I suppose. 3.5 hasn't been around for quite a while?

https://github.com/psf/black/blob/master/.pre-commit-hooks.yaml

@indirectlylit
Copy link
Contributor

indirectlylit commented Oct 30, 2019

@indirectlylit can developers not be restricted to systems with Python 3.6+?

At the time that seemed like too much to ask, because the version of Ubuntu a few people were running came with 3.5

@benjaoming
Copy link
Contributor Author

Let's find out :)

@indirectlylit
Copy link
Contributor

Let's find out :)

That's my point - we did it this way originally and I got 2 different complaints that things were broken. Specifically, I know @rtibbles ran into this problem.

also ref: learningequality/kolibri#5409

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants