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.post10

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.post10
File Size Uploaded Provenance Actions
PseuToPy-1.0.1.post10.tar.gz 12.6 kB Without provenance Details for PseuToPy-1.0.1.post10.tar.gz

Built distribution (wheel)

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

Total release size: 25.6 kB

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

Download URL PseuToPy-1.0.1.post10.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2b6563f7c3078ee79b5d735a70fd77e713b887b7755af7a91f581482ae2e03c8
BLAKE2b-256 checksum
How to use checksums
738d4a670ce6b79e6870764f21790ad357996084fa97e0355e7a829f0362b11a
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.post10-py3-none-any.whl

Download URL PseuToPy-1.0.1.post10-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1254163ef75858fa23762423be6d72d7edfd7aa8f0fb529816be5d705f98ecc6
BLAKE2b-256 checksum
How to use checksums
e6f8af45cfeb5af9a4105922b660934ffd2e6f02fbe4263d2410093a5df2521c
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.post10

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