Serverless-python-requirements: pyproject.toml does not mean you want to use poetry

Created on 27 Feb 2019  路  6Comments  路  Source: UnitedIncome/serverless-python-requirements

After adding a pyproject.toml file to configure https://github.com/ambv/black this plugins suddenly outputs "poetry not found! Install it according to the poetry docs.".

I do not intend to use poetry, and PEP-518 is not in any way tied to poetry alone.

As a workaround I know I can add usePoetry: false to serverless.yml, but I don't think it's a good idea to automatically tie pyproject.toml to poetry as there are other use cases for it.

Most helpful comment

I have not studied PEP 518 since I just wanted to do some simple configuration for black, so I'm not the best source here :disappointed:

From my simple understanding you have to look at the requires key under the build-system table. This will be an array that either contains "setuptools", "wheel", "flit" or "poetry".

Example:

[build-system]
requires = ["setuptools", "wheel"]

If I understand correctly ["setuptools", "wheel"] means you want to use setup.py. The other two are pretty self explanatory and means you want to use "flit" or "poetry".

So I think for simplicity you can assume that if [build-system] is _not_ present, or requires is anything else than ["poetry"] the user does not want to use poetry.

All 6 comments

Thanks for the push. I was concerned about this potentially being an issue: https://github.com/UnitedIncome/serverless-python-requirements/pull/308#discussion_r249251517 & https://github.com/UnitedIncome/serverless-python-requirements/pull/308#issuecomment-463204257

Am I right in reading pep 518 that there's no explicit declaration in the toml of what tool is being used? Should the plugin infer that you're using poetry if there's a [tool.poetry] section?

I am having the same issue after adding Black to my project, here is my pyproject.toml file:

[tool.black]
line-length = 79
py36 = true
skip-string-normalization = true
exclude = '''
/(
    \.serverless
    | node_modules
)/
'''

Poetry isn't referenced anywhere. This should not be the default behavior.

I have not studied PEP 518 since I just wanted to do some simple configuration for black, so I'm not the best source here :disappointed:

From my simple understanding you have to look at the requires key under the build-system table. This will be an array that either contains "setuptools", "wheel", "flit" or "poetry".

Example:

[build-system]
requires = ["setuptools", "wheel"]

If I understand correctly ["setuptools", "wheel"] means you want to use setup.py. The other two are pretty self explanatory and means you want to use "flit" or "poetry".

So I think for simplicity you can assume that if [build-system] is _not_ present, or requires is anything else than ["poetry"] the user does not want to use poetry.

What's the status on fixing this? I, too, have added pyproject.toml to use Black.

@s16h

What I did in my case was to disable poetry from the Python Requirements configuration in serverless.yml:

pythonRequirements:
    usePoetry: false

@s16h as @BigChief45 mentioned, you can explicitly disable poetry. I will do my best to try and work on this next week.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miketheman picture miketheman  路  3Comments

cdimitroulas picture cdimitroulas  路  4Comments

bsamuel-ui picture bsamuel-ui  路  3Comments

calclavia picture calclavia  路  5Comments

tmclaugh picture tmclaugh  路  4Comments