Skip to main content

No project description provided

Project description

struuuctify

Installation

pip install struuuctify

Rust like struct for python

Define a new struct:

from structify import struct, impl


@struct
class Point:
    x: float
    y: float

And add method implementation on that struct

@impl
def add(
    self: Point,
) -> float:
    return self.x + self.y

You can now instanciate the struct and call the method as if it was defined in the class:

p = Point(1, 2)

p.add()
>> 3

Limitation

This project is more of a gimmick-y pattern and experimentation around rust-like struct in Python !

  • Mypy and type checkers will not be aware of the method declared on your struct as they are added at runtime.
  • If you define methods on the same struct from different locations, you could end up having clash

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

struuuctify-0.0.4.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

struuuctify-0.0.4-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file struuuctify-0.0.4.tar.gz.

File metadata

  • Download URL: struuuctify-0.0.4.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for struuuctify-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2257fece78d0dbf69dbd54caf19051f579e664b8df861f854a638677530745ae
MD5 7994cead313e118cb3daf8b98bcacfbd
BLAKE2b-256 077fa1de20bba5013ca0c61b237d8128f4451935f80670cc502d2bb26735e8f4

See more details on using hashes here.

File details

Details for the file struuuctify-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: struuuctify-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for struuuctify-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a1570766d958240a83d1f20fd9124cb1816053433c222eb1edc1219d592433f4
MD5 460dbcfeaa6bca34751f877d27be7752
BLAKE2b-256 49caa4650d414bca893cfff92cf55c9b4aa4f365352b3b18c0cf8100d0d2f13d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page