astcheck
astcheck compares Python Abstract Syntax Trees against a template. This is useful for testing software that automatically generates or modifies Python code.
Installation:
pip install astcheck
Example use:
import ast, astcheck
template = ast.Module(body=[
ast.FunctionDef(name='double', args=ast.arguments(args=[ast.arg(arg='a')])),
ast.Assign(value=ast.Call(func=ast.Name(id='double')))
])
sample = """
def double(a):
do_things()
return a*2
b = double(a)
"""
astcheck.assert_ast_like(ast.parse(sample), template)
Only the parts specified in the template are checked. In this example, the code inside the function, and the assignment target (b) could be anything.
For more details, see the documentation.
Metadata
Release files for astcheck 0.4.0
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 |
|---|---|---|---|---|
| astcheck-0.4.0.tar.gz | 13.8 kB | Without provenance | Details for astcheck-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| astcheck-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for astcheck-0.4.0-py3-none-any.whl |
Total release size: 18.8 kB
Release files / astcheck-0.4.0.tar.gz
| Download URL | astcheck-0.4.0.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e979b7450aff2b9ddc166f0533141d8a3b13ce0dfb923efa76fe9ed7c8747844
|
|
BLAKE2b-256 checksum How to use checksums |
d4477b70dbf934043b983b2dd7cc87e9df8ca562ffcbb0798f9de7fcdb8561ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / astcheck-0.4.0-py3-none-any.whl
| Download URL | astcheck-0.4.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b21ed9943cf4f87a5d2092b8550c8314537d6fa43143d21d517c20a64aa7d56
|
|
BLAKE2b-256 checksum How to use checksums |
de053ec7e5edcf634bd826bd8463f6a7a3f0fa8202aa21b67809c97e61c49b8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Security for astcheck 0.4.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.