Metadata-Version: 2.4
Name: basedpython
Version: 0.0.1a7
Classifier: Development Status :: 1 - Planning
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Pre-processors
Classifier: Topic :: Software Development :: Code Generators
License-File: LICENSE
Summary: a transpiler for both Python and basedpython
Keywords: automation,flake8,pycodestyle,pyflakes,pylint,clippy
Author-email: "Astral Software Inc." <hey@astral.sh>
License-Expression: MIT
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/KotlinIsland/basedpython/blob/main/CHANGELOG.md
Project-URL: Documentation, https://kotlinisland.github.io/basedpython/
Project-URL: Repository, https://github.com/KotlinIsland/basedpython

# basedpython

a python type checker and a python-like language that transpiles to pure python

```by
enum class Shape:
    case Circle(radius: int)
    case Rect(width: int, height: int)

    def area(self) -> int:
        match self:
            case Shape.Circle(r): return 3 * r * r
            case Shape.Rect(w, h): return w * h

extension list[Element: Shape]:
    def first_circle(self) -> Shape.Circle?:
        for shape in self:
            if shape is Shape.Circle:
                return shape
        return None

def stats(shapes: list[Shape]) -> (count: int, total: int):
    return (len(shapes), sum(s.area() for s in shapes))

def main():
    let shapes = [Shape.Circle(1), Shape.Rect(2, 3)]
    let summary = stats(shapes)
    print(f"{summary.count} shapes, {summary.total} total")
    print(shapes.first_circle()?.radius ?? 0)
```

## installation

```sh
uv add --dev basedpython
by run main
```

## documentation

[kotlinisland.github.io/basedpython](https://kotlinisland.github.io/basedpython/)

## acknowledgements

basedpython is a fork of [astral-sh/ruff](https://github.com/astral-sh/ruff) —
it reuses ruff's parser, AST, and fix-application machinery, and the type
checker is built on [ty](https://github.com/astral-sh/ty). none of this would
exist without the work of the astral team and the wider ruff community

