question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

typing.Set is not supported

See original GitHub issue
@add_schema
@dataclass
class Stuff:
    id: str
    items: Set[str]

The above fails with TypeError: typing.Set[str] is not a dataclass and cannot be turned into one.

I often use sets to ensure de-duplication, so it would be nice if it actually constructed a set every time.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lovasoacommented, Sep 18, 2020

let’s keep this open. Once the feature is implemented in marshmallow and we check it works with marshmallow dataclass, we’ll close this.

0reactions
mivadecommented, Dec 24, 2020

As a workaround (not for sets, but for the frozen aspect) you should be able to specify frozen=False in the dataclass decorator. Of course this only works if you want every member of the instance to be immutable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typing — Support for type hints — Python 3.11.1 documentation
Source code: Lib/typing.py This module provides runtime support for type hints. The most fundamental support consists of the types Any, Union, Callable, ...
Read more >
What's the best practice of typing hint after python 3.9?
You should be using the set[str] style of typing. Looking at PEP 585: Importing those from typing is deprecated. Due to PEP 563...
Read more >
Implement PEP 585 (Generic builtins and __future__ ...
MyPy tells me "defaultdict" is not subscriptable, use "typing. ... Similarly, dict , set , tuple and frozenset shouldn't be subscriptable, ...
Read more >
Type hinting in PyCharm - JetBrains
PyCharm supports type hinting in function annotations and type ... Type comments with unpacking do not match the corresponding targets.
Read more >
Solved: Error in update set "Type change not allowed."Cann...
Solved: Hi Actually, I had 2 fields namely "Application" &"Original request" on exceptions table. Both are string fields. Now I.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found