Skip to main content

cppyy wrapper for Lyncs

python pypi license build & test codecov pylint black

In this package we provide some additional features to cppyy.

Installation

The package can be installed via pip:

pip install [--user] lyncs_cppyy

Documentation

The main documentation of cppyy is available at https://cppyy.readthedocs.io/en/latest/.

cppyy is an automatic, run-time, Python-C++ bindings generator, for calling C++ from Python [...]

Lyncs_cppyy is an additional layer between cppyy and the interfaces to libraries provided by Lyncs. In the following we give an overview of the additional functionalities.

Lib class

In cppyy, libraries are loaded and used as follow:

>>> import cppyy
>>> cppyy.include('zlib.h')        # bring in C++ definitions
>>> cppyy.load_library('libz')     # load linker symbols
>>> cppyy.gbl.zlibVersion()        # use a zlib API
'1.2.11'
>>>

In lyncs_cppyy we have define the class Lib for holding the information on a library. It is used as follow

>>> from lyncs_cppyy import Lib
>>> zlib = Lib(header = 'zlib.h', library = 'libz')
>>> zlib.zlibVersion()
'1.2.11'
>>>

Lib returns a variable that represents the library. The library is loaded at the first usage of the variable. In most of the cases, accessing attributes of the variable is like accessing attributed of cppyy.gbl. Exceptions are made for

  • macros defined in the headers, e.g. zlib.ZLIB_VERSION -> '1.2.11'
  • functions defined under a namespace which can be directly accessed specifying a namespace
  • and the following attributes of Lib, e.g. zlib.header -> ['zlib.h'].

The list of attributes and initialization options of Lib are:

  • header: string(or list) of the header(s) to be included.

  • library: string(or list) of the shared library(ies) to be loaded. A library can also be an instance of the Lib class.

  • c_include: if the library is a c library (True) or a c++ library (False, default)

  • namespace: in case of a c++ library, a string(or list) of the namespace(s) to be used. Equivalent to using namespace ... in c++. Without, symbols should be access as lib.namespace.*.

  • path: string(or list) of the path(s) to the base directory of the library. Headers will be searched in PATH/include and libraries in PATH/lib.

  • include: string(or list) of the directory(ies) to include. Equivalent to -I used at compile time.

  • defined: dictionary of aliases that act as defined macros.

Other functions

  • loaded_libraries(): Returns the list of loaded libraries
  • to_pointer(ptr, ctype="void *"): Converts an integer (ptr) to cppyy pointer
  • CppType(ctype): Generates a base class that allows for automatic type conversion calling the look-up method __cppyy__. See its doc for more details.
  • array_to_pointers(arr): Creates a c-style array of pointers to be used for accessing the elements of a numpy-like array.

Metadata

Release files for lyncs-cppyy 0.2.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 lyncs-cppyy 0.2.0
File Size Uploaded Provenance
lyncs_cppyy-0.2.0.tar.gz 12.2 kB Without provenance Details

Release files / lyncs_cppyy-0.2.0.tar.gz

Download URL lyncs_cppyy-0.2.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5563d1f4cd046274f284dd20183d4b0066b91422a1de4d60910e17a9a37004f7
BLAKE2b-256 checksum
How to use checksums
d3be2dd6b70d842bfc50febaafe1fa101edfc8c70b21589c41d6e4e70acf42f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Security for lyncs-cppyy 0.2.0

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.

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