writepy
A library for easing boilerplates in writing Python, with static checking support.
Working with types
- UNQ:
Expr[T] -> T, anti-quotation - Q:
T -> Expr[T], quotation
Code Generation
Q: what does with CG >> seq: stmts... mean?
A: Generating statically checked stmts... to variable seq, where seq shall have .extend method.
Example: A Family of Variables with Index-concerned Initialization
from writepy import *
import ast
import ast_compat as astc
def f(base: str):
seq = []
for each in range(5):
lhs = expr_as_is(object, base + str(each))
rhs = expr_from_repr(each)
call = Q[base + 1](lhs, rhs)
with CG >> seq:
UNQ[call]
UNQ[lhs] = (UNQ[rhs], UNQ[expr_from_repr(base)])
return seq
mk_cg(f)
seq_ = f("base")
print(astc.unparse(ast.Module(seq_)))
codegen:
(base + 1)(base0, 0)
base0 = (0, 'base')
(base + 1)(base1, 1)
base1 = (1, 'base')
(base + 1)(base2, 2)
base2 = (2, 'base')
(base + 1)(base3, 3)
base3 = (3, 'base')
(base + 1)(base4, 4)
base4 = (4, 'base')
Metadata
Release files for writepy 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| writepy-0.1-py3-none-any.whl | Python 3 | none | any | Details for writepy-0.1-py3-none-any.whl |
Release files / writepy-0.1-py3-none-any.whl
| Download URL | writepy-0.1-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47f03b66288b99bbf70203e7e528bc49e14ff273e829517dda1f654754f881d2
|
|
BLAKE2b-256 checksum How to use checksums |
1718e3c80581c0b7b20b3a2e0dff6f8e3ab812f5350dc64ed0137870c2225680
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.8.0 tqdm/4.44.1 CPython/3.7.4
|
Security for writepy 0.1
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.