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
Matching cython files: merge with python or support separately? #1436
Comments
I strongly disagree that most python linters would work -- cython has custom incompatible syntax cython source is not python source so they cannot be merged (in the same way that I don't think there's anything to document either, pre-commit may be written in python but it supports many programming languages and I don't think cython is special enough to warrant words in the docs. |
I'm thinking along the lines of documenting the possible value for the |
|
Oh, I meant |
no I don't think so (as I said above), plus it wouldn't help since |
(and there's hundreds of other types, why should cython be special cased) |
This is weird because I just added As for special-casing. It's just because if a linter supports Python but also Cython, if people mostly use Python only they tend to forget. I've integrated some things a few months ago and just now realized that some linters don't point to errors in Cython and only after some investigation it turned out that these files aren't matched. For example, flake8 can lint Cython with a few exceptions so I set up |
Here's where specifying two types seem to work: ansible/pylibssh@91bafcd |
very easy to check if you're curious: $ cat .pre-commit-config.yaml
repos:
- repo: meta
hooks:
- id: identity
name: identity (python, cython)
types: [python, cython]
- id: identity
name: identity (python)
types: [python]
- id: identity
name: identity (cython)
types: [cython]
$ pre-commit run --all-files
identity (python, cython)............................(no files to check)Skipped
- hook id: identity
identity (python)........................................................Passed
- hook id: identity
- duration: 0.03s
foo.py
identity (cython)........................................................Passed
- hook id: identity
- duration: 0.03s
foo.pyx
$ ls
foo.py foo.pyx |
Nvmd, I missed adding both python+cython in some places. |
yeah definitely didn't work :P
|
(yeah, I'm watching you live) |
(spooky) |
Do you think I should switch to |
I would do multiple hooks instead of using hooks:
- id: pydocstyle
name: pydocstyle (python)
- id: pydocstyle
name: pydocstyle (cython)
types: [cython] |
Right, it crossed my mind too. But then if there's multiple settings it's too much copy-paste. Like with flake8 + a bunch of plugins. |
up to you 🤷 -- if you override |
Did you think of some types-like setting that wouldn't work XOR-way? |
yes, during the original design there were use cases identified that required AND and I couldn't come up with any that required OR -- for that you'd check out #607 |
Well, now you have such a case... |
yeah there's several others in #607 (which is why the issue exists!) -- feel free to chip in on the design there, that's mostly where it is currently stalled I'm going to close this here since I believe this is "resolved" (as resolved as it could be) -- thanks for the issue! |
Most Python linters would work with Cython as well. I was using pydocstyle and thought that
*.pyx
files would be matched. Turned out they aren't.I tracked it to calling
identify
and it returns justcython
:What can we do to improve this? Should Python mean Python+Cython+python-like? Should Cython be separate? If yes, should the docs promote the need to also add cython more actively?
The text was updated successfully, but these errors were encountered: