your-tools / tbump

Bump software releases
BSD 3-Clause "New" or "Revised" License
158 stars 22 forks source link

Error: Invalid config: Key 'file' error using `pyproject.toml` #103

Closed tomvothecoder closed 3 years ago

tomvothecoder commented 3 years ago

I am attempting to use the existing pyproject.toml file instead of a separate tbump config file.

However, I am getting the following error:

Error: Invalid config: Key 'file' error:
Or(Schema({'src': <class 'str'>, Optional('search'): <class 'str'>, Optional('version_template'): <class 'str'>})) did not validate {'src': '...'}
Schema({'src': <class 'str'>, Optional('search'): <class 'str'>, Optional('version_template'): <class 'str'>}).validate({'src': '...'}) raised TypeError("__init__() missing 3 required positional arguments: 'value', 'trivia', and 'is_aot_element'")

Steps to reproduce:

  1. tbump init --pyproject <current_version>
  2. tbump <new_version>

The same config works fine in tbump.toml file.

Also, thanks for the work on this project. It helps with release candidates that use the PEP format.

dmerejkowsky commented 3 years ago

It looks like an issue with latest version of tomlkit and schema ...

import schema
import tomlkit

foo_schema = schema.Schema({"foo": str})
table = tomlkit.table()
table.add("foo", 42)
foo_schema.validate(table)
Traceback (most recent call last):
  File "/mnt/data/dmerej/src/tbump/toml_validation.py", line 8, in <module>
    foo_schema.validate(table)
  File "/home/dmerej/.cache/pypoetry/virtualenvs/tbump-AVGABPqS-py3.9/lib/python3.9/site-packages/schema.py", line 361, in validate
    new = type(data)()  # new - is a dict of the validated values
TypeError: __init__() missing 3 required positional arguments: 'value', 'trivia', and 'is_aot_element'
dmerejkowsky commented 3 years ago

Fixed in 1edcf069ea4bbcba92536bcb2a8e5352e04eb987