taplo icon indicating copy to clipboard operation
taplo copied to clipboard

Poetry schema changes for upcomming v1.2

Open Cielquan opened this issue 3 years ago • 7 comments

Poetry v1.2 will introduce dependency groups which have there own entries in the pyproject.toml file.

I currently use the v1.2 alpha version and Even Better Toml throws me the "unknown property" error for those new keys or rather the first occurrence.

To declare a new dependency group, use a tool.poetry.group.<group> section where <group> is the name of your dependency group (for instance, test):

[tool.poetry.group.test]  # This part can be left out

[tool.poetry.group.test.dependencies]
pytest = "^6.0.0"
pytest-mock = "*"

Source: https://python-poetry.org/docs/master/managing-dependencies/

Cielquan avatar Jan 24 '22 10:01 Cielquan

Further, all development dependencies are moving to a group called dev. For instance:

[tool.poetry.group.dev.dependencies]
mypy           = "^0.950"
pytest         = "^6.0"
pytest-isort   = "^3.0.0"
pytest-flake8  = "^1.0"
pytest-black   = "^0.3.12"
pytest-datadir = "^1.3.1"

dcode avatar Apr 28 '22 16:04 dcode

Any update on this issue?

alanwilter avatar Jul 08 '22 10:07 alanwilter

I haven't worked on this, PRs are welcome.

tamasfe avatar Jul 08 '22 11:07 tamasfe

Is it just a matter of updating pyproject.toml.json? If so, I can give a try, I suppose.

alanwilter avatar Jul 08 '22 17:07 alanwilter

Yes, mostly, much appreciated!

It also has to be submitted to the schema store, as I've deprecated taplo's own hosted catalog, but it's a tiny task, you can submit the PR here and I'll do it or you can submit it directly to the schema store as well.

tamasfe avatar Jul 08 '22 18:07 tamasfe

Hai! :wave:

I'm working on this exact PR for SchemaStore on my add-schemas-taplo, copying everything over went pretty smoothly - just had to make several modifications since the schemas were being parsed in Strict Mode and add some other schemastore-specific metadata files. (Schemastore also has a similar issue for adding pyproject.toml)

I did have a question though, what is the uniqueness keyword in the JSON schema? It seems it's a part of some future JSON Schema standard, but I couldn't find any info about it when quickly perusing the reference. In my wip branch, I had to do a dirty hack so things would validate under strict mode, but i don't think I would want to keep that in my final PR

hyperupcall avatar Jul 17 '22 18:07 hyperupcall

I did have a question though, what is the uniqueness keyword in the JSON schema?

I have absolutely no idea, as far as I see it is in the dein schema, it was contributed by someone else. Taplo itself doesn't use it, nor is it used for validation if it's not part of any schema drafts.

tamasfe avatar Jul 17 '22 18:07 tamasfe

Poetry v.1.2.0rc1 was released a few days ago and it looks like poetry-core has an update-to-date JSON schema here.

Maybe this helps? 😄

willfrey avatar Aug 25 '22 17:08 willfrey

It also looks poetry has an additional JSON schema that includes, at least, the schema for tool.poetry.source.

willfrey avatar Aug 25 '22 17:08 willfrey

Cool - any updates now would go through schemastore repository, since the taplo schemas were moved over there. I think I forgot to mention in this thread, but it was merged there on July 23

There have been a few updates to the pyproject.json in particular, but I don't think any of them cover the v1.2.0 updates

hyperupcall avatar Aug 25 '22 18:08 hyperupcall

@hyperupcall @tamasfe @Cielquan I have backported all the recent changes from the Poetry schema (and then some).
See https://github.com/SchemaStore/schemastore/pull/2443.

claui avatar Aug 29 '22 12:08 claui

Update: the changes have been merged into schemastore.
@tamasfe What would be the next step to have taplo (and the VS Code extension) pick up the updated schema?

claui avatar Aug 29 '22 18:08 claui

Thank you! There should be no further action needed, the schema should be fetched as the cache expires.

tamasfe avatar Sep 03 '22 10:09 tamasfe