Skip to content

Commit

Permalink
Remove python generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Dec 30, 2019
1 parent bcd6608 commit 70710c6
Show file tree
Hide file tree
Showing 42 changed files with 0 additions and 12,180 deletions.
72 changes: 0 additions & 72 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ About

- `C` source code generator.

- `Python 3` C extension source code generator (under construction).

- `proto3`_ language parser.

Known limitations:
Expand Down Expand Up @@ -62,18 +60,6 @@ Benchmark

See `benchmark`_ for a benchmark of a few C/C++ protobuf libraries.

Python C extension source code design
=====================================

NOTE: The Python source code generator is under construction and is
not yet usable!

A Python C extension wrapper around generated C source code.

Known limitations:

- Same as for the C source code.

Example usage
=============

Expand Down Expand Up @@ -187,55 +173,6 @@ Build and run the program.
See `c/hello_world`_ for all files used in this example.

Python source code
------------------

Generate Python C extension source code from the proto-file.

.. code-block:: text
$ pbtools generate_python_source examples/python/hello_world/hello_world.proto
Successfully generated hello_world/.
Run 'cd hello_world && python3 setup.py build --build-platlib .. &&
cd ..' to build it.
Compile the generated code. This creates a shared object file that can
be imported by Python scripts.

.. code-block:: text
$ cd hello_world
$ python3 setup.py build --build-platlib ..
$ cd ..
Encode and decode the Foo-message in `main.py`_.

.. code-block:: python
import json
import hello_world
# Encode.
encoded = hello_world.foo_encode({'bar': 78})
print(f'Successfully encoded Foo into {len(encoded)} bytes.')
# Decode.
decoded = hello_world.foo_decode(encoded)
print(f'Successfully decoded {len(encoded)} bytes.')
print(f"Foo.bar: {decoded['bar']}")
Run the script.

.. code-block:: text
$ python3 main.py
Successfully encoded Foo into 2 bytes.
Successfully decoded 2 bytes into Foo.
Foo.bar: 78
See `python/hello_world`_ for all files used in this example.

Command line tool
-----------------

Expand All @@ -254,11 +191,6 @@ proto-file.
See `address_book.h`_ and `address_book.c`_ for the contents of the
generated files.

Ideas
=====

- Python data classes.

.. |buildstatus| image:: https://travis-ci.org/eerimoq/pbtools.svg?branch=master
.. _buildstatus: https://travis-ci.org/eerimoq/pbtools

Expand Down Expand Up @@ -286,8 +218,4 @@ Ideas

.. _c/hello_world: https://github.com/eerimoq/pbtools/blob/master/examples/c/hello_world

.. _main.py: https://github.com/eerimoq/pbtools/blob/master/examples/python/hello_world/main.py

.. _python/hello_world: https://github.com/eerimoq/pbtools/blob/master/examples/python/hello_world

.. _benchmark: https://github.com/eerimoq/pbtools/blob/master/benchmark
6 changes: 0 additions & 6 deletions examples/python/address_book/Makefile

This file was deleted.

26 changes: 0 additions & 26 deletions examples/python/address_book/address_book.proto

This file was deleted.

16 changes: 0 additions & 16 deletions examples/python/address_book/generated/setup.py

This file was deleted.

0 comments on commit 70710c6

Please sign in to comment.