prisma-client-py icon indicating copy to clipboard operation
prisma-client-py copied to clipboard

Default partials type file location confuses isort/ruff linter

Open sarchila opened this issue 1 year ago • 0 comments

Bug description

I followed the default location for partials / documented recommendation and created a prisma dir in my project, placed my partials definitions in ./prisma/partial_types.py and ran prisma generate to generate my new partial types, which worked well.

The issue, though, is that this file placement caused dozens of "unsorted imports" lint violations in my project according to isort/ruff default settings. Simply having a prisma dir in my project overloaded the prisma name which caused the linters to treat all prisma imports as no longer being a third party import.

I ended up setting the partial_type_generator config to override the default so as not to create a prisma dir that confuses the linters, but am thinking that having a different default would be better in the long run.

How to reproduce

  • Install ruff linter or isort linter in your project.
  • Run either linter with prisma imports treated as a third-party import. It should pass just fine.
  • Create ./prisma/partial_types.py file in your project.
  • Run either linter again after prisma dir is in the project. This should then confuse the linters and begin treating all prisma imports as no longer a third party import, triggering many unsorted imports linting errors.

Expected behavior

I would expect for the linter to continue to treat all prisma imports in my project as being grouped with third-party imports.

Prisma information

N/A

Environment & setup

  • OS: Mac OS
  • Python version: 3.11.2
  • Prisma version:
prisma                  : 4.11.0
prisma client python    : 0.8.2
platform                : darwin
expected engine version : 8fde8fef4033376662cad983758335009d522acb
installed extras        : []

sarchila avatar Jun 27 '23 05:06 sarchila