Skip to main content

Python with C preprocessor

Project description

pwcp

Python with C preprocessor

Installation

pip install pwcp

Running

pwcp <file>

pwcp -m <module>

Or run built-in code module to start interactive console:

pwcp --preprocess-unknown-sources -m code

(--preprocess-unknown-sources is necessary because <console> is not a .ppy file)

Run pwcp -h for more options.

Why?

For fun! And for YABI.

How to use it?

The extension for files that need to be preprocessed is .ppy (pre-python). You can start by creating hello.ppy and putting there something like

#define hello "Hello "
#define world "world!"
print(hello world)

Then run it

~ $ pwcp hello.ppy
Hello world!

Congratulations! You've run your first program with PWCP.

Extension for header files?

Suggested extension is .pyh (python header), but technically you can use whatever you like.

What about comments?

The suggested way to write comments in .ppy (and .pyh) files is /* comment */

// is not a comment as it's floor division in Python and # indicates preprocessor directives.

Does it work with pure Python?

Of course. It works like an extension allowing you to run and import .ppy files. You can import .ppy file in .py file and vice versa.

Feel free to submit an issue if something doesn't work.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pwcp-0.12.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pwcp-0.12.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file pwcp-0.12.2.tar.gz.

File metadata

  • Download URL: pwcp-0.12.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pwcp-0.12.2.tar.gz
Algorithm Hash digest
SHA256 049066069c9af8a4d2304867446a9dc4a5fec4b693b408ccaaba889cd9eed265
MD5 4f4ae6119c0acec0610700085ee9ba79
BLAKE2b-256 43e3f701074bdf3276b0a32cead9d7690ad805c447020bb8abe09908a326d91e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pwcp-0.12.2.tar.gz:

Publisher: release.yml on solaluset/pwcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pwcp-0.12.2-py3-none-any.whl.

File metadata

  • Download URL: pwcp-0.12.2-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pwcp-0.12.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7abf502ac42afd0011a8fae6f1afaced5786f6384f989d2dcac8c10a9969346b
MD5 84ca82bf221cc6783dfa0a740a34706a
BLAKE2b-256 9713bcc2e1b2781a024fb7aa0afc2f20ea68d2ffbbb4827b9de096c6aad90f69

See more details on using hashes here.

Provenance

The following attestation bundles were made for pwcp-0.12.2-py3-none-any.whl:

Publisher: release.yml on solaluset/pwcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page