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()andrange() - ✅ 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 1.0.7
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 |
|---|---|---|---|---|
| uscg_leetcode_validator-1.0.7.tar.gz | 4.0 kB | Without provenance | Details for uscg_leetcode_validator-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| uscg_leetcode_validator-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for uscg_leetcode_validator-1.0.7-py3-none-any.whl |
Total release size: 8.8 kB
Release files / uscg_leetcode_validator-1.0.7.tar.gz
| Download URL | uscg_leetcode_validator-1.0.7.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75249b1bf401991a6be901db6c2e830bd7b3daa7add860a31fb4b79b6ea84b32
|
|
BLAKE2b-256 checksum How to use checksums |
476bc9ae9dd0521e5180b96ccaab49bc148c0fd079cc42b52700d3d69b5beb41
|
| 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-1.0.7-py3-none-any.whl
| Download URL | uscg_leetcode_validator-1.0.7-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9e5ed9517502cda939708e2dd5a93e3cda4acc9436f72cc553fb7ff27a0e648
|
|
BLAKE2b-256 checksum How to use checksums |
64b199711b4085a5e731e2853f151707cd02b5dcacb1ca06b3b53bffcb69f66a
|
| 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 1.0.7
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.