Skip to main content

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

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

interphase-0.0.6.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

interphase-0.0.6-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page