Hi question please. I have question please, if I h...
# general
a
Hi question please. I have question please, if I have an existing python project using poetry with following where i have this in my
pyproject.toml
Copy code
[tool.poetry.scripts]


[tool.black]
line-length = 120


[tool.isort]
profile = "black"
multi_line_output = 3 # Vertical Hanging Indent
line_length = 120
from_first = true
and a
tox.ini
file containing something like this
Copy code
[tox]
envlist = lint, pytest-ci, mypy, vulture
skipdist = true

[testenv:lint]
basepython = python3.9
allowlist_externals=*
list_dependencies_command=echo
commands =
    flake8 lambdas
    pylint lambdas --rcfile=.pylintrc
will pants pick up these configuration or there something I can do so it respects any of these configurations
h
Pants will pick up isort and black config from pyproject.toml, and also isort config from an
[isort]
section in tox.ini.
a
where do the tox.ini need to be located
if i have service-1 service-b do they be at the root of the project folder structure or do they need to be in each sub project (i.e. service-1), service-2
h
But note that it will not do anything with your
[testenv:lint]
section. That is configuration for
tox
itself, which is orthogonal to Pants
Pants uses config discovery logic that follows the config location rules of the underlying tool
So for example it'll look in the closest pyproject.toml up the filesystem that has the relevant section
for black config
same for isort, it looks like
You can also answer this question for yourself by trying it out...
1
a
for the
[testenv:lint]
how could I get it to run with pants?
tried it before for the tox.ini one but it blew up (probably because one of the tox.ini files was empty) at the root of the project
h
Those are tox commands. You need to find the equivalent Pants commands.
👀 1
For example, assuming you have set up flake8 and and pylint in pants, then
./pants lint lambas
is all you should need
a
that makes sense, and thanks for quick reply to my never ending questions
h
The pants pylint backend will automatically detect and use
.pylintrc
, again via config discovery, so you don't need to worry about specifying that
so it should just be a matter of enabling the backends for flake8 and pylint, and then
./pants lint lambdas
I assume
lambdas
is a top-level folder in your repo, yes?
a
yes
Copy code
root
lambdas
other-folders