I want to invoke/use flake8 in my own python script and check the returning results. I do something like this with pycodestyle which I use as a unittest. I would like to do this with flake8, too. On the list I found a posting from 2015 about using flake8.main.main(). But it doesn't exist anymore.
Correct. That doesn't work. It's not presently designed to be used that way. I believe there's some work planned to enable that but in my opinion it's quite the anti-pattern. Users doing that often shoot themselves in the foot and things break between versions. Sent from my phone with my typo-happy thumbs. Please excuse my brevity On Mon, Jun 6, 2022, 15:04 <c.buhtz@posteo.jp> wrote:
I want to invoke/use flake8 in my own python script and check the returning results.
I do something like this with pycodestyle which I use as a unittest. I would like to do this with flake8, too. On the list I found a posting from 2015 about using flake8.main.main(). But it doesn't exist anymore. _______________________________________________ code-quality mailing list -- code-quality@python.org To unsubscribe send an email to code-quality-leave@python.org https://mail.python.org/mailman3/lists/code-quality.python.org/ Member address: graffatcolmingov@gmail.com
Dear Ian, thanks for the feedback. Am 06.06.2022 22:25 schrieb Ian Stapleton Cordasco:
it's quite the anti-pattern. Users doing that often shoot themselves in the foot and things break between versions.
Can you explain that a bit more in detail please. I am very interested in your expertise here. What is against PEP8 checking via unittest? I am also aware of pre-commit framework. But it is to much and to complex and yet another tool in the chain increasing the config error risk. My projects currently are to small to invest in something like this. Kind Christian
Response inline below. On Mon, Jun 6, 2022 at 4:48 PM <c.buhtz@posteo.jp> wrote:
Dear Ian,
thanks for the feedback.
Am 06.06.2022 22:25 schrieb Ian Stapleton Cordasco:
[snip] What is against PEP8 checking via unittest?
From my perspective, I see them as two different tools. For example, I run pytest for unit tests, black for styling, mypy for typing, isort for sorting imports, etc. for each commit.
I am also aware of pre-commit framework. But it is to much and to complex and yet another tool in the chain increasing the config error risk. My projects currently are to small to invest in something like this.
I've not used pre-commit so I can't comment on it exactly. In most of my projects, I have either a Makefile or a shell script to abstract away all of the individual tools behind a single thing that I can call. So instead of running unit tests I run `make tests` or `./runtests.sh` to run my unit tests and the rest of my tooling. I don't see that as a big hurdle or significantly complicating my own tool chain. How do you currently run your unit tests? -- david stanek web: https://dstanek.com twitter: https://twitter.com/dstanek linkedin: https://www.linkedin.com/in/dstanek/
On Mon, Jun 06, 2022 at 07:57:12PM +0000, c.buhtz@posteo.jp wrote:
I want to invoke/use flake8 in my own python script and check the returning results.
I do something like this with pycodestyle which I use as a unittest. I would like to do this with flake8, too. On the list I found a posting from 2015 about using flake8.main.main(). But it doesn't exist anymore.
You could always do a subprocess.run([sys.executable, "-m", "flake8", "src"], cwd=pathlib.Path(__here__).parent, check=True) or similar, but personally I prefer to add an extra [flake8] section to my tox.ini. Marius Gedminas -- I am right now in the process of reading the Xft source code (the suspense near the end of Chapter 7 is unbearable) [...] -- Juliusz Chroboczek
participants (4)
-
c.buhtz@posteo.jp
-
David Stanek
-
Ian Stapleton Cordasco
-
Marius Gedminas