Skip to main content

USCG Leetcode Validator

A secure Python code validator for coding challenge platforms like LeetCode-style or CTF environments.

This package runs and validates submitted Python functions under strict constraints using Python's AST (Abstract Syntax Tree). It ensures that only allowed operations (like basic loops, arithmetic, and safe built-ins) are used. This is ideal for running untrusted user code in coding competitions, while preventing unsafe or unwanted behavior.


🚀 Features

  • ✅ Accepts only a single top-level function in the submitted code
  • ✅ Rejects all imports, lambdas, classes, and custom function definitions
  • ✅ Optionally allows safe built-ins like len() and range()
  • ✅ Enforces AST-level constraints before execution
  • ✅ Runs submitted function against a list of test cases
  • ✅ Outputs time taken and pass/fail result for each test case

📦 Installation

To install from PyPI:

pip install uscg-leetcode-validator

Metadata

Release files for uscg-leetcode-validator-2 1.0.0

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

Source distribution (sdist)

Source distribution for uscg-leetcode-validator-2 1.0.0
File Size Uploaded Provenance Actions
uscg_leetcode_validator_2-1.0.0.tar.gz 4.3 kB Without provenance Details for uscg_leetcode_validator_2-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uscg-leetcode-validator-2 1.0.0
File Interpreter ABI Platform Actions
uscg_leetcode_validator_2-1.0.0-py3-none-any.whl Python 3 none any Details for uscg_leetcode_validator_2-1.0.0-py3-none-any.whl

Total release size: 9.4 kB

Release files / uscg_leetcode_validator_2-1.0.0.tar.gz

Download URL uscg_leetcode_validator_2-1.0.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f3a5664fedc7390a3578565a6cd161b324fa4a949dd40347b4ef8441d5c1ae35
BLAKE2b-256 checksum
How to use checksums
5f906e68c2b37e7090ee7203ac85f02cdce077651be0511a5b18d3ef526830f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / uscg_leetcode_validator_2-1.0.0-py3-none-any.whl

Download URL uscg_leetcode_validator_2-1.0.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8d284c7a5fcb8f3ff5c0a6a88e367ee9ae37e03703363fdb74fdf713dbf44eb
BLAKE2b-256 checksum
How to use checksums
3655b1ba128896506988e296ad43807e61652b6de4967b1a7f6374456ec67923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for uscg-leetcode-validator-2 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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