Skip to main content

A python package to preprocess text files with embedded Python code snippets: evaluate or execute them and replace with the result of evaluation/execution.

This package provides the ppp.py script. The script reads the file specified in the command line, finds python snippets, evaluates or executes them and writes out the file with the pyhton code replaced with the evaluateion/execution result.

The following example shows a template file (i.e. the file to be processed with ppp.py) and the result.

Template (test/t1.t)

Resulting file (test/t1.res.t)

``
The  characters on the 1-st line define
the delimiters, used to mark the python
snippets. In this case, both the begin
of the snippet and its end are denoted
with the backtick.

This is an evaluation snippet: `2*7`,
and this is an execution snippet:
`from math import pi; pi2=pi*2`.

Check that the definitions made in the
previous snippets are accessible: `pi2`.
The  characters on the 1-st line define
the delimiters, used to mark the python
snippets. In this case, both the begin
of the snippet and its end are denoted
with the backtick.

This is an evaluation snippet: 14,
and this is an execution snippet:
`from math import pi; pi2=pi*2`.

Check that the definitions made in the
previous snippets are accessible: 6.28318530718.

Install

The package is published on PyPI: https://pypi.org/project/twps/. The preffered way to install is:

>pip install twps

Getting help

For command line options see readme.rst in the twps folder or run the script without command line arguemnt.

General description with examples (somewhat outdated) can be found in the docs folder.

Metadata

Release files for twps 2.0.4

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

Source distribution (sdist)

Source distribution for twps 2.0.4
File Size Uploaded Provenance Actions
twps-2.0.4.tar.gz 71.5 kB Without provenance Details for twps-2.0.4.tar.gz

Release files / twps-2.0.4.tar.gz

Download URL twps-2.0.4.tar.gz
Size 71.5 kB
Tags Source
SHA-256 checksum
How to use checksums
25796bdebed019e3e8bc53614bcd57efcdad23c1e87464841feca9957bda042c
BLAKE2b-256 checksum
How to use checksums
ff2e386da522afb486a27770ff6799e814de31f0d5690fba4004fa39d3ad3715
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Security for twps 2.0.4

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.

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