Skip to main content

cpp.py

Implementing C++ Semantics in Python

Disclaimer

This project is an experiment.

Please don't use it in any sensitive context.

Installation

From PyPI

pip install cpppy

From Source (Dev)

git clone https://github.com/tmr232/cpppy.git
cd cpppy
poetry install
poetry shell

Usage & Examples

Import magic inside a module and watch the magic happen.

Note that it only works inside modules. Importing it in an interactive shell or a Jupyter Notebook won't work.

That said, functions from said modules can be imported and used in regular Python code.

# examples/greeter.py

from cpp import magic


class Greeter:
    name: str

    public()

    def Greeter(name):
        this.name = name
        print(f"Hello, {this.name}!")

    def _Greeter():
        print(f"Goodbye, {this.name}.")


def main():
    greeter1 = Greeter(1)
    greetee2 = Greeter(2)
>>> python examples/greeter.py
Hello, 1!
Hello, 2!
Goodbye, 2.
Goodbye, 1.

Presentations

Metadata

Release files for cpppy 1.0.0

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

Source distribution (sdist)

Source distribution for cpppy 1.0.0
File Size Uploaded
cpppy-1.0.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cpppy 1.0.0
File Interpreter ABI Platform
cpppy-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / cpppy-1.0.0.tar.gz

Download URL cpppy-1.0.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
73b0e5d32a8878cac9b2f6c36be7161920fbe4f4c87262dafef518418ed5ee02
BLAKE2b-256 checksum
How to use checksums
cf94fdd1c13007096905de8797598b50ee1d287a52f2b09b0d9bd120af870d85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.7.4 Windows/10

Release files / cpppy-1.0.0-py3-none-any.whl

Download URL cpppy-1.0.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c791ca52878fd436e27b2470a8a59046a4e7988b343f89c0b12f6720af8538f
BLAKE2b-256 checksum
How to use checksums
3f0f30b34c9cf1658271377a8e0d066876ab599487495b70a7d7a1d2cc6ff0d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.7.4 Windows/10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.0

1 release file

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