Comments (6)
I like the idea, I just don't know how we would make it work. If two packages define the command as an entry point, here flake8
, then wouldn't it depend on install order which package gets called?
from flake8-pyproject.
That's a very good question that I don't know the answer haha I think ppl from flake9 are directly modifying the flake8 source 🤔
from flake8-pyproject.
Yeah, flake9 seems to have vendored flake8, that's how they do it.
from flake8-pyproject.
Maybe there is a way to do this if we get Flake8 to run the code here as a plug-in. Then we could patch it live whenever the regular flake8
entry point is invoked. I think. I haven't quite figured out yet how to do it and if it'll actually work.
from flake8-pyproject.
Maybe there is a way to do this if we get Flake8 to run the code here as a plug-in. Then we could patch it live whenever the regular
flake8
entry point is invoked. I think. I haven't quite figured out yet how to do it and if it'll actually work.
This caused me to do a bit of code-diving, the result is in #8.
from flake8-pyproject.
@vcalvert As far as I can tell, your code does not work as is.
I played around with this a bit more, but I think (and I could be wrong) that as of Flake8 5.0, plug-ins are loaded after the configuration files, whereas it was the other way around before. (Again, I could be wrong.) So by the time the plug-ins are loaded, it might be too late to monkey-patch the loading of the configuration files. See Application.initialize().
But there's another step that happens after the plug-ins are loaded, when Flake8 calls parse_configuration_and_cli(), which ultimately calls options.aggregator.aggregate_options(). Since that happens after the configuration files are loaded, I think we could hook in there with a plug-in.
However, the behavior may be somewhat different then. This "merges" options with whatever was previously loaded. So that could mean configuration files not named pyproject.toml
in parent folders of the current working directory. Which doesn't sound so bad, but is different from what the flake8p
entry point currently does: It just looks at pyproject.toml
if it finds it in the working directory, but then disregards all other files. Might not be a deal-breaker, just a difference. And also, as you mentioned in the PR, this might be the behavior Flake8 would implement eventually, via "configuration plug-ins". So maybe this is the right approach. I just haven't made up my mind yet.
from flake8-pyproject.
Related Issues (14)
- Flake8 `--config` option not supported HOT 11
- Does not support Flake8 6+ HOT 5
- Running via Flake8 pre-commit hook HOT 4
- Remove upper pinning for flake 8 and add test for flake8 main HOT 1
- Support `flake8:local-plugins` HOT 6
- the name case HOT 1
- parse_args() used in hook.py HOT 6
- Alternatives to this project? HOT 12
- Flake8-pyproject doesn't work with flake8 `6.1.0` HOT 2
- Unrecognized argument toml config HOT 2
- Does not support Flake8 5+ HOT 1
- `flake8p` is only aware of `pyproject.toml` in the current folder HOT 1
- Error with `flake8-mock` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake8-pyproject.