Skip to main content

A python implementation of typescript interfaces

Project description

Interface2.py

A very starting implementation of typescript interfaces in python! I was not satisfied with the dataclasses in python, so I attempted to make something similar to typescript interfaces !! My original plan was to do something like typechat in python, but I realized I needed something better than dataclasses.

The decorators are used to add more functionality to the code. The two current ones are one to make the interface immutable and the other to make it able to take multiple types as a type. I am expecting a TON of bugs, so please lmk if there are any!

To use it, you can clone the repo and then import the IF4 (the main file).

Then, you could do the following:

@multiple
class MyInterface(IF4.Interface):
    _properties = {
        "name": str,
        "age": (int, float)
    }

You could wrap them with the decorators too! IF you have ANY questions, please leave an issue and ill be happy to get back to you.

This is one of my first public projects! If anyone has any suggestions for changes/improvements/anything please let me know!!

please see the examples folder for examples of how to use it

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

Interface2_py_ashersopro2-0.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

Interface2_py_ashersopro2-0.0.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file Interface2_py_ashersopro2-0.0.1.tar.gz.

File metadata

File hashes

Hashes for Interface2_py_ashersopro2-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3e563b2eee1b663b7ed5aa6789e85b79c65cbe39c003007ace4c019591bcf85e
MD5 25ea910398484cad292d3db3be6fe983
BLAKE2b-256 7c09bcd95115ba9dc5eafb47535b3d2673001b49779024dd5ba06dd401efd0e1

See more details on using hashes here.

File details

Details for the file Interface2_py_ashersopro2-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for Interface2_py_ashersopro2-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc63bc5eca8c0585901769b1143d9cdafb9a8ea2ee1336f9a15a27215377b5f7
MD5 ff3d27dd606d88b6563ed72bdf095bb5
BLAKE2b-256 3c9610f260705125386a40557aa0f2b381bdee01706b8d4b00211d1064f5ec29

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