{"id":19252391,"url":"https://github.com/ssciwr/pybind11-numpy-example","last_synced_at":"2025-04-30T22:46:36.802Z","repository":{"id":42174374,"uuid":"378230941","full_name":"ssciwr/pybind11-numpy-example","owner":"ssciwr","description":"Example of using pybind11 with numpy and publishing to PyPI and conda-forge","archived":false,"fork":false,"pushed_at":"2025-04-07T17:24:45.000Z","size":321,"stargazers_count":25,"open_issues_count":1,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T22:46:27.906Z","etag":null,"topics":["cibuildwheel","conda-forge","continuous-deployment","continuous-integration","cpp","pybind11","pypi","python","wheels"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ssciwr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-18T18:09:07.000Z","updated_at":"2025-01-07T08:01:33.000Z","dependencies_parsed_at":"2024-01-04T10:41:31.652Z","dependency_job_id":"2da796e7-502c-4eff-9256-665d5c34df94","html_url":"https://github.com/ssciwr/pybind11-numpy-example","commit_stats":null,"previous_names":[],"tags_count":15,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssciwr%2Fpybind11-numpy-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssciwr%2Fpybind11-numpy-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssciwr%2Fpybind11-numpy-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssciwr%2Fpybind11-numpy-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssciwr","download_url":"https://codeload.github.com/ssciwr/pybind11-numpy-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251795388,"owners_count":21645019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cibuildwheel","conda-forge","continuous-deployment","continuous-integration","cpp","pybind11","pypi","python","wheels"],"created_at":"2024-11-09T18:26:41.314Z","updated_at":"2025-04-30T22:46:36.757Z","avatar_url":"https://github.com/ssciwr.png","language":"Python","readme":"# pybind11-numpy-example\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI Release](https://img.shields.io/pypi/v/pybind11-numpy-example.svg)](https://pypi.org/project/pybind11-numpy-example)\n[![Conda Release](https://img.shields.io/conda/v/conda-forge/pybind11-numpy-example)](https://anaconda.org/conda-forge/pybind11-numpy-example)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pybind11-numpy-example)](https://pypi.org/project/pybind11-numpy-example)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/lkeegan/pybind11-numpy-example/ci.yml?branch=main)](https://github.com/lkeegan/pybind11-numpy-example/actions/workflows/ci.yml)\n[![Documentation Status](https://readthedocs.org/projects/pybind11-numpy-example/badge/)](https://pybind11-numpy-example.readthedocs.io/)\n\n# What\n\nA simple example of how to use [pybind11](https://github.com/pybind/pybind11) with [numpy](https://numpy.org/) and publish this as a library on [PyPI](https://pypi.org/project/pybind11-numpy-example/) and [conda-forge](https://anaconda.org/conda-forge/pybind11-numpy-example).\n\nThis C++/Python library creates a `std::vector` of 16-bit ints,\nand provides a Python interface to the contents of this vector in a few different ways:\n\n- a Python [List](https://docs.python.org/3/tutorial/datastructures.html#more-on-lists) (copy the data)\n- a NumPy [ndarray](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html) (copy the data).\n- a NumPy [ndarray](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html) (move the data).\n\n# Why\n\nPython Lists are great!\nHowever, when storing many small elements of the same type,\na Numpy array is much faster and uses a lot less memory:\n\n![Memory used vs number of elements](https://raw.githubusercontent.com/ssciwr/pybind11-numpy-example/main/scripts/memory.png)\n\n![Time used vs number of elements](https://raw.githubusercontent.com/ssciwr/pybind11-numpy-example/main/scripts/time.png)\n\n# How\n\nThe pybind11 code is in [src/pybind11_numpy_example_python.cpp](https://github.com/ssciwr/pybind11-numpy-example/blob/main/src/pybind11_numpy_example_python.cpp).\n\nThe python package is defined in [pyproject.toml](https://github.com/ssciwr/pybind11-numpy-example/blob/main/pyproject.toml)\nand uses [scikit-build-core](https://github.com/scikit-build/scikit-build-core).\n\nEach tagged commit triggers a [GitHub action job](https://github.com/ssciwr/pybind11-numpy-example/actions/workflows/pypi.yml)\nwhich uses [cibuildwheel](https://cibuildwheel.readthedocs.io/) to build and upload a new release including binary wheels for all platforms to [PyPI](https://pypi.org/project/pybind11-numpy-example/).\n\nThe [conda-forge package](https://anaconda.org/conda-forge/pybind11-numpy-example) is generated from [this recipe](https://github.com/conda-forge/pybind11-numpy-example-feedstock/blob/main/recipe/meta.yaml), and automatically updates when a new version is uploaded to PyPI.\n\nThe scripts used to generate the above plots are in [scripts](https://github.com/ssciwr/pybind11-numpy-example/tree/main/scripts).\n\nThis repo was quickly set up using the SSC [C++ Project Cookiecutter](https://github.com/ssciwr/cookiecutter-cpp-project).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssciwr%2Fpybind11-numpy-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssciwr%2Fpybind11-numpy-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssciwr%2Fpybind11-numpy-example/lists"}