Title: field "model_flags" conflicts with Pydantic 2 protected namespaces · Issue #267 · networktocode/diffsync · GitHub
Open Graph Title: field "model_flags" conflicts with Pydantic 2 protected namespaces · Issue #267 · networktocode/diffsync
X Title: field "model_flags" conflicts with Pydantic 2 protected namespaces · Issue #267 · networktocode/diffsync
Description: Environment DiffSync version: 2.0.0 Python version Python 3.10.12 Observed Behavior Getting warning logs from Pydantic about protected namespace violations within the DiffSync library Expected Behavior No logging output at the warning le...
Open Graph Description: Environment DiffSync version: 2.0.0 Python version Python 3.10.12 Observed Behavior Getting warning logs from Pydantic about protected namespace violations within the DiffSync library Expected Beha...
X Description: Environment DiffSync version: 2.0.0 Python version Python 3.10.12 Observed Behavior Getting warning logs from Pydantic about protected namespace violations within the DiffSync library Expected Beha...
Opengraph URL: https://github.com/networktocode/diffsync/issues/267
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"field \"model_flags\" conflicts with Pydantic 2 protected namespaces","articleBody":"### Environment\r\n* DiffSync version: 2.0.0\r\n* Python version Python 3.10.12\r\n\r\n\u003c!-- What happened instead? --\u003e\r\n### Observed Behavior\r\nGetting warning logs from Pydantic about protected namespace violations within the DiffSync library\r\n\u003c!-- What did you expect to happen? --\u003e\r\n### Expected Behavior\r\nNo logging output at the warning level\r\n\u003c!--\r\n Describe in detail the exact steps that someone else can take to reproduce\r\n this bug using the current release.\r\n--\u003e\r\n### Steps to Reproduce\r\n1. `python3 -i`\r\n2. `from diffsync import DiffSyncModel`\r\n\r\n### Extra Information\r\n\r\nPydantic introduces protected namespaces in their new documentation that places warning logs for things like `model_` fields [documentation here](https://docs.pydantic.dev/latest/api/config/#protected-namespaces) \r\n\r\npotential workaround is to use the ConfigDict to set protected_namespaces to an empty value.\r\n```\r\nclass Device(DiffSyncModel):\r\n \"\"\"common model used for Diffsync\"\"\"\r\n \r\n # Disables new Pydantic v2 protections since diffsync uses model_ fields\r\n model_config = ConfigDict(\r\n protected_namespaces=()\r\n )\r\n ```\r\n \r\n However, this does not prevent the log entries from the diffsync BaseModel here:\r\n https://github.com/networktocode/diffsync/blob/13f5150d66ec76b637f56c908d1ab300bf63661d/diffsync/__init__.py#L110","author":{"url":"https://github.com/dnewood","@type":"Person","name":"dnewood"},"datePublished":"2024-02-12T20:37:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/267/diffsync/issues/267"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d270847e-2395-3d57-fb58-d9d9daa2b4a3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6BE:1D2AC1:113942A:16803DD:69920EB2 |
| html-safe-nonce | 639ca90625ce58c241c66c1c3daedcbb9b16b605ce6ce1b4a46c9c8767fafdcd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkJFOjFEMkFDMToxMTM5NDJBOjE2ODAzREQ6Njk5MjBFQjIiLCJ2aXNpdG9yX2lkIjoiMTg1MDcwMTYxMTQ4MTA0MjYxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7e9638a5a26ba44d3761c8a7e3247ce3b40a6275c0637b78b67d08e34036252f |
| hovercard-subject-tag | issue:2130944093 |
| github-keyboard-shortcuts | repository,issues,network-graph,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/networktocode/diffsync/267/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a64bbb79b4cb36e0a3344c7b72091746f2cc7453643eac31c516c0923f4d1e63/networktocode/diffsync/issues/267 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a64bbb79b4cb36e0a3344c7b72091746f2cc7453643eac31c516c0923f4d1e63/networktocode/diffsync/issues/267 |
| og:image:alt | Environment DiffSync version: 2.0.0 Python version Python 3.10.12 Observed Behavior Getting warning logs from Pydantic about protected namespace violations within the DiffSync library Expected Beha... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dnewood |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/networktocode/diffsync git https://github.com/networktocode/diffsync.git |
| octolytics-dimension-user_id | 13106404 |
| octolytics-dimension-user_login | networktocode |
| octolytics-dimension-repository_id | 292296974 |
| octolytics-dimension-repository_nwo | networktocode/diffsync |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 292296974 |
| octolytics-dimension-repository_network_root_nwo | networktocode/diffsync |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width