Python package to convert python dictionaries into other language types (Currently Typescript).
Project description
Object Converter
Repository to convert Python dictionaries to Typescript Types. Input any full python dictionary, and receive as output a fully formatted and TypeScript type for that dictionary!
Installation
You can find the project on PyPi here. To install, execute the below.
pip install type_gen_dict
Example
import type_gen_dict as tg
generator = tg.TypeGenerator()
sample = {"1": "hello!", "2": 10, "3": "10/29/22", "4": True, "5": [1, "hi", False], "6": None,
"7": {"8": 1, "9": 2, "10": {"11": True, "12": {"13": None}}}}
generator.convert(sample, 'ts', verbose=True)
Output:
type ABC = {
1: string;
2: number;
3: string;
4: boolean;
5: any[];
6: null;
7: {
8: number;
9: number;
10: {
11: boolean;
12: {
13: null;
}
}
}
}
Deploying to Pip
python3 -m build
python3 -m pip install --upgrade twine
python3 -m twine upload --repository pypi dist/*
TODOs
- Deploy to PyPi!
- Handle the following types:
- Tuples
- List typing (not just any[])
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
type_gen_dict-0.0.1.tar.gz
(7.1 MB
view hashes)
Built Distribution
Close
Hashes for type_gen_dict-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bccedbffc1b6beee8724f978157fa37fdaa8256d2f130f88df5837c70a25e302 |
|
MD5 | 241a5e0c256717fee73f5bb3ef96c90c |
|
BLAKE2b-256 | 75510d1f09ea73dcaf5be675c9bf7969947b6e1828013113eea5ba0715f790a3 |