PyUiua
A Python binding for Uiua, allowing interaction between Uiua and Python.
Requirements
- Python 3.10 or higher
Installation
pip install pyuiua
or see dev setup below for building from source
Example Usage
Eval method
import pyuiua
pyuiua.eval("+ 1 2") # 3.0
pyuiua.eval("/+", [1, 2, 3]) # 6.0
pyuiua.eval("/×⇡₁10") # 3628800.0 (10 factorial)
pyuiua.eval("∩+", 1, 2, 3, 4) # (3.0, 7.0)
Persisted instance
import pyuiua
uiua = pyuiua.Uiua()
# Push Python values onto the stack and operate on them
uiua.push(10)
uiua.push(20)
uiua.run("+")
print(uiua.pop()) # 30.0
# Work with arrays
uiua.push([1, 2, 3, 4, 5])
uiua.run("/+")
print(uiua.pop()) # 15.0
# Inspect the stack
uiua.push(1)
uiua.push(2)
uiua.push(3)
print(uiua.stack()) # [1, 2, 3]
print(len(uiua)) # 3
# Clear the stack
uiua.clear()
API Reference
pyuiua.eval(code, *args) - Run Uiua code with any number of inputs and return the resulting value or tuple or values (or None if no output)
pyuiua.Uiua() - Create a Uiua instance
uiua.push(value)- Push a Python value onto the stackuiua.pop()- Pop a value from the stack and return ituiua.run(code)- Execute Uiua code on the current stackuiua.stack()- Return all stack values as a list (without modifying)uiua.clear()- Remove all values from the stacklen(uiua)- Get the number of values on the stack
Type Conversions
The conversion of types is currently lossy. Both arrays and boxes convert to lists in Python, and Python lists convert to an array if they're homogeneous with a well-defined shape, otherwise a box. As a result, a box in Uiua of homogeneous values will become an array when converted to python and back.
- Currently supports: numbers, bytes, chars, complex numbers, multidimensional arrays, and boxed arrays
- Does not yet support: maps, multivectors, functions, or user-defined types
Uiua → Python
| Uiua Type | Python Type |
|---|---|
| Scalar number | float |
| Scalar byte | int |
| Scalar complex | complex |
| Scalar char / 1D char array | str |
| 1D Array | list |
| Multi-dimensional Array | Nested list |
| Box Array (heterogeneous) | list |
Python → Uiua
| Python Type | Uiua Type |
|---|---|
int |
Byte if 0–255, otherwise number |
float |
Scalar number |
complex |
Scalar complex |
str |
Character array/string |
bytes |
Byte array |
list (homogeneous) |
Array |
list (heterogeneous) |
Box Array |
Development
Requirements
Set-up
# Clone
git clone https://github.com/KatieLG/python-uiua.git
cd python-uiua
# Install dependencies
uv sync
# Build and install
uv run maturin develop
Dev Commands
| Command | Purpose |
|---|---|
make dev |
Rebuild after making changes to Rust code |
make test |
Run unit tests |
make lint |
Run linters and type checkers |
make format |
Auto-format code |
make check |
Format, lint, and test |
make build |
Build wheel for distribution |
make test-release |
Publish to TestPyPI |
make release |
Publish to PyPI |
Links
Metadata
Release files for pyuiua 0.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyuiua-0.0.10.tar.gz | 52.7 kB | Without provenance | Details for pyuiua-0.0.10.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pyuiua-0.0.10-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for pyuiua-0.0.10-cp310-abi3-win_amd64.whl |
| pyuiua-0.0.10-cp310-abi3-win32.whl | CPython 3.10 | abi3 | Windows x86-32 | Details for pyuiua-0.0.10-cp310-abi3-win32.whl |
| pyuiua-0.0.10-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details for pyuiua-0.0.10-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| pyuiua-0.0.10-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for pyuiua-0.0.10-cp310-abi3-macosx_11_0_arm64.whl |
| pyuiua-0.0.10-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for pyuiua-0.0.10-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 70.1 MB
Release files / pyuiua-0.0.10.tar.gz
| Download URL | pyuiua-0.0.10.tar.gz |
|---|---|
| Size | 52.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49ee8f3ff9a514d03bd8671ca42e7357ddad5ebeb4b683d11c88390b5fb3ac88
|
|
BLAKE2b-256 checksum How to use checksums |
3bf600e68cf9884931bf362ba0135ebdede08de52087f6ff3590c67d6d42627e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyuiua-0.0.10-cp310-abi3-win_amd64.whl
| Download URL | pyuiua-0.0.10-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 14.3 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
804a3a8621e678564b1e46b3ccf2a8e8c59a71abea2495490512be52d0e817dc
|
|
BLAKE2b-256 checksum How to use checksums |
6f0855d85743d6a1ccb6f3b615238d96df7666f291f1504b61ff1cb04cf19068
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyuiua-0.0.10-cp310-abi3-win32.whl
| Download URL | pyuiua-0.0.10-cp310-abi3-win32.whl |
|---|---|
| Size | 12.7 MB |
| Tags | CPython 3.10 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
c94b82ab8b9b8b06503209bd95d65098db7717c32a095019b77480854ba62139
|
|
BLAKE2b-256 checksum How to use checksums |
a4d2131d83806bd25cc00a1c8b75e8dbc8e68efcbf44bdd43b185bcafa20ea25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyuiua-0.0.10-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | pyuiua-0.0.10-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 15.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1734000bc12404d8e5515af94df6257583c0bdf77f2c614aee54a233ac2df60a
|
|
BLAKE2b-256 checksum How to use checksums |
83273b9b897b3f8444fd623271d384fa7b88d9652db28334f8dccd18c5ad10f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyuiua-0.0.10-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | pyuiua-0.0.10-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 13.9 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1acd50d6c4932c635a20098a683b0d3eabc77022c417e19bcab2108b18d355a0
|
|
BLAKE2b-256 checksum How to use checksums |
5517c3719157266e358766655c4e9d72f8bbaa072e5093fe51391abdeb6ab7e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyuiua-0.0.10-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | pyuiua-0.0.10-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 14.1 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c162ce866fafa1678fb1bf5bb9e98926881e921f1919535cc4a0dc3e09e677aa
|
|
BLAKE2b-256 checksum How to use checksums |
6b315b4e48f04d5e1ea339cc413192388ac6d465fc9bcf9f5878095026526f3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Security for pyuiua 0.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.