attrs
transitions
Our great sponsors
attrs | transitions | |
---|---|---|
11 | 7 | |
5,065 | 5,346 | |
0.7% | 1.5% | |
9.2 | 6.4 | |
9 days ago | 6 days ago | |
Python | Python | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
attrs
-
Litestar 2.0
Full support for validation and serialisation of attrs classes and msgspec Structs. Where previously only Pydantic models and types where supported, you can now mix and match any of these three libraries. In addition to this, adding support for another modelling library has been greatly simplified with the new plugin architecture
- Ask HN: How can I get better at writing production-level Python?
-
Starlite updates March '22 | 2.0 is coming
Pydantic is by far not the only library of its kind, with prominent members of the same class being attrs, cattrs or even plain dataclasses for some use cases.
-
Data Classification: Does Python still have a need for class without dataclass?
Anything requiring e.g. setattr, getattr, delattr? Without looking far,
https://github.com/python-attrs/attrs/blob/main/src/attr/_ma...
- What new Python features are the most useful for you?
- Why you should use Data Classes in Python
-
Python Built-In Functions to Know
I was looking for an example of using locals() to "fill a data class from kwargs" or something similar to that. The example here doesn't use locals().
That aside, I generally wouldn't use the kwargs approach shown in this example either. I'd use [dataclasses](https://docs.python.org/3/library/dataclasses.html ) or [attrs](https://www.attrs.org/) instead.
-
Building a Micro Business: What Services I Pay For
hynek: developer of attrs
-
Soap and REST at Odds (2017)
I continue to be surprised how easy it can be to consume a SOAP API with the right client libraries. Such as https://docs.python-zeep.org/en/master/ for Python. Now that's not to say it will always work, you can design a terrible API with any mechanism, no SOAP or REST client will help you if the other end has desided to succumb to madness and done something like turn their entire API into just "two endpoints" and driven by the payload content you post to the inbound endpoint, and you have to sit there polling the outbound endpoint with the inbound endpoints response ID because to find out what the eventual response is...
But horror story aside, consuming a decent SOAP endpoint with a good client library can be practically magical.
Between attrs (https://www.attrs.org/), cattrs (https://cattrs.readthedocs.io/), and the aforementioned zeep soap client I've got a serialisation pipeline from soap endpoint into an attrs dataclass with type hints and basic type validation down to a snippet so small it fits right here (type hints removed to minimise size).
from zeep import helpers
-
PEP 661 -- Sentinel Values
attrs has at least two.
transitions
-
transitions VS python-statemachine - a user suggested alternative
2 projects | 26 Sep 2023
-
Curious to hear your life goals
Start with that you know, if you know Excel well, why not start there? I usually recommend Python if you’re new to programming, then you can pick whatever additional libraries you think would benefit the model, and the syntax is highly forgiving. Sounds to me like you’re describing a pretty big finite state machine, with 288 states. Once you encode your idea and some tests, you’ll have the vocabulary (and means) to expand to other model variations such as applying probabilities to different transition states, and opening a whole world of probabilistic models and hidden Markov models, but gotta walk before running :)
- Behavior Trees in Robotics and AI
-
Finite State Machines
BTW, did you check this?
https://github.com/pytransitions/transitions/blob/master/exa...
-
Advent of Code 2020: Day 25 with Generators in Python
Transitions
-
Advent of Code 2020: Day 02(a) using finite state machines
In Python's ecosystem of libraries, there's a nice one called transitions (which I've used in my robotics work). transitions (as the name suggests) lets you define your state machines more declaratively in terms of transitions between states, the rules that govern those transitions, and the triggers that cause these transitions to happen.
What are some alternatives?
itsdangerous - Safely pass trusted data to untrusted environments and back.
xstate-python - XState for Python
pluginbase - A simple but flexible plugin system for Python.
blinker - A fast Python in-process signal/event dispatching system.
Pychievements - The Python Achievements Framework!
Tenacity - Retrying library for Python
Throttler - 🔀⏳ Easy throttling with asyncio support
riprova - Versatile async-friendly retry package with multiple backoff strategies
Blinker Herald - The Blinker Herald includes helpers to easily emit signals using the excellent blinker library.
cppimport - Import C++ files directly from Python!