C++ writer

The library provides an iterative interface for generating C/C++ code from Python.
Installation
pip install cppwriter
Usage
from cppwriter import FileBlock
file = FileBlock(indent_char=" ")
file.include("stdio.h", is_global=True)
file.line()
main = file.function("main", "int")
main.if_statement("PI > 4").line("return 1")
main.line("return 0")
print(str(file))
This will generate the following code:
#include <stdio.h>
int main() {
if (PI > 4) {
return 1;
}
return 0;
}
Relationship to cwriter
When I started making this library I didn't know about the existence of cwriter. I came across it while searching for a package name, but decided to give up and still finish my version.
Metadata
Release files for cppwriter 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cppwriter-0.0.4.tar.gz | 6.8 kB | Without provenance | Details for cppwriter-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cppwriter-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for cppwriter-0.0.4-py3-none-any.whl |
Total release size: 12.3 kB
Release files / cppwriter-0.0.4.tar.gz
| Download URL | cppwriter-0.0.4.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6f5c66ebca3fda4f07ff3c71e957d7dc314295a42b2479ac26e32198da74de5
|
|
BLAKE2b-256 checksum How to use checksums |
522d7c921f52fdc480cccc23b10b15b2a924a8a0e939ee205ba13b1aeb207992
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Release files / cppwriter-0.0.4-py3-none-any.whl
| Download URL | cppwriter-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e2903a5be8d5561112f9068c87442fd68bf018945e20cc5be83e3e1920f2260
|
|
BLAKE2b-256 checksum How to use checksums |
9fdcae6cda3504d011e426a53726998f6bdff96b5b9628cbce4888c28533ae16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Security for cppwriter 0.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.