Metadata-Version: 2.4
Name: langex
Version: 0.1.6
Summary: Extended Language Support for Python
Author: AttAditya
License: MIT License
        
        Copyright (c) 2026 AttAditya
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: >=3.14
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# [LangEx](https://pypi.org/project/langex/)

Extended Language Support for Python

## Installation

```sh
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

```py
from langex.meta.interface import interface

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

### Implementing the Interface

```py
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

```py
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

```tree
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

- [PyPI](https://pypi.org/project/langex/)
- [GitHub](https://github.com/attaditya/langex)
- [License](https://github.com/attaditya/langex/tree/main/LICENSE)

> _Made with <3 by [AttAditya](https://github.com/AttAditya)_

