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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file interphase-0.0.6.tar.gz.

File metadata

  • Download URL: interphase-0.0.6.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for interphase-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f13684f104591377489440efef5646e5db507fe56e0322cea6ed224c54c23d72
MD5 3e5e7bc46309b85c3da3fcc1935f6467
BLAKE2b-256 70100d61eb948669fd4ace8233af93900d38b3a2cb2d97352e8e6f88efd43fcd

See more details on using hashes here.

File details

Details for the file interphase-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: interphase-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for interphase-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8a827e37c090f5586c07966f8865f8a1949aecc7b98ef36c6267e518ee1fae59
MD5 28e79b4c408fdc7326efe7833d70759f
BLAKE2b-256 ad2d35b5c56308e1d75c19992efaca2816f35576b5041fc75654cf579361f262

See more details on using hashes here.

Supported by

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