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.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (14.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

synclangs-0.2.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (15.1 MB view details)

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

synclangs-0.2.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (14.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

synclangs-0.2.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (15.4 MB view details)

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

synclangs-0.2.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (14.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

synclangs-0.2.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (15.3 MB view details)

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

synclangs-0.2.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (13.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

synclangs-0.2.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (14.4 MB view details)

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

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 dead8aec159dac6f35c36be054eb3ab8392c112806765ab7ff117b27087ff82c
MD5 db473d81c935e9514fbc3aacd5992759
BLAKE2b-256 f9d99e0176ebcd0fc6954f4022624c51536a49a5274c93bfca7c17c86a685e0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d4562c94b3e57639e567b1a58ef37117ce6f8dd456ad46b69589224279876a1f
MD5 4b732552ef518064961dd008efdaf5c8
BLAKE2b-256 cf852e2f3da876cdcf83e8774bcbdcba051006d29eac9b7a0ec0960f245a72be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 19374ab2ca04320ff73fee0b5d3d0101cde31c9ee308b1bce7d244706563959a
MD5 0a272c91b4f916884b48d29254ac6a73
BLAKE2b-256 eba4a6d1c57e1cff080da7b5229ec4292bb8f6bcc92980868b4e64e73f207ff0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 92e056675bb1dec63e90563e550998517685e4269752854ae3dff0c31f31a76c
MD5 dc8203ffc2cbb63694f312c30c22973f
BLAKE2b-256 8bd8ba845433a3744a60d07ec9a2e5f30f251835342c2857253e07037c170cf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 aaf8e989ad4d56af292119dc1faa23aa4a46c4689f0eeaf343df740eb3c10e4e
MD5 b8ed542f5dd94d7e3beca1d6f9b014a0
BLAKE2b-256 38a8aaa06dfa5e7c0b34e3cd245948cf1ea530011da7131360245f1f604f9df7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d1367348d6e008c73ed7ffac867a9831bd9db00d488ee0d1d8bedcbea0ba735b
MD5 abe46be943871f52ab711691970933c4
BLAKE2b-256 d757b590d340f0086c0b689c8938a64403a4bf91c094062e74f6adbb5f5622c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 677b3f7fba50f4dccb5f206fff778437385f7ac27095b739f930cc9797dd7c96
MD5 71d0f8b540d2bb105d545f7a56f1fef9
BLAKE2b-256 7bafa5a6fb46ddc07d59c1e7216a5afa833ec390139e415b4c52f4eb6e6e9680

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 79c2f00e46fb81ec8c525d5262d5c2c597cb9a2c0431b74e31541e0bc8ac9acd
MD5 0a84356c905b1118ae027102b3d1d584
BLAKE2b-256 947d65ca4ee74170a7e89fb1eb187769ee162fd01eeead23c84125e2b497ad82

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