Skip to content

pyproject.toml does not mean you want to use poetry #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eide opened this issue Feb 27, 2019 · 6 comments · Fixed by #344
Closed

pyproject.toml does not mean you want to use poetry #324

eide opened this issue Feb 27, 2019 · 6 comments · Fixed by #344

Comments

@eide
Copy link

eide commented Feb 27, 2019

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.

@dschep
Copy link
Contributor

dschep commented Feb 27, 2019

Thanks for the push. I was concerned about this potentially being an issue: #308 (comment) & #308 (comment)

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?

@aalvrz
Copy link

aalvrz commented Feb 28, 2019

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.

@eide
Copy link
Author

eide commented Mar 1, 2019

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 😞

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.

@s16h
Copy link

s16h commented Apr 5, 2019

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

@aalvrz
Copy link

aalvrz commented Apr 5, 2019

@s16h

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

pythonRequirements:
    usePoetry: false

@squaresurf
Copy link
Contributor

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

@khornberg khornberg mentioned this issue Aug 19, 2019
miketheman added a commit to miketheman/serverless-python-requirements that referenced this issue Feb 25, 2020
During the evaluation in the package phase, we determine whether a
`requirements.txt` file exists, or whether we need to generate one.

Since the `pyproject.toml` file is used by poetry, but only if a stanza
is contained inside the file, use the function `isPoetryProject()` along
with the configuration value, thereby reducing the need for a project to
have to declare a configuration override.

Refs serverless#324
Refs serverless#344
Fixes serverless#400

Signed-off-by: Mike Fiedler <[email protected]>
miketheman added a commit to miketheman/serverless-python-requirements that referenced this issue Feb 25, 2020
During the evaluation in the package phase, we determine whether a
`requirements.txt` file exists, or whether we need to generate one.

Since the `pyproject.toml` file is used by poetry, but only if a stanza
is contained inside the file, use the function `isPoetryProject()` along
with the configuration value, thereby reducing the need for a project to
have to declare a configuration override.

Refs serverless#324
Refs serverless#344
Fixes serverless#400

Signed-off-by: Mike Fiedler <[email protected]>
miketheman added a commit to miketheman/serverless-python-requirements that referenced this issue Feb 28, 2020
During the evaluation in the package phase, we determine whether a
`requirements.txt` file exists, or whether we need to generate one.

Since the `pyproject.toml` file is used by poetry, but only if a stanza
is contained inside the file, use the function `isPoetryProject()` along
with the configuration value, thereby reducing the need for a project to
have to declare a configuration override.

Refs serverless#324
Refs serverless#344
Fixes serverless#400

Signed-off-by: Mike Fiedler <[email protected]>
bsamuel-ui pushed a commit that referenced this issue May 4, 2020
During the evaluation in the package phase, we determine whether a
`requirements.txt` file exists, or whether we need to generate one.

Since the `pyproject.toml` file is used by poetry, but only if a stanza
is contained inside the file, use the function `isPoetryProject()` along
with the configuration value, thereby reducing the need for a project to
have to declare a configuration override.

Refs #324
Refs #344
Fixes #400

Signed-off-by: Mike Fiedler <[email protected]>
Aubtin pushed a commit to Aubtin/serverless-python-requirements that referenced this issue Sep 16, 2020
During the evaluation in the package phase, we determine whether a
`requirements.txt` file exists, or whether we need to generate one.

Since the `pyproject.toml` file is used by poetry, but only if a stanza
is contained inside the file, use the function `isPoetryProject()` along
with the configuration value, thereby reducing the need for a project to
have to declare a configuration override.

Refs serverless#324
Refs serverless#344
Fixes serverless#400

Signed-off-by: Mike Fiedler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants