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.3.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.3-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pwcp-0.12.3.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.3.tar.gz
Algorithm Hash digest
SHA256 bb76300888dbe2fb277dbdc01235c3046b83b5bf8580b5e3f41112cca56c5fdc
MD5 8fef2be8ea2a189b7669dbbb2daf88cb
BLAKE2b-256 7977333ba07ecf563cf8ef1662b14a2c87794518fe10429bdf86d72b20ec93ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for pwcp-0.12.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: pwcp-0.12.3-py3-none-any.whl
  • Upload date:
  • Size: 10.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8320243270039059aa0beada05db8e9e3e87f59a894fd79b6cd4267d8d290d58
MD5 7d7eebc2516f50c7a088cc1175b8a4bf
BLAKE2b-256 382743e97597bc9e3ffe4f7aaf20de0cbf676b261f899db6a23a6fa8a2b72465

See more details on using hashes here.

Provenance

The following attestation bundles were made for pwcp-0.12.3-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