Skip to content
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

Requesting JSON Schema for virtualenvs in poetry-core #9441

Closed
jamesbraza opened this issue May 24, 2024 · 8 comments
Closed

Requesting JSON Schema for virtualenvs in poetry-core #9441

jamesbraza opened this issue May 24, 2024 · 8 comments
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@jamesbraza
Copy link

jamesbraza commented May 24, 2024

Issue Kind

Brand new capability

Description

Poetry's configuration has a JSON schema here: https://github.com/python-poetry/poetry-core/blob/1.9.0/src/poetry/core/json/schemas/poetry-schema.json

However, there isn't a JSON schema for Poetry's virtualenvs.*: https://python-poetry.org/docs/configuration/#virtualenvscreate

Since virtualenvs.* has a separate namespace from tool.poetry, I think it merits adding a second JSON schema to poetry-core.

Impact

https://github.com/abravalheri/validate-pyproject is a pyproject.toml validation tool that centers on schema validation pulling from SchemaStore (e.g. https://github.com/SchemaStore/schemastore/blob/61a602f23b44eca3c34e630bb4554d0a84f77309/src/schemas/json/partial-poetry.json). Without a schema there for virtualenvs, Poetry configs with virtualenvs will encounter validation failures:

Invalid file: pyproject.toml
[ERROR] `data` must not contain {'virtualenvs'} properties

Thus, the impact is enabling use of https://github.com/abravalheri/validate-pyproject with advanced Poetry configs.


I just merged SchemaStore/schemastore#3807 to add SchemaStore support for packages.to, but this one is a bigger lift I need help with.

Workarounds

None

@jamesbraza jamesbraza added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels May 24, 2024
@dimbleby
Copy link
Contributor

you have confused the project definition pyproject.toml (which does have a schema) and poetry configuration (which does not).

virtualenvs is correctly omitted from the schema that you have found because it does not belong there

please close

@jamesbraza
Copy link
Author

jamesbraza commented May 24, 2024

So Poetry invented the virtualenvs section, right? Shouldn't then Poetry have a second schema for it?

virtualenvs is correctly omitted from the schema that you have found because it does not belong there

Yeah I know that, hence why I think a second file should be made in poetry-core/src/poetry/core/json/schemas/

@dimbleby
Copy link
Contributor

none of this goes in pyproject.toml

why are you making a special case of virtualenvs? are you really asking for a schema for poetry configuration, but for some reason this particular configuration option is important to you?

@jamesbraza
Copy link
Author

jamesbraza commented May 24, 2024

Yeah sorry for confusion, to clarify what I am asking for:

  1. People put a [virtualenvs] section in their pyproject.toml for Poetry. Check this GitHub Advanced Search for examples: https://github.com/search?q=%5Bvirtualenvs%5D+path%3A**%2Fpyproject.toml&type=code&ref=advsearch

  2. The pyproject.toml then gets validated by https://github.com/abravalheri/validate-pyproject

  3. Which fails because https://github.com/SchemaStore/schemastore has no JSON schema for virtualenvs, and gives this error:

    Invalid file: pyproject.toml
    [ERROR] `data` must not contain {'virtualenvs'} properties
    

So the correct route is:

  1. Have poetry-core specify a second JSON schema file, for virtualenvs
  2. Copy that file to SchemaStore

Does that make sense?

@dimbleby
Copy link
Contributor

dimbleby commented May 24, 2024

People put [virtualenvs] sections in their pyproject.toml.

that has nothing to do with poetry, is not a poetry invention, and should not be schema-d by poetry

you have confused poetry configuration with something that has the same name

edit: or, the people who are doing that are simply wrong and schema validation is correctly telling them so

@dimbleby
Copy link
Contributor

related #2937

please close

@jamesbraza
Copy link
Author

Ah I see, thank you for linking that issue. Closing this out, cheers!

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants