Skip to main content

Extended Language Support for Python

Project description

LangEx

Extended Language Support for Python

Installation

pip install langex

About

LangEx is an experimental Python library that introduces additional language-level constructs using decorators, metadata inspection, and runtime validation.

It focuses on enabling capabilities that Python does not strictly enforce by default, such as interface-like structures, structured metadata, and runtime type validation.

The project builds small language utilities that operate on Python objects (functions, classes, and other callables) to inspect, validate, and extend their behavior while remaining fully compatible with standard Python.

Features

  • Interface-like constructs for Python classes
  • Metadata extraction for Python objects and callables
  • Runtime validation utilities
  • Decorator-based language extensions
  • Runtime argument and return type checking
  • Lightweight core inspection tools

Example

Defining an Interface

from langex.meta.interface import interface

@interface
class Repository:
  def save(self, data): ...
  def get(self, id): ...

Implementing the Interface

from langex.meta.interface import implements

@implements(Repository)
class UserRepository:
  def save(self, data):
    ...

  def get(self, id):
    ...

If required methods are missing, validation will raise an error.

Runtime Type Enforcement

from langex.typecheck.hints import pos_args, return_type
from langex.typecheck.enforce import enforce_types

@enforce_types
@pos_args(int, int)
@return_type(int)
def add(a, b):
  return a + b

LangEx records type metadata and enforces it when the function is executed.

Project Structure

langex
├── __init__.py
├── __main__.py
├── core
│   ├── __init__.py
│   ├── callable_meta.py
│   ├── class_meta.py
│   ├── meta.py
│   ├── object_meta.py
│   └── use.py
├── meta
│   ├── __init__.py
│   ├── immediate.py
│   └── interface.py
└── typecheck
    ├── __init__.py
    ├── enforce.py
    └── hints.py

The core module provides internal abstractions for inspecting Python objects and extracting structured metadata used by higher-level utilities.

The meta module provides language-style constructs such as interfaces and structural validation helpers.

The typecheck module provides decorators and runtime enforcement tools for validating function arguments and return values based on declared metadata.

Design Philosophy

LangEx is designed around a few principles:

  • Pure Python implementation
  • Minimal runtime overhead
  • Explicit developer intent
  • Small composable language utilities

Rather than acting as a framework, LangEx provides foundational language tools that can be used to build higher-level abstractions.

Status

Experimental and under active development.
APIs and structure may evolve as the project grows.

Links

Made with <3 by AttAditya

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

langex-0.1.8.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

langex-0.1.8-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file langex-0.1.8.tar.gz.

File metadata

  • Download URL: langex-0.1.8.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for langex-0.1.8.tar.gz
Algorithm Hash digest
SHA256 df93b4d12d3c5e439895fd1aca7a8b6e99dc2cf034ff50c5480d8fa57163ccd7
MD5 207ec92879811f6efb649793f8b4d389
BLAKE2b-256 9288241d0cac6002801ebda52d4425a3182be48b75fd6c0ec25ab9dbaa1d10db

See more details on using hashes here.

File details

Details for the file langex-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: langex-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for langex-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 7c06f01c14e5502b4d0a5ff7bc4ed996c155a5b69c2458eed80e6d781ca2ae6c
MD5 78a53596c2f4d8e8749c798bb4733fd4
BLAKE2b-256 ee6787457bea73c8ae1771d5a8f5d04b5a601934c05bd4e5ea3a7d35de64eb08

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