Skip to content
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

.pyi files should be identified as python #51

Closed
chadrik opened this issue Jul 11, 2018 · 6 comments
Closed

.pyi files should be identified as python #51

chadrik opened this issue Jul 11, 2018 · 6 comments

Comments

@chadrik
Copy link

chadrik commented Jul 11, 2018

.pyi files are the basis for PEP 484 static type checking, and should be identified as python files.

@asottile
Copy link
Member

I'm hesitant to classify them directly as python as they have quite different formatting style (for instance I wouldn't run flake8 on them). That said, they aren't classified at all yet. Would you be OK with them (for now) being classified as pyi and then perhaps in the future extend that to python?

@chadrik
Copy link
Author

chadrik commented Jul 11, 2018

Wow, thanks for the fast response.

I'm working on adding stubs to attrs, which uses pre-commit to run black to reformat python files, but pre-commit will only feed files to black which identify marks as python (whew! still with me?).

I'm hesitant to classify them directly as python as they have quite different formatting style (for instance I wouldn't run flake8 on them).

black for one is smart enough to treat pyi files specially when reformatting them, but I understand your wariness.

Would you be OK with them (for now) being classified as pyi and then perhaps in the future extend that to python?

I have a solution that works for now, but I wanted to notify the authors of the various projects so that a better solution can be worked out. I'm going to go point this out over at black and let you all sort it out ;)

@asottile
Copy link
Member

for pre-commit (once identify supports pyi) you can hook it up as follows:

    hooks:
    -   id: black
    -   id: black
         name: black (pyi)
         types: [pyi]

let me get pyis classified for ya though :)

@asottile
Copy link
Member

here's the PR to classify pyi as... well... pyi for now :) #52

@asottile
Copy link
Member

pyi is now classified as of v1.1.3

@chadrik
Copy link
Author

chadrik commented Jul 11, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants