Closed GiacomoPope closed 2 months ago
Many of the F401
issues are because of: https://github.com/PyCQA/pyflakes/issues/471 -- I suppose we should decide about whether to follow best practices and define an __all__
After the above fixes we're at
Jack: python-flint % ruff check --statistics
21 F401 unused-import
Related to the comment above.
we should decide about whether to follow best practices and define an
__all__
Yes, I think that __all__
should be defined but which files does it want it on?
Is it only the .pyx files or does it also want it in .pxd files?
Also we should remove all import *
.
The __all__
seems to be only needed in the */__init__.py
files as far as I can tell. I have also reenabled F403 so we eventually remove the * imports.
Jack: python-flint % ruff check --statistics
27 F403 undefined-local-with-import-star
21 F401 unused-import
I will be busy now potentially until the end of the week. Feel free to merge / ignore this if you want and we can continue work whenever.
actually, i think I have misunderstood ruff, the above has ONLY checked python files.
Jack: python-flint % ruff check src/flint/types/fq_default.pyx --statistics
203 syntax-error
This means I must have missed some flag for the cython files and there might be a LOT more work to do. I will have to look into this more after this week
I was a bit surprised that this didn't involve changing 10,000 or so lines...
we should probably just close this, im not sure this PR really helps with anything currently.
I also ran
Jack: python-flint % cython-lint src/flint/types/*.pyx
Jack: python-flint % cython-lint --version
0.16.0
on main and got no errors.
The actual changes here to the code are mostly not needed or not correct so I guess that the ruff configuration would need to be improved to be useful. I think it could be possible to improve that but it requires choosing which ruff rules to use and configuring them.
Obviously feel free to close if you don't want to work on it.
The cython-lint checks pass now but note that lots of checks are disabled: https://github.com/flintlib/python-flint/blob/be0e41057339b71321d9539558bf054266540cea/pyproject.toml#L42-L45 We would probably not want to ignore all of those but enabling each one would likely then require making some changes somewhere in the codebase.
OK -- I'll close this for now and if I feel like refactoring I'll look at removing elements from the ignore list and refactoring for each one potentially.
Currently
ruff.toml
is the default settings, feel free to suggest changes.The current output of
ruff
statistics is:I will try and fix these one at a time in some commits.