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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

synclangs-0.2.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (17.1 MB view details)

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

synclangs-0.2.4-cp313-cp313-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

synclangs-0.2.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (16.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

synclangs-0.2.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (17.5 MB view details)

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

synclangs-0.2.4-cp312-cp312-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

synclangs-0.2.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

synclangs-0.2.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (17.3 MB view details)

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

synclangs-0.2.4-cp311-cp311-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

synclangs-0.2.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (15.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

synclangs-0.2.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (16.3 MB view details)

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

synclangs-0.2.4-cp310-cp310-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 902476c156c0ba4e4308cb2c8a8b69700bf8cde69c8637793fb7c305fe4d79d0
MD5 22c027df4663a0540249a86051acb25a
BLAKE2b-256 ad40f22204777d67af0c8875f692d53263a81d6680447083ed901e0fee310b7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2b641b119a9acc9e63de29ec7c77d4ca3e2f3ba8a692c89188fb06e73fa87995
MD5 0b9d8181527650576cfd45e34f0de9c6
BLAKE2b-256 b5336dba82b5b81e85d03b236259b1036456f399c9160fd76c1b325b246bad93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 696c219937b8d891bb294b9c0aad73fb94eed99e13d2f902be9173a602c1dfec
MD5 4fc83b438c3c195fae317733a9e56630
BLAKE2b-256 302bab503398e65acb9402909d92fe37d733f120ba3f577e6d77d8bb3bf6ddd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 23326d94198f86f4bdf7d2b871cc07970f2a3661c8ebc86834649f3399aead67
MD5 4204bca5f2d9b7db1198e2de62cb38dc
BLAKE2b-256 a2eb220eb93253ee92b76e49dbf5b85bd0f4f5384531c4840e4ad29a6b744b92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 62d61d8632dfaa24090aff1cf4eba1b9313b8fb3986bd75e0a55113fea4507af
MD5 d8f0b138008424a8f1da8410b88e58d4
BLAKE2b-256 8b196910f962c8126e1751940d8380af15bbe9f8a29c73443ae80dc3310e50ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f37780b0143fa859574803527da51859dbd4e84df1e6b8c5a13e1c0064d7471
MD5 804d63e0b7407a05d0cbbbcaa8a16d4c
BLAKE2b-256 16d4b76cf277b0ddc2bb4e8d0023c42b409fa62ed7a1c2894d21499e3e5145ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d318c43daf65ae29fd1b4224479e7f34038128e27f60301e158f3a0c0172c869
MD5 80a4d76dff17a3a81e0763779e93c038
BLAKE2b-256 56726ab5c791194e2b643b369c4afd81abfd551ad6d2666e99014abb98401f3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bb011483a2c89c17e9392aea0cc61110e8dc1eb0c6e25fec173fa8a8efbe544d
MD5 d0d42fcac0955f0b734bbb9aaa4c16ce
BLAKE2b-256 0736cead74be37f67885e107bb439bae998b588c85725e0448ee2735dc5612ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4cdb1ea7da15caa0a402413edcd79f831c6ad143c8602422a769392afa23e435
MD5 d8ce79888ae27a205d64bc6673c97fda
BLAKE2b-256 f7b926ea4cf069510104729709cd9ac877ea52826a33333198c885035dd5d81e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 73ee7bfddead3508600667b3f4f2396242d100ca53a121a07dc31dbd6d6e9fa0
MD5 d6e49b4453217a4ed34e44be62390eee
BLAKE2b-256 29e98f078ef6aacece8fd9a077f36e7d6bf0b3de385a6a8122ece056eb4c903b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f947f811dbad1b37e41ec609379bacd63c1508a86a13724bdd9cfde5de0bf4c6
MD5 41f86ce41b874fa549993248e63911ca
BLAKE2b-256 0500ae151effb1ed2baafe71bf7ce50b476e488921295d0fb47a150e98653e10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synclangs-0.2.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9369b42f67d8eff59f93f2893104e8ccac965c8a3df12d633e913171b25d1f55
MD5 41698ea8a8aeff42fc54ba24b847e733
BLAKE2b-256 a57c99d130d48758808bd20c7eb03e95a20b855ed721264ca5d99d71f48fa4f1

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