Package for genarating typescript interface with git submodule folder structure
Project description
Interphase - Bridging Backend and Frontend Development with Git Submodule
Introduction
Interphase
is a powerful tool
+ git structure
designed to streamline the collaboration between backend and frontend developers by facilitating the sharing of critical information, including types, example data, API URLs, and documentation. The core concept is to provide an interconnected platform that enables seamless communication between these two development environments, thereby reducing friction and enhancing productivity, thus bridging the gap between the two development repository.
Currently Available Support Packages
- Interphase - Python โ Typescript
- Comming Soon - Go โ Typescript
Requirements
Python >= 3.7
1. Installation
$ pip install Interphase
2. Quick Start
๐ Simple folder structure
๐ your_project
|
โโโ๐ types (requied)
| |
โ โโโ๐api.d.ts (optional)
|
โโโ๐main.py
๐main.py
from Interphase import Interphase
ts = Interphase("./types")
userData = {
"name": "John Doe",
"age": 30,
"email": "example@demo.com",
"skills": ["Python", "TypeScript", "JavaScript"]
}
ts.write('api', 'UserData', userData)
๐ api.d.ts
export type UserData = {
name: string;
age: number;
email: string;
skills: string[];
}
3. Real Life Developer Usage
.gitmodules
[submodule "api"]
path = api
url = https://github.com/username/api.git
Frontend
๐ FrontEnd-repo
โ
โโโ๐ api (git submodule)
โ โ
โ โโโ๐__init__.py
โ โโโ๐setup.py
โ โ
โ โโโ๐ types
โ โ
โ โโโ๐ api.d.ts
โ
โโโ๐ src
โ โ
โ โโโ๐ (other frontend files, where /api/types are imported and used)
โ
โโโ๐ package.json
โโโ๐ .gitmodules (important)
โโโ๐ .gitignore
Backend
๐ Backend-repo
โ
โโโ๐ api (git submodule)
โ โ
โ โโโ๐__init__.py
โ โโโ๐setup.py
โ โ
โ โโโ๐ types
โ โ
โ โโโ๐ api.d.ts
โ
โโโ๐ src
โ โ
โ โโโ๐ (other backend files, where helps to create types for /api)
โ
โโโ๐ requirements.txt
โโโ๐ .gitmodules (important)
โโโ๐ .gitignore
4. Configuration
๐ /api/setup.py
config = Interphase("./types", d_ts=True) # base setup
๐ /api/__init__.py
from .setup import config as ts
5. API Reference
export types | interface
ts = Interphase("./types")
# default is export enabled
ts.write('api', 'UserData', userData)
ts.write('api', 'UserData2', userData, export=False)
# default is type and interface can be enabled
ts.write('api', 'UserData3', userData, interface=True)
ts.write('api', 'UserData3', userData, export=False, interface=True)
export type UserData = {...}
type UserData2 = {...}
export interface UserData3 {...}
interface UserData3 {...}
base folder
# base directory can't be empty string
ts = Interphase("types")
ts = Interphase("./types")
# d.ts is defualt
# .ts can be enabled
ts = Interphase("./types", d_ts=False)
ts.write('api', 'UserData', userData)
export type UserData = {...} // api.ts
file name
# type name and file name can't be empty string
ts.write('api.ts', 'UserData', userData)
ts.write('api.d.ts', 'UserData', userData)
# d.ts is defualt
ts.write('api', 'UserData', userData)
7. FAQs
List and answer frequently asked questions users might have about your package.
8. Troubleshooting
Provide solutions to common issues users might encounter and how to resolve them.
9. Contributing
Encourage others to contribute to your project. Include guidelines for submitting bug reports, feature requests, and pull requests.
10. License
Specify the license under which your package is released.
Remember that your documentation should be clear, concise, and easy to follow. Use a consistent tone and style throughout, and consider using code snippets, diagrams, and examples to enhance understanding. Regularly update the documentation as your package evolves to ensure it remains accurate and helpful to your users.
Interphase
interface is not supported yet
defualt is export On default is type = need file name need type name need any data
base directory can be empty string d.ts is supported & it is defualt
dev
pip install --upgrade setuptools
pip install --upgrade build #python -m build
$ pip install -q build
$ python -m build
pyproject.toml https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
dist/
meowpkg-0.0.1.whl
meowpkg-0.0.1.tar.gz
$ pip install dist/meowpkg-0.0.1.whl
$ pip install dist/meowpkg-0.0.1.tar.gz
upload to pypi
$ python -m twine upload --repository pypi dist/*
.
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 interphase-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a827e37c090f5586c07966f8865f8a1949aecc7b98ef36c6267e518ee1fae59 |
|
MD5 | 28e79b4c408fdc7326efe7833d70759f |
|
BLAKE2b-256 | ad2d35b5c56308e1d75c19992efaca2816f35576b5041fc75654cf579361f262 |