Used to validate restricted python code inputs against test cases.
Project description
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uscg_leetcode_validator-1.0.6.tar.gz.
File metadata
- Download URL: uscg_leetcode_validator-1.0.6.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bf5b252bc966d6ea19d1d728c5ee529c022339072f3af089fd9b8b644f561e7
|
|
| MD5 |
af08d6d0dbc2bd4e615a0eb3c9fb482a
|
|
| BLAKE2b-256 |
755cdf7c3296ca62759de1675fac587ade3ab69f030de356eb40b904dff568e7
|
File details
Details for the file uscg_leetcode_validator-1.0.6-py3-none-any.whl.
File metadata
- Download URL: uscg_leetcode_validator-1.0.6-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7358e5bdf1b4602509cc5302823cd184431893758b839b6cdb940742c1b0e56
|
|
| MD5 |
b53648ec45b8d7f7af578888fb63ccde
|
|
| BLAKE2b-256 |
012ab457b58bc033a44a90c7a95f69c40b063f46953e3541dabf659a94e3316d
|