Skip to main content
File added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

# Figurine

**Simple, structure only models with inheritance**

Figurine is intended for dumb models. In other words, data only, no methods.
For web apps, view models come to mind, or anywhere you would like a model that
does nothing but represent data.

Currently run on Python 2.6+, 3.x will be supported shortly.

**What about namedtuples?**

Yes, you could just use namedtuple for this, and that might even be better.
If you want your model defs to look more like traditional python objects however,
Figurine can help.

It still may be that namedtuples are a better solution, though you may
need a factory function to start them off with defaults of your choosing.

The base of a figuerine object is a dict, which is a bit better, for my need, for
JSON serialization if needed, which you could also just do with namedtuple._asdict
if you really wanted to use a namedtuple.


### Using Figurine

```python
import figurine

class FacebookData(figurine.Model):
def __init__(self):
self.posts = ['facebook']

class TwitterData(figurine.Model):
def __init__(self):
self.tweets = ['twitter']

class SocialData(FacebookData, TwitterData):
pass

class SimplePage(figurine.Model):

def __init__(self):
self.title = ""
self.stylesheets = []
self.javascript = []
self.meta = {}
self.value = 1

class HomePage(SimplePage, SocialData):

def __init__(self):
self.username = "lucy_the_dog"

model1 = HomePage()
print(model.tweets)
# {'username': 'lucy_the_dog', 'title': '', 'javascript': [], 'posts': ['facebook'], 'value': 1, 'stylesheets': [], 'meta': {}, 'tweets': ['twitter']}

# kwarg overrides or init
model2 = HomePage(title="My Great Title",
value=2)

print(model2)
# {'username': 'lucy_the_dog', 'title': 'My Great Title', 'javascript': [], 'posts': ['facebook'], 'value': 2, 'stylesheets': [], 'meta': {}, 'tweets': ['twitter']}
```

Metadata

Release files for figurine 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for figurine 0.1
File Size Uploaded
figurine-0.1.tar.gz 3.6 kB Details

Release files / figurine-0.1.tar.gz

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL figurine-0.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ffc3928ec9e0eb1c79ddefafac3bf3c05040834e6f1b135057a5fa1d84f4b354
BLAKE2b-256 checksum
How to use checksums
e73378d746cb2d34f1e84de76f9b70807a5a76e18290a693a33d25f07cf280b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page