One pleasant trick I adopted was using #attrs metadata to describe the structure of the records: https://github.com/tdsmith/sdif/blob/06ad1e8f73191aa476cade4cc704c9abbaa596b0/src/sdif/models.py#L184
Python type hints on the fields map to the different formatting rules for SDIF field types: https://github.com/tdsmith/sdif/blob/06ad1e8f73191aa476cade4cc704c9abbaa596b0/src/sdif/fields.py#L53
My continued thanks to @hynek for building and maintaining attrs! 🫡
In #Mypy 1.0, you can use `Final` attributes in #attrs classes and Mypy will know they are frozen instance attributes.
So if you use Mypy, this'll get you *overhead-free* frozen classes, but with a bunch of caveats:
* it doesn't work if the attribute has a default (any default), even like `attrs.field` or `attrs.Factory`
* the class won't be hashable by default
These are tricky to solve. The work continues. #python
#NumPy -using #Python friends!
Is joblib something y'all use and would be interesting in custom hashing support in #attrs like this gentleperson: https://stackoverflow.com/q/74975393/476759 ?
I've never heard of that pkg before but 23M dl/month suggest it's popular. 😅
It's time for a re-#introduction!
I'm a #MastersStudent in #ComputerScience. In my spare time, I develop #OpenSourceSoftware such as
- a library to talk to #ManifoldMarkets from native #Python
- a #PredictionMarket manager using the above
- a transpiler from a subset of Python to #OpenStreetMaps's OverpassQL
- bug fixes to many other projects, including #mypy, #base58, #attrs, #cpython, and more
I'm also a hobbyist editor on OpenStreetMap.
#introduction #mastersstudent #computerscience #opensourcesoftware #manifoldmarkets #python #predictionmarket #openstreetmaps #mypy #base58 #attrs #cpython #bi #transfem
It's time for a re-#introduction!
I'm a #MastersStudent in #ComputerScience. In my spare time, I develop #OpenSourceSoftware such as
- a library to talk to #ManifoldMarkets from native #Python
- a #PredictionMarket manager using the above
- a transpiler from a subset of Python to #OpenStreetMaps's OverpassQL
- bug fixes to many other projects, including #mypy, #base58, #attrs, #cpython, and more
I'm also a hobbyist editor on OpenStreetMap.
#introduction #mastersstudent #computerscience #opensourcesoftware #manifoldmarkets #python #predictionmarket #openstreetmaps #mypy #base58 #attrs #cpython #bi #transfem
`__attrs_pre_init__` and `__attrs_init__` support is comming to Python Attrs library!
See docs for `attr.s` `init` parameter here https://www.attrs.org/en/latest/api.html
@hynek@mastodon.social @hynek@twitter.activitypub.actor
#python #attrs
RT @hynek
I’ve just been approved to GitHub Sponsors! I have procrastinated on it b/c I was afraid it might get embarrassing...prove me wrong if my software (or whatever else I’ve done) helped you make money? 😇 #python #attrs #structlog