https://github.com/rajatsandeepsen/interphase
Python Package for genarating typescript interface with git submodule folder structure
https://github.com/rajatsandeepsen/interphase
git-submodule interfaces pypi python typescript
Last synced: 16 days ago
JSON representation
Python Package for genarating typescript interface with git submodule folder structure
- Host: GitHub
- URL: https://github.com/rajatsandeepsen/interphase
- Owner: rajatsandeepsen
- Created: 2023-08-19T05:47:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-25T21:55:20.000Z (about 2 years ago)
- Last Synced: 2025-09-14T05:49:06.093Z (25 days ago)
- Topics: git-submodule, interfaces, pypi, python, typescript
- Language: Python
- Homepage: https://pypi.org/project/interphase/
- Size: 1.95 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Interphase - Bridging Backend and Frontend Development with Git Submodule

`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](https://pypi.org/project/Interphase/) - Python β Typescript
- [Coming Soon]() - Go β Typescript### Requirements
> `Python >= 3.7`### 1. Installation
```bash
$ pip install interphase
```### 2. Quick Start
#### π Simple folder structure
```
π your_project
|
βββπ types (requied)
| |
β βββπuser.d.ts (optional)
|
βββπmain.py
```#### πmain.py
```python
from interphase import typewriterts = typewriter("./types")
userData = {
"name": "John Doe",
"age": 30,
"email": "example@demo.com",
"skills": ["Python", "TypeScript", "JavaScript"]
}ts.write('user', 'UserData', userData)
```#### π user.d.ts
```typescript
export type UserData = {
name: string;
age: number;
email: string;
skills: string[];
}
```### 3. Real Life Developer Usage
#### .gitmodules
```toml
[submodule "api"]
path = api
url = https://github.com/username/api.git
```#### Frontend
```
π FrontEnd-repo
β
βββπ api (git submodule)
β β
β βββπ__init__.py
β βββπsetup.py
β β
β βββπ types
β β
β βββπ user.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
β β
β βββπ user.d.ts
β
βββπ src
β β
β βββπ (other backend files, where helps to create types for /api)
β
βββπ requirements.txt
βββπ .gitmodules (important)
βββπ .gitignore
```### 4. Configuration
##### π /api/setup.py
```python
config = typewriter("./api/types", d_ts=True) # base setup
```
##### π /api/\_\_init\_\_.py```python
from .setup import config as ts
```### 5. API Reference
##### export types | interface
```python
ts = typewriter("./api/types")# default is export enabled
ts.write('user', 'UserData', userData)
ts.write('user', 'UserData2', userData, export=False)# default is type and interface can be enabled
ts.write('user', 'UserData3', userData, interface=True)
ts.write('user', 'UserData3', userData, export=False, interface=True)
```
```typescript
// user.d.tsexport type UserData = {...}
type UserData2 = {...}export interface UserData3 {...}
interface UserData3 {...}
```##### base folder
```python
# base directory can't be empty string
ts = typewriter("api/types")
ts = typewriter("./api/types")# d.ts is defualt
# .ts can be enabled
ts = typewriter("./api/types", d_ts=False)
ts.write('user', 'UserData', userData)
```
```typescript
export type UserData = {...} // user.ts
```##### file name
```python
# type name and file name can't be empty string
ts.write('user.ts', 'UserData', userData)
ts.write('user.d.ts', 'UserData', userData)# d.ts is defualt
ts.write('user', 'UserData', userData)
```### 6. Contributing Guide
We encourage contributions from the community to make Interphase even more powerful and versatile. If you find issues, have ideas for improvements, or want to suggest new features, please check our Contribution Guidelines for more information.
```bash
$ git clone https://github.com/rajatsandeepsen/interphase.git
$ cd interphase
``````bash
$ pip install --upgrade setuptools
$ pip install --upgrade build
$ pip install --upgrade twine
``````bash
$ python -m build # takes a lot of time
```
```
build result will be like:π interphase
βββπ interphase
βββπpyproject.toml
βββπrequirements.txt
βββπ.gitignore
βββπsetup.py
β
βββπ dist
β
βββπinterphase-0.0.6.whl
βββπinterphase-0.0.6.tar.gz
``````bash
# install from dist$ pip install dist/interphase-0.0.6.whl
# or
$ pip install dist/interphase-0.0.6.tar.gz
``````bash
# upload to pypi
$ python -m twine upload --repository pypi dist/*
# enter username & password from pypi
```### 7. License
Interphase is not released under any License.
---
Feel free to customize and expand upon this draft to best reflect the features, benefits, and usage of your "Interphase" package.