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.

Is it possible to have class variables that are not part of the schema that is parsed by pydantic?

ie:

class MyModel(BaseModel):

     # This is part of pydantic
     group: str = None

     # This is not.
     ACTIONS = ['a', 'b', 'c']```

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:18 (15 by maintainers)

github_iconTop GitHub Comments

8reactions
samuelcolvincommented, May 28, 2018
5reactions
samuelcolvincommented, Dec 16, 2018

@tiangolo’s suggestion is definitely the most sensible approach and will make sense to anyone coming from django or similar.

However we should definitely implement ClassVar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class variable - Wikipedia
In class-based, object-oriented programming, a class variable is a variable defined in a class of which a single copy exists, regardless of how...
Read more >
What are class variables, instance variables and local ...
Class variables − Class variables also known as static variables are declared with the static keyword in a class, but outside a method, ......
Read more >
Understanding Class Members (The Java™ Tutorials ...
Class Variables. When a number of objects are created from the same class blueprint, they each have their own distinct copies of instance...
Read more >
Difference between Instance Variable and Class Variable
Class Variable : It is basically a static variable that can be declared anywhere at class level with static. Across different objects, these ......
Read more >
Python Class Variables With Examples - PYnative
Class Variables : A class variable is a variable that is declared inside of class, but outside of any instance method or __init__()...
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