
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
Available attributes are not found & side effects in pydantic.dataclasses.dataclass Β· Issue #4695 Β· pydantic/pydantic
Description:
Initial Checks I have searched GitHub for a duplicate issue and I'm sure this is something new I have searched Google & StackOverflow for a solution and couldn't find anything I have re...
Website Age:
17 years and 8 months (reg. 2007-10-09).
Matching Content Categories {π}
- Technology & Computing
- Social Networks
- Mobile Technology & AI
Content Management System {π}
What CMS is github.com built with?
Github.com operates using WORDPRESS.
Traffic Estimate {π}
What is the average monthly size of github.com audience?
ππ Tremendous Traffic: 10M - 20M visitors per month
Based on our best estimate, this website will receive around 10,653,926 visitors per month in the current month.
check SE Ranking
check Ahrefs
check Similarweb
check Ubersuggest
check Semrush
How Does Github.com Make Money? {πΈ}
Subscription Packages {π³}
We've located a dedicated page on github.com that might include details about subscription plans or recurring payments. We identified it based on the word pricing in one of its internal links. Below, you'll find additional estimates for its monthly recurring revenues.How Much Does Github.com Make? {π°}
Subscription Packages {π³}
Prices on github.com are in US Dollars ($).
They range from $4.00/month to $21.00/month.
We estimate that the site has approximately 5,316,180 paying customers.
The estimated monthly recurring revenue (MRR) is $22,327,958.
The estimated annual recurring revenues (ARR) are $267,935,490.
Wordpress Themes and Plugins {π¨}
What WordPress theme does this site use?
It is strange but we were not able to detect any theme on the page.
What WordPress plugins does this website use?
It is strange but we were not able to detect any plugins on the page.
Keywords {π}
pydantic, bar, issue, dataclass, code, bug, prettywood, sign, attributes, side, effects, import, attribute, config, printget, attr, getattrconfig, dog, unconfirmed, pull, pydanticdataclassesdataclass, jannisborn, github, find, dataclasses, cat, dataclassdefaultconfig, setattrconfig, dataclassproxy, version, data, type, mentioned, navigation, requests, actions, security, found, closed, description, searched, docs, fastapi, mypy, field, makedataclass, defaultconfig, print, line, object,
Topics {βοΈ}
/users/jab/miniconda3/envs/gt4sd/lib/python3 dataclasses import field typing import classvar code runs successfully orm mode plugins comment metadata assignees dataclasses import dataclass pull request unconfirmed type type projects searched github duplicate issue docs classvar[str] pydantic v1 bug side effects response python python-devtools 'dataclassproxy' object cls_name=foo json dummy dataclass calling dataclass config = dataclass description provided objects field default=foo passed object conda-forge support assignment projects milestone milestone relationships personal information issue print cat tools - mypy find anymore private attributes dataclasses code github v1 bar attribute attribute 'bar' pydantic make_dataclass foo pending
Payment Methods {π}
- Braintree
Questions {β}
- Already have an account?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:Available attributes are not found & side effects in pydantic.dataclasses.dataclass
articleBody:### Initial Checks
- [X] I have searched GitHub for a duplicate issue and I'm sure this is something new
- [X] I have searched Google & StackOverflow for a solution and couldn't find anything
- [X] I have read and followed [the docs](https://pydantic-docs.helpmanual.io) and still think this is a bug
- [X] I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like [FastAPI](https://fastapi.tiangolo.com) or [mypy](https://mypy.readthedocs.io/en/stable))
### Description
Since `v1.10.*`, it seems that pydantic does not find anymore certain attributes even though they are available in the classes. Moreover, it seems that `pydantic.dataclasses.dataclass` has some side effects on the provided objects now.
Consider the following MWE where we set up a dummy dataclass
```py
from dataclasses import dataclass as vanilla_dataclass
from dataclasses import field, make_dataclass
from typing import ClassVar
from pydantic.dataclasses import dataclass
class Foo():
bar: str = 'cat'
default_config = make_dataclass(
cls_name=Foo.__name__,
bases=(vanilla_dataclass(Foo),),
fields=[("bar", ClassVar[str], field(default=Foo.bar))]
)
```
Then, we pass this dataclass to pydantic and subsequently ask for the `bar` attribute:
```py
config = dataclass(default_config)
print("Get Attr", getattr(config, "bar"))
setattr(config, "bar", 'dog')
print("Get Attr", getattr(config, "bar"))
```
In `pydantic<=1.9.2`, this code runs successfully and will first print `cat` and then `dog`.
However since `v1.10.*` the second last line (`setattr(config, "bar", "dog")`) will raise:
```py
AttributeError: 'DataclassProxy' object has no attribute 'bar'
```
This is surprising because the attribute is actually there! The third last line will find the attribute and print its value ("cat").
Even more suprisingly, it seems that this issue can be fixed upon calling `dataclass` twice.
```py
config = dataclass(default_config)
config = dataclass(default_config)
print("Get Attr", getattr(config, "bar"))
setattr(config, "bar", 'dog')
print("Get Attr", getattr(config, "bar"))
```
will run through.
This seems to suggest that `dataclass` has some side effects on the passed object (`default_config`).
It would be great to hear your thoughts on this.
### Example Code
_No response_
### Python, Pydantic & OS Version
```Text
pydantic version: 1.10.2
pydantic compiled: True
install path: /Users/jab/miniconda3/envs/gt4sd/lib/python3.8/site-packages/pydantic
python version: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:47) [Clang 12.0.1 ]
platform: macOS-10.16-x86_64-i386-64bit
optional deps. installed: ['typing-extensions']
```
### Affected Components
- [X] [Compatibility between releases](https://pydantic-docs.helpmanual.io/changelog/)
- [ ] [Data validation/parsing](https://pydantic-docs.helpmanual.io/usage/models/#basic-model-usage)
- [ ] [Data serialization](https://pydantic-docs.helpmanual.io/usage/exporting_models/) - `.dict()` and `.json()`
- [ ] [JSON Schema](https://pydantic-docs.helpmanual.io/usage/schema/)
- [X] [Dataclasses](https://pydantic-docs.helpmanual.io/usage/dataclasses/)
- [ ] [Model Config](https://pydantic-docs.helpmanual.io/usage/model_config/)
- [ ] [Field Types](https://pydantic-docs.helpmanual.io/usage/types/) - adding or changing a particular data type
- [X] [Function validation decorator](https://pydantic-docs.helpmanual.io/usage/validation_decorator/)
- [ ] [Generic Models](https://pydantic-docs.helpmanual.io/usage/models/#generic-models)
- [ ] [Other Model behaviour](https://pydantic-docs.helpmanual.io/usage/models/) - `construct()`, pickling, private attributes, ORM mode
- [ ] [Plugins](https://pydantic-docs.helpmanual.io/) and integration with other tools - mypy, FastAPI, python-devtools, Hypothesis, VS Code, PyCharm, etc.
author:
url:https://github.com/jannisborn
type:Person
name:jannisborn
datePublished:2022-10-31T18:29:55.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:1
url:https://github.com/4695/pydantic/issues/4695
context:https://schema.org
headline:Available attributes are not found & side effects in pydantic.dataclasses.dataclass
articleBody:### Initial Checks
- [X] I have searched GitHub for a duplicate issue and I'm sure this is something new
- [X] I have searched Google & StackOverflow for a solution and couldn't find anything
- [X] I have read and followed [the docs](https://pydantic-docs.helpmanual.io) and still think this is a bug
- [X] I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like [FastAPI](https://fastapi.tiangolo.com) or [mypy](https://mypy.readthedocs.io/en/stable))
### Description
Since `v1.10.*`, it seems that pydantic does not find anymore certain attributes even though they are available in the classes. Moreover, it seems that `pydantic.dataclasses.dataclass` has some side effects on the provided objects now.
Consider the following MWE where we set up a dummy dataclass
```py
from dataclasses import dataclass as vanilla_dataclass
from dataclasses import field, make_dataclass
from typing import ClassVar
from pydantic.dataclasses import dataclass
class Foo():
bar: str = 'cat'
default_config = make_dataclass(
cls_name=Foo.__name__,
bases=(vanilla_dataclass(Foo),),
fields=[("bar", ClassVar[str], field(default=Foo.bar))]
)
```
Then, we pass this dataclass to pydantic and subsequently ask for the `bar` attribute:
```py
config = dataclass(default_config)
print("Get Attr", getattr(config, "bar"))
setattr(config, "bar", 'dog')
print("Get Attr", getattr(config, "bar"))
```
In `pydantic<=1.9.2`, this code runs successfully and will first print `cat` and then `dog`.
However since `v1.10.*` the second last line (`setattr(config, "bar", "dog")`) will raise:
```py
AttributeError: 'DataclassProxy' object has no attribute 'bar'
```
This is surprising because the attribute is actually there! The third last line will find the attribute and print its value ("cat").
Even more suprisingly, it seems that this issue can be fixed upon calling `dataclass` twice.
```py
config = dataclass(default_config)
config = dataclass(default_config)
print("Get Attr", getattr(config, "bar"))
setattr(config, "bar", 'dog')
print("Get Attr", getattr(config, "bar"))
```
will run through.
This seems to suggest that `dataclass` has some side effects on the passed object (`default_config`).
It would be great to hear your thoughts on this.
### Example Code
_No response_
### Python, Pydantic & OS Version
```Text
pydantic version: 1.10.2
pydantic compiled: True
install path: /Users/jab/miniconda3/envs/gt4sd/lib/python3.8/site-packages/pydantic
python version: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:47) [Clang 12.0.1 ]
platform: macOS-10.16-x86_64-i386-64bit
optional deps. installed: ['typing-extensions']
```
### Affected Components
- [X] [Compatibility between releases](https://pydantic-docs.helpmanual.io/changelog/)
- [ ] [Data validation/parsing](https://pydantic-docs.helpmanual.io/usage/models/#basic-model-usage)
- [ ] [Data serialization](https://pydantic-docs.helpmanual.io/usage/exporting_models/) - `.dict()` and `.json()`
- [ ] [JSON Schema](https://pydantic-docs.helpmanual.io/usage/schema/)
- [X] [Dataclasses](https://pydantic-docs.helpmanual.io/usage/dataclasses/)
- [ ] [Model Config](https://pydantic-docs.helpmanual.io/usage/model_config/)
- [ ] [Field Types](https://pydantic-docs.helpmanual.io/usage/types/) - adding or changing a particular data type
- [X] [Function validation decorator](https://pydantic-docs.helpmanual.io/usage/validation_decorator/)
- [ ] [Generic Models](https://pydantic-docs.helpmanual.io/usage/models/#generic-models)
- [ ] [Other Model behaviour](https://pydantic-docs.helpmanual.io/usage/models/) - `construct()`, pickling, private attributes, ORM mode
- [ ] [Plugins](https://pydantic-docs.helpmanual.io/) and integration with other tools - mypy, FastAPI, python-devtools, Hypothesis, VS Code, PyCharm, etc.
author:
url:https://github.com/jannisborn
type:Person
name:jannisborn
datePublished:2022-10-31T18:29:55.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:1
url:https://github.com/4695/pydantic/issues/4695
Person:
url:https://github.com/jannisborn
name:jannisborn
url:https://github.com/jannisborn
name:jannisborn
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:1
interactionType:https://schema.org/CommentAction
userInteractionCount:1
External Links {π}(16)
- What are the earnings of https://github.blog?
- How much profit does https://pydantic-docs.helpmanual.io generate?
- What's the financial intake of https://fastapi.tiangolo.com?
- What is the earnings of https://mypy.readthedocs.io/en/stable?
- Find out how much https://pydantic-docs.helpmanual.io/changelog/ earns monthly
- What are the total earnings of https://pydantic-docs.helpmanual.io/usage/models/#basic-model-usage?
- Profit of https://pydantic-docs.helpmanual.io/usage/exporting_models/
- How much revenue does https://pydantic-docs.helpmanual.io/usage/schema/ generate?
- https://pydantic-docs.helpmanual.io/usage/dataclasses/'s financial summary
- Check the income stats for https://pydantic-docs.helpmanual.io/usage/model_config/
- How much revenue does https://pydantic-docs.helpmanual.io/usage/types/ generate?
- Explore the financials of https://pydantic-docs.helpmanual.io/usage/validation_decorator/
- How much income does https://pydantic-docs.helpmanual.io/usage/models/#generic-models have?
- How much does https://pydantic-docs.helpmanual.io/usage/models/ gross monthly?
- How much income does https://pydantic-docs.helpmanual.io/ have?
- How much income does https://www.githubstatus.com/ have?
Analytics and Tracking {π}
- Site Verification - Google
Libraries {π}
- Clipboard.js
- D3.js
- Lodash
Emails and Hosting {βοΈ}
Mail Servers:
- aspmx.l.google.com
- alt1.aspmx.l.google.com
- alt2.aspmx.l.google.com
- alt3.aspmx.l.google.com
- alt4.aspmx.l.google.com
Name Servers:
- dns1.p08.nsone.net
- dns2.p08.nsone.net
- dns3.p08.nsone.net
- dns4.p08.nsone.net
- ns-1283.awsdns-32.org
- ns-1707.awsdns-21.co.uk
- ns-421.awsdns-52.com
- ns-520.awsdns-01.net