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

Interface2py-0.0.5.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

Interface2py-0.0.5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file Interface2py-0.0.5.tar.gz.

File metadata

  • Download URL: Interface2py-0.0.5.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for Interface2py-0.0.5.tar.gz
Algorithm Hash digest
SHA256 3bfb0cc9d589aab90ef5e3ab5921fb305dc92a73a537cd1d663c3ee88fffbc35
MD5 ff7b9537cff3790c1e9fedadbc7f93a8
BLAKE2b-256 796f7eb33d772c26a994cca595238f1333048609910dab27db3eb2b90a945e09

See more details on using hashes here.

File details

Details for the file Interface2py-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: Interface2py-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for Interface2py-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d3a33a0e959f80b3aa835c1a0a09d9bb91f7d2726762fae66dfe5aefe3e495ef
MD5 274178e3f0d50950b4e3f17338e70fbd
BLAKE2b-256 f820f1f629bf06ebdf615c0b6ee47b3977b3c58c4b0d5cd930cc0403e467ace3

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