Handling monorepo setup
jarikujansuu opened this issue · 2 comments
Describe the bug
We got a monorepo setup so in a single repository we have multiple Python projects attached to it, so something like this
/ --- root is not a Python project but Typescript CDK project
/service/X --- dockerised service
/lambda/A. --- bunch of AWS Lambdas
/lambda/B
/lambda/C
....
So all of those are separate Python setups with their own environments, all should have the same formatting rules
I tried enabling the Ruff plugin and the formatting feature and tested with that service "X". Without pointing to any configs it formatted the file with default settings instead of reading the current configs from the module pyproject.toml
file.
If I then point the config file to service/X/pyproject.toml
the code is formatted correctly but it doesn't recognize which are 3rd party and which are my imports so imports are moved to the wrong order
We have in pyproject.toml
the following section, which doesn't seem to have any effect here
[tool.ruff.isort]
combine-as-imports = true
known-first-party = ["src", "tests"]
If I open the subproject (service/X) instead the root of the repository formatting seems to work correctly, so it reads the line length from pyproject.toml
and also knows which are own and which are 3rd party imports
Expected behavior
The plugin should read the configs from the subproject even if open the repository root in Pycharm.
Environments (please complete the following information):
- IDE: [PyCharm Professional 2023.2.3 ]
- OS: [macOS 14.1]
- Ruff Version [0.1.6 ]
- Plugin version [0.0.27 ]
@jarikujansuu
Thank you for creating the issue.
First, does ruff by itself without this plugin load the configuration file as expected?
Because if you read here, ruff will properly go to load the closest pyproject.toml, so I don't think there is any need to do any detailed configuration here.
https://docs.astral.sh/ruff/configuration/#config-file-discovery
Unless you specify the config file path in the plugin configuration, the plugin will just run ruff from the project root.
@jarikujansuu
I have fixed the version 0.0.29
Thank you very much!!