Server not compatible with marshmallow-dataclass>8.5.3
See original GitHub issuemarshmallow-dataclass 8.5.3 works.
With marshmallow-dataclass 8.5.4 through 8.5.8, we get
$ lektor server
/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/marshmallow_dataclass/__init__.py:353: UserWarning: ****** WARNING ****** marshmallow_dataclass was called on the class <function NewType.<locals>.new_type at 0x7f0af2e076d0>, which is not a dataclass. It is going to try and convert the class into a dataclass, which may have undesirable side effects. To avoid this message, make sure all your classes and all the classes of their fields are either explicitly supported by marshmallow_dataclass, or define the schema explicitly using field(metadata=dict(marshmallow_field=...)). For more information, see https://github.com/lovasoa/marshmallow_dataclass/issues/51 ****** WARNING ******
warnings.warn(
Traceback (most recent call last):
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/dataclasses.py", line 1197, in fields
fields = getattr(class_or_instance, _FIELDS)
AttributeError: 'function' object has no attribute '__dataclass_fields__'. Did you mean: '__dataclass_params__'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/marshmallow_dataclass/__init__.py", line 350, in _internal_class_schema
fields: Tuple[dataclasses.Field, ...] = dataclasses.fields(clazz)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/dataclasses.py", line 1199, in fields
raise TypeError('must be called with a dataclass type or instance')
TypeError: must be called with a dataclass type or instance
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/marshmallow_dataclass/__init__.py", line 364, in _internal_class_schema
created_dataclass: type = dataclasses.dataclass(clazz)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/dataclasses.py", line 1185, in dataclass
return wrap(cls)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/dataclasses.py", line 1176, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/dataclasses.py", line 909, in _process_class
for b in cls.__mro__[-1:0:-1]:
AttributeError: 'function' object has no attribute '__mro__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/joe/miniconda3/envs/lektor/bin/lektor", line 8, in <module>
sys.exit(main())
File "/home/joe/wrkspc/lktr/lektor/lektor/cli.py", line 621, in main
cli.main(args=args, prog_name=name)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/joe/wrkspc/lktr/lektor/lektor/cli.py", line 336, in server_cmd
from lektor.devserver import run_server
File "/home/joe/wrkspc/lktr/lektor/lektor/devserver.py", line 9, in <module>
from lektor.admin import WebAdmin
File "/home/joe/wrkspc/lktr/lektor/lektor/admin/__init__.py", line 1, in <module>
from .webui import WebAdmin
File "/home/joe/wrkspc/lktr/lektor/lektor/admin/webui.py", line 12, in <module>
from lektor.admin.modules import api
File "/home/joe/wrkspc/lktr/lektor/lektor/admin/modules/api.py", line 137, in <module>
@_with_validated(_PathAndAlt)
File "/home/joe/wrkspc/lktr/lektor/lektor/admin/modules/api.py", line 97, in _with_validated
schema_class = mdcls.class_schema(param_type, base_schema=_SchemaBase)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/marshmallow_dataclass/__init__.py", line 339, in class_schema
return _internal_class_schema(clazz, base_schema, clazz_frame)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/marshmallow_dataclass/__init__.py", line 382, in _internal_class_schema
attributes.update(
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/marshmallow_dataclass/__init__.py", line 385, in <genexpr>
field_for_schema(
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/marshmallow_dataclass/__init__.py", line 707, in field_for_schema
or _internal_class_schema(typ, base_schema, typ_frame)
File "/home/joe/miniconda3/envs/lektor/lib/python3.10/site-packages/marshmallow_dataclass/__init__.py", line 367, in _internal_class_schema
raise TypeError(
TypeError: _PathType is not a dataclass and cannot be turned into one.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
marshmallow-dataclass - GitHub
Automatic generation of marshmallow schemas from dataclasses. ... marshmallow-dataclass. Build Status PyPI version marshmallow 3 compatible download stats.
Read more >marshmallow NewType can not be turned into a dataclass ...
My current install is python 3.10.6 and marshmallow_dataclasses 8.5.8. (The code was working with python 3.9 and marshmallow dataclasses ...
Read more >marshmallow-dataclass - PyPI
Python library to convert dataclasses into marshmallow schemas.
Read more >Upgrading to Newer Releases — marshmallow 3.19.0 ...
Python compatibility¶. The marshmallow 3.x series supports Python >= 3.5. Python 2.6, 2.7, 3.3, and 3.4 are no longer supported.
Read more >Software Packages in "jammy", Subsection python - Ubuntu
Python 3 module to discover ECMWF libraries. python3-edgegrid (1.1.1-0ubuntu1) [universe]: Authentication handler for Akamai OPEN EdgeGrid Authentication scheme ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I’m not sure where exactly this is a problem either, but I can at least confirm your fix!
works.
@dairiki It doesn’t look like that works, possibly because of some other issue with pkg_resources. Constraining marshmallow-dataclass directly might be the better option.