Skip to main content

Write types once, use everywhere

Project description

SyncLangs

One centralized types file -> Multiple languages across all your codebases.

PyPI version Python versions License: Proprietary

SyncLangs is a developer tool that enables you to maintain a single source of truth for your type definitions. Define your structures once in a universal schema language (.syln) and automatically synchronize them as native, idiomatic types across Python, TypeScript, and multiple projects or packages simultaneously.

Why SyncLangs?

Modern full-stack applications often use different languages for frontend (TypeScript) and backend (Python). This creates type duplication, drift risk, and maintenance burden.

SyncLangs solves this by:

  • No more type drift - Define types once, generate native code for each language
  • Zero config start - Works immediately with sensible defaults
  • Fast watch mode - Regenerates in under 200ms on file save
  • Readable syntax - Human-readable .syln files, no verbose boilerplate

Quick Start

Installation

pip install synclangs
# or
pipx install synclangs

Initialize a Project

syln init

This creates:

  • syln.config.json - Configuration file
  • shared/example.syln - Example schema

Define Your Types

Create shared/user.syln:

## Represents a user in the system
type User {
  ## Unique identifier
  id: string

  ## User's email address
  email: string

  ## Display name (optional)
  name: string?

  ## Account active status
  isActive: bool

  ## User tags
  tags: list<string>

  ## Arbitrary metadata
  metadata: map<string, any>
}

Generate Code

syln generate

TypeScript Output (user.types.ts):

// Auto-generated by SyncLangs - DO NOT EDIT

export interface User {
  /** Unique identifier */
  id: string;
  /** User's email address */
  email: string;
  /** Display name (optional) */
  name?: string;
  /** Account active status */
  isActive: boolean;
  /** User tags */
  tags: string[];
  /** Arbitrary metadata */
  metadata: Record<string, any>;
}

Python Output (user_types.py):

# Auto-generated by SyncLangs - DO NOT EDIT

from dataclasses import dataclass
from typing import Any, Optional

@dataclass
class User:
    """Represents a user in the system"""
    id: str
    """Unique identifier"""
    email: str
    """User's email address"""
    is_active: bool
    """Account active status"""
    tags: list[str]
    """User tags"""
    metadata: dict[str, Any]
    """Arbitrary metadata"""
    name: Optional[str] = None
    """Display name (optional)"""

Watch Mode

syln watch

Changes to .syln files automatically regenerate output in under 200ms.

CLI Reference

Command Description
syln init Initialize a new project with config and example
syln generate Generate code from .syln files
syln check Validate schemas without generating
syln watch Watch mode with auto-regeneration
syln version Show version

Common Flags

Flag Short Description
--config -c Config file path (default: ./syln.config.json)
--input -i Input directory (default: ./shared)
--out-ts TypeScript output directory
--out-py Python output directory
--verbose -v Verbose logging
--dry-run Show what would be generated

Syntax Reference

Primitives

SyncLangs Python TypeScript
string str string
int int number
float float number
bool bool boolean
any Any any

Generics

SyncLangs Python TypeScript
list<T> list[T] T[]
map<K, V> dict[K, V] Record<K, V>

Nullable Types

type Example {
  required: string      # Required field
  optional: string?     # Optional field (nullable)
}

Imports

import { User, Address } from "./user.syln"

type Order {
  user: User
  shippingAddress: Address
}

Comments

# Regular comment (ignored in output)

## Doc comment (generates docstrings/JSDoc)
type User {
  ## The user's unique identifier
  id: string
}

Configuration

Create syln.config.json in your project root:

{
  "$schema": "https://synclangs.com/schema/v1.json",
  "version": "1.0",
  "input": "./shared",
  "outputs": {
    "typescript": {
      "enabled": true,
      "outDir": "./generated/ts",
      "fileExtension": ".types.ts"
    },
    "python": {
      "enabled": true,
      "outDir": "./generated/py",
      "fileExtension": "_types.py",
      "useDataclasses": true
    }
  },
  "options": {
    "watchDebounceMs": 100,
    "caseConversion": {
      "fields": {
        "python": "snake_case",
        "typescript": "camelCase"
      }
    },
    "generateIndex": true
  }
}

Error Messages

SyncLangs provides helpful error messages with file locations and suggestions:

Error: SY002 - Invalid type reference
  --> shared/user.syln:15:12
   |
15 |   role: Roles
   |         ^^^^^ Type 'Roles' not found. Did you mean 'Role'?
   |
Help: Import 'Roles' or define it in this file.

Documentation

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting a PR.

License

Proprietary — © 2025 SyncLangs. All rights reserved. See LICENSE.


Made with care by SyncLangs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

synclangs-0.2.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (16.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

synclangs-0.2.5-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (17.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

synclangs-0.2.5-cp313-cp313-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

synclangs-0.2.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (17.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

synclangs-0.2.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (18.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

synclangs-0.2.5-cp312-cp312-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

synclangs-0.2.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (16.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

synclangs-0.2.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (17.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

synclangs-0.2.5-cp311-cp311-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

synclangs-0.2.5-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (15.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

synclangs-0.2.5-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (16.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

synclangs-0.2.5-cp310-cp310-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file synclangs-0.2.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1b002c7f2b5ebb96262af3b26516ccf2ce085a311375fa10a1c14b919cd25f9b
MD5 2b9ad7bc4fa02f11d22931b3c8565539
BLAKE2b-256 045c0327a2fd4e794a50975a4d7be9cd2c4ed201dc0d178f327182fb085bebe0

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c835de69a6067f51998e9cb5cf848fe2126bd82d0031ab38ce2c79acd92ae7a8
MD5 84cebd89972e7923920c6efe429e4453
BLAKE2b-256 fff65392cb080f1f6340442d31b5a00ab03459f0c313e16fd39073afbe36562c

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4fdb4ce14c15e9810f5e003fd80897192065109c242ab9010618c1363ae33f07
MD5 cc24937cd77e2ce774e16bf7ce3a325a
BLAKE2b-256 cf5faa957b65d54016cff38675a59a49f4717e29265607ca260032e81469be7c

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2cee56c7a69ca533ed9ac4daf3b59f7e28faca1c8719a6e3dc6a1f6ce65f476f
MD5 45e95b733a8e06b559e39038bb158a71
BLAKE2b-256 90f349cac7eded71f323fa5b7551c0e9622bac464ce90b70dc671bb85764e468

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e1298d7fd5b2b39925984d5646afc28b8e519c5a2e8a5d42ae3c377f27c2de94
MD5 283000aea14000506b1b9a9bb7c8fc0a
BLAKE2b-256 afaac3b3dfde1c57736aa8fd81f6a2c489405783f6bfeb8d9448539dc5156bd3

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 93b1ee2a84c8a0844e8cf8960218c3b89034459e8b16f3fce81ba065e7e4ceb8
MD5 35ece02adc54a785023b1a87052133a3
BLAKE2b-256 fc1363355c817ad7e1d91ee6fa2c6720e94dabf8d8305a7121f66ffe4a6f5190

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4a545e68380e73cf6f987a52e100216e33d3a3947b9f8965372bc0ed168b45c1
MD5 1ff6e0501a0dc72ca4167d6068df449b
BLAKE2b-256 0a47ef4c0559715b84535c4311eaaae86c0be08fa1106976cb6368b996db2593

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b614c98764bdf7c8c128a9856f88312ed50347ce3149eb902ea4133acff02f4d
MD5 fdb54d87bffdd68a4ce4cdf2d6eaeecf
BLAKE2b-256 1f50260003f3ccc692d12093fdf0bf9c7706e364703c593d997dce3455307828

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e8fecf192eb1794a23070dcbca36113f0e5f255e4b16c93f434146b545c69e0
MD5 0ab4226b88ae286ab01de28c8e45b338
BLAKE2b-256 8580c61f99ee6a55a52a6a1907e00dda549cb43ca792d832ff31dead23faf3e5

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3e6a1f3469a44a182a01e012f06939eea3717a94391d47c924ae129a7ac3b3c2
MD5 666435f7d2cb2aed52abb6d4f236a53a
BLAKE2b-256 360b423cb154c497e7fcc943ac7e2ca03d45b2b20f3dc202126aed2d5259ca4f

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1857492ca6367069663b6eabe4652286a32a5965144c05580c277f3979fd1a39
MD5 9f91c8bd74664ad6ed656bc7e22260d9
BLAKE2b-256 5fb205ed1c6b9c71a79e239cdba91b451f59670775aad6d34a54e4649f2c7ac5

See more details on using hashes here.

File details

Details for the file synclangs-0.2.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for synclangs-0.2.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1743348ac4b3ac75218bad52d09fe0a57625fb9f7157a879d2fa86d0a3b81076
MD5 046c317c5b4e8cc077144e0b9aa584ab
BLAKE2b-256 c6c1e3ddef1be61fea8eece53b496d800ea3c4d1a2292bfdeb38c5055c30793b

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