Skip to main content

Faux Sures: The REPL object manager for ProtoTyping domain logic with objects and relations. For Python.

Faux Sures provides a heavily typed system with immediate validation checks to provide a tactile experience while exploring complex domain logic. Faux Sures is designed for use in a python shell, a notebook, or a short script. The self evaluating Fields system triggers everytime you set an attribute on a model, giving you guardrails while you play around with data. All while encapsulating logic in the Model definition itself

Current Development:

  • This package is still in its infancy see below for current issues
  • Github Issues is used for reporting both Bugs and requesting Features
  • Current development is limiting the traceback printout to a single line

Examples:

See The Intramural Sports League Story Test

In [5]: from faux_sures import not_db

In [6]: from faux_sures.recipes.curries import in_range

In [7]: class Student(not_db.Model):
   ...:     first_name = not_db.Field(str)
   ...:     last_name = not_db.Field(str)
   ...:     age = not_db.Field(int, in_range(14, 19))
   ...: 
   ...:     name_constraint = not_db.UniqueTogetherRestraint(("first_name", "last_name"))
   ...: 

In [8]: arjun = Student()

In [9]: arjun.age = "13"
---------------------------------------------------------------------------
TypeFieldRequirementException             Traceback (most recent call last)
<ipython-input-9-0a7edcc14936> in <module>
----> 1 arjun.age = "13"

~/Documents/code/faux_sures/faux_sures/not_db.py in __set__(self, instance, value)
     79             pass
     80         elif not isinstance(value, self._type):
---> 81             raise TypeFieldRequirementException(
     82                 f"{self.name!r} values must one of types {self._type!r} not {type(value)}"
     83             )

TypeFieldRequirementException: 'age' values must one of types <class 'int'> not <class 'str'>

In [10]: arjun.age = 13
---------------------------------------------------------------------------
ValidatorFieldRequirementException        Traceback (most recent call last)
<ipython-input-10-65acbd50e86f> in <module>
----> 1 arjun.age = 13

~/Documents/code/faux_sures/faux_sures/not_db.py in __set__(self, instance, value)
     85             for validator in self.validators:
     86                 if validator(value) is False:
---> 87                     raise ValidatorFieldRequirementException(f"{self.name} failed to validate {validator.__name__}")
     88         instance.__dict__[self.name] = value
     89 

ValidatorFieldRequirementException: age failed to validate in_range_14_to_19

In [11]: arjun.age = 17

In [12]: arjun.age
Out[12]: 17

Why you might like Faux Sure

  • You like working with Jupyter Notebooks and Ipython
  • You are more concerned with solving the domain logic than writing optimized code
  • You appreciate the security of a strongly typed system
  • You write short scripts over a common memory resource with complex logic
  • You like objects and have an imperative mood. But are afraid of regressions
  • You are preoccupied with correctness and human understanding. The final solution can wait.

Why Faux Sure might not be right for you

  • You've already got the domain logic figured out completely
  • You find strong typing difficult to work with.
  • You care about performance. You care about memory overhead.
  • You already have a database connected with Check statements
  • You'd rather not have code with Side Effects.

Features

  • Field validation by types or validator functions
  • Patterns for currying and composing validator functions
  • Object relations via higher order types. Validator functions for high order types
  • Validator fields for more complex checks such as Unique Together
  • Model level checks at commit time
  • Domain wide checks at commit time
  • Single Class Session which enables state tracking between discrete steps

Installation

pip install faux-sures==0.0.1

Issues and Contributing:

  • Please Help by opening issues and bugs in Issues. For now the Issues page is the project board.
  • If you'd like to contribute code, please open a PR. There is a requirement to pass code quality checks.
  • Current line of progress is limiting the traceback as a default option.
  • Second line of progress is adding more tests and "Story" tests which stress the interactions between
  • Third line of progress is making Object Relations more ergonomic.

Metadata

Release files for faux-sures 0.0.3

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

Source distribution (sdist)

Source distribution for faux-sures 0.0.3
File Size Uploaded Provenance
faux-sures-0.0.3.tar.gz 12.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for faux-sures 0.0.3
File Interpreter ABI Platform
faux_sures-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / faux-sures-0.0.3.tar.gz

Download URL faux-sures-0.0.3.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0835c162eab62a915abd49d428d01a8d330ff44dcc783da73cd50d7595810242
BLAKE2b-256 checksum
How to use checksums
28c4ee4d2b71c02a017f502813241f2d516fe73c30d9e0f2cfb113ecb55ffe2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.5

Release files / faux_sures-0.0.3-py3-none-any.whl

Download URL faux_sures-0.0.3-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c290b3040499d6fd32fd838eee9c62644457796e850772257237d07ba6b4347
BLAKE2b-256 checksum
How to use checksums
a75387d46038ee14dbb2f2ab6f71df6a5381da115039cb4b67bb409ff37bc5c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.5

Security for faux-sures 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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