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
Built Distribution
Hashes for Interface2py-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e815f686350b7d4cd35b9183fdb1af0bd4323d45cb1e9e3f4f1b512cb30536c1 |
|
MD5 | 69f5a1f987f87d86d3d9c2374e6102dd |
|
BLAKE2b-256 | 76a1e3a10b7378ada1ef3abd66c48795a6f9a6d1143015820e80c3f53d4375bc |