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

Error on subclassing Dict[Any, ...] #657

Closed
Jasha10 opened this issue Apr 1, 2021 · 5 comments
Closed

Error on subclassing Dict[Any, ...] #657

Jasha10 opened this issue Apr 1, 2021 · 5 comments
Milestone

Comments

@Jasha10
Copy link
Collaborator

Jasha10 commented Apr 1, 2021

Based on #502 (comment), it is proposed to deprecate support for structured configs that subclass Dict[Any, ...], with only subclasses of Dict[str, ...] being supported going forward.

For example, creating a structured config node based on the following dataclass would issue a deprecation warning,

@dataclass
class MyConf(Dict[int, Any]):
    ...

while a structured config node based on the following would be fully supported:

@dataclass
class MyConf(Dict[str, Any]):
    ...
@omry
Copy link
Owner

omry commented Apr 1, 2021

class MyConf(Dict[int, Any])

This is not supported in 2.0, we can just straight to error with it.

@Jasha10 Jasha10 changed the title Deprecate structured config subclassing Dict[Any, ...] Error on subclassing Dict[Any, ...] May 6, 2021
@Jasha10 Jasha10 modified the milestones: OmegaConf 2.2, OmegaConf 2.1 May 6, 2021
@omry
Copy link
Owner

omry commented May 11, 2021

I think the idea is that this is is a reminder for 2.2 to remove the deprecation warning from extending Dict and make it an error. (We can also just allow but completely ignore it).

@Jasha10
Copy link
Collaborator Author

Jasha10 commented May 12, 2021

I thought the idea was that subclassing Dict[str, str] is deprecated and subclassing Dict[int, str] or Dict[Any, str] should throw an error...

If you still want to go that route, I can try to get a PR ready tonight.

@omry
Copy link
Owner

omry commented May 12, 2021

Oh yeah, sorry.

@Jasha10
Copy link
Collaborator Author

Jasha10 commented May 17, 2021

Closing since we've already deprecated subclassing Dict in general.

@Jasha10 Jasha10 closed this as completed May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants