Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashercn97/interfaces.py
A very starting implementation of typescript interfaces in python!
https://github.com/ashercn97/interfaces.py
Last synced: 12 days ago
JSON representation
A very starting implementation of typescript interfaces in python!
- Host: GitHub
- URL: https://github.com/ashercn97/interfaces.py
- Owner: ashercn97
- Created: 2023-09-04T19:11:27.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-04T19:17:33.000Z (about 1 year ago)
- Last Synced: 2023-09-05T06:56:28.140Z (about 1 year ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Interfaces.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:
`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.