Skip to main content

A lightweight AST based expression evaluator

Project description

sichercalc

Fork of ast_calculator, modernized and refactored as a reusable library.

What is SicherCalc?

When you need to evaluate simple mathematical or logical expressions supplied by untrusted users, you need a sandboxed environment that prevents arbitrary code execution. SafeCalc parses the expression into an abstract syntax tree (AST), inspects each node, and evaluates only those that belong to a predefined, whitelisted set of operations.

Why AST?

An abstract syntax tree (AST) is a tree‑structured representation of source code. By operating on the AST we can precisely control which constructs are allowed, eliminating the security risks associated with eval().

Features

  • No eval() – pure AST parsing and controlled evaluation
  • Extensible – register your own custom functions
  • Works on Python 3.10+

Getting Started

Installation

pip install sichercalc

CHANGELOG

0.0.0.dev1

  • New publishing try due to workflow error in 0.0.0.dev0.
  • Invalid development status classifier and workflow corrections.

0.0.0.dev0

Hello, world!

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

sichercalc-0.0.0.dev1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

sichercalc-0.0.0.dev1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file sichercalc-0.0.0.dev1.tar.gz.

File metadata

  • Download URL: sichercalc-0.0.0.dev1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sichercalc-0.0.0.dev1.tar.gz
Algorithm Hash digest
SHA256 6a2b0913a8f5869004920d213a8c9517ff9d10fe07c9e920c7a7ac6b7f2797d2
MD5 0568762869aec328a8fb73fa0a2d3f95
BLAKE2b-256 e2e45dc1965a331edcd07cc045876635b229c39a87e854c5a0b753e29a3a72de

See more details on using hashes here.

Provenance

The following attestation bundles were made for sichercalc-0.0.0.dev1.tar.gz:

Publisher: pypi.yml on Stalot/sichercalc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sichercalc-0.0.0.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for sichercalc-0.0.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ef239bdc667c9fc93f4c48d9ad039a06890d294ce01d89138da729182f871a
MD5 791b5991f597b8130afadbe57846fa95
BLAKE2b-256 f19f1b4cafe1273976fb337f65e73070fe473ba143ec4b9bf05330fd4b7a470d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sichercalc-0.0.0.dev1-py3-none-any.whl:

Publisher: pypi.yml on Stalot/sichercalc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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