Skip to main content

Build Status MIT License

PseuToPy

PseuToPy is a Python library which defines a grammar for a pseudocode-based pseudocode. With this grammar, PseuToPy is then able to take instructions written in pseudocode and convert it into the equivalent Python instructions.

PseuToPy is designed for educational purposes. In that sense, PseuToPy is suited to anyone embarking in the journey of learning Python programming by offering a relaxed syntax and a grammar that very much resembles the grammar of a natural language.

Currently, PseuToPy only exists in English, but more languages (French, Italian, Spanish) will arrive soon.

Installation

Use the package manager pip to install PseuToPy.

pip install pseutopy

This will also install the following dependencies:

Usage

You can import PseuToPy and use it within your own project.

from pseutopy.pseutopy import PseuToPy
import astor

pseutopy = PseuToPy()

# These two lines generate the AST of the pseudocode instructions
convert_from_string = pseutopy.convert_from_string("declare a set a to 3 plus 1")
convert_from_file = pseutopy.convert_from_file("./path/to/file")

# You can then convert these AST into Python instructions with astor
print(astor.to_source(convert_from_string))
print(astor.to_source(convert_from_file))

Or you can use the CLI utility that ships with this repository.

python pseutopy.py --help

# This is the output of the help flag
usage: pseutopy.py [-h] [-f | -s] [-a] [-q] input

A pseudocode to Python converter written in Python using textX.

positional arguments:
  input         Pseudocode input and to be converted into Python

optional arguments:
  -h, --help    show this help message and exit
  -f, --file    Input is now expected to be a file
  -s, --string  Input is now expected to be a string (default)
  -a, --ast     Prints out the generated Python AST
  -q, --quiet   Don't print the generated Python code

Testing

To run unit tests, run pytest at the root of the project.

Authors and acknowledgment

I particularly wish to thank @Houguiram, @TheOnlyMrFlow, and @EricSombroek for their contributions which greatly helped in setting up the bases for this project.

License

MIT

Metadata

Release files for pseutopy 1.0.1.post12

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

Source distribution (sdist)

Source distribution for pseutopy 1.0.1.post12
File Size Uploaded Provenance Actions
PseuToPy-1.0.1.post12.tar.gz 12.5 kB Without provenance Details for PseuToPy-1.0.1.post12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pseutopy 1.0.1.post12
File Interpreter ABI Platform Actions
PseuToPy-1.0.1.post12-py3-none-any.whl Python 3 none any Details for PseuToPy-1.0.1.post12-py3-none-any.whl

Total release size: 25.1 kB

Release files / PseuToPy-1.0.1.post12.tar.gz

Download URL PseuToPy-1.0.1.post12.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c7c3a58799fcb2b3c2d5cda44676b3ee85491af86168ca0f51fa68815cba5786
BLAKE2b-256 checksum
How to use checksums
e6eb914a277c6ea7021e66f6403fc65d8f897f5496d0ab87cf39dde41b0e8e74
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 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / PseuToPy-1.0.1.post12-py3-none-any.whl

Download URL PseuToPy-1.0.1.post12-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11c05c182120dc4c10029681f3e82dcc0d8804fd193f06cbbced3384c943e9e9
BLAKE2b-256 checksum
How to use checksums
02d35428f64512ae4d06be9f4333403e0c0d9876a04885524ff0624e455b5eff
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 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Security for pseutopy 1.0.1.post12

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.

Release history Release notifications | RSS feed

This release
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