Skip to main content

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

Release files for Interface2py 0.0.5

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

Source distribution (sdist)

Source distribution for Interface2py 0.0.5
File Size Uploaded
Interface2py-0.0.5.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Interface2py 0.0.5
File Interpreter ABI Platform
Interface2py-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / Interface2py-0.0.5.tar.gz

Download URL Interface2py-0.0.5.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3bfb0cc9d589aab90ef5e3ab5921fb305dc92a73a537cd1d663c3ee88fffbc35
BLAKE2b-256 checksum
How to use checksums
796f7eb33d772c26a994cca595238f1333048609910dab27db3eb2b90a945e09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / Interface2py-0.0.5-py3-none-any.whl

Download URL Interface2py-0.0.5-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3a33a0e959f80b3aa835c1a0a09d9bb91f7d2726762fae66dfe5aefe3e495ef
BLAKE2b-256 checksum
How to use checksums
f820f1f629bf06ebdf615c0b6ee47b3977b3c58c4b0d5cd930cc0403e467ace3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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