Skip to main content

📦 perfect-eval

Safe eval module

Installation

pip install -i https://mirrors.aliyun.com/pypi/simple/ --extra-index-url https://pypi.org/simple/ perfect-eval

Example

from perfect_eval import eval_expr

eval_expr("print('hello world')", {"print": print})
# output: hello world
print(eval_expr("now.strftime('%m-%d')", {"now": datetime.now()}))
# output: 10-31
print(eval_expr("a + b", {"a": 123, "b": 456}))
# output: 579
print(eval_expr("f'{a} + {b} = {a + b}'", {"a": 123, "b": 456}))
# output: 123 + 456 = 579
print(eval_expr("match(a, [(1, '11'), (2, '22'), (3, '33')], default='ooo')", {"a": 1}))
# output: 11
print(eval_expr(r"re.sub(r'\d+', '很多', count)", {"count": '10个'}))
# output: 很多个

To Do

  • Be the best version of you.

More Resources

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Metadata

Release files for perfect-eval 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perfect-eval 0.0.10
File Size Uploaded Provenance
perfect-eval-0.0.10.tar.gz 16.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for perfect-eval 0.0.10
File Interpreter ABI Platform
perfect_eval-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / perfect-eval-0.0.10.tar.gz

Download URL perfect-eval-0.0.10.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1895bc87bdb393544ab12522da97409096a03592c1b184c865f5f086c5640481
BLAKE2b-256 checksum
How to use checksums
ad0d3d856722f4354cc43862a5eba1026763b2b9899a861b7c57131dc2ebd12b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.5

Release files / perfect_eval-0.0.10-py3-none-any.whl

Download URL perfect_eval-0.0.10-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e921baf1435c2a749a4035bb8ef240024443a277b6cf793f12579253a3341129
BLAKE2b-256 checksum
How to use checksums
3202838a53691352d789904f9099262999e4c588dee3572c1dc43bf9c4c0e31b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.5

Security for perfect-eval 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page