{"id":22574803,"url":"https://github.com/thoth-station/fext","last_synced_at":"2025-08-02T08:08:52.722Z","repository":{"id":43099652,"uuid":"245108965","full_name":"thoth-station/fext","owner":"thoth-station","description":"Fast CPython extensions to Python standard library with focus on performance.","archived":false,"fork":false,"pushed_at":"2023-05-29T21:37:31.000Z","size":155,"stargazers_count":2,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-02T06:44:06.248Z","etag":null,"topics":["hacktoberfest","heapq","python","python-extension","python3","thoth"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thoth-station.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-05T08:34:13.000Z","updated_at":"2022-03-06T17:16:23.000Z","dependencies_parsed_at":"2025-04-10T16:11:26.870Z","dependency_job_id":"fd388d35-87cd-4ec2-9dac-c0ebd44921fb","html_url":"https://github.com/thoth-station/fext","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":"thoth-station/template-project","purl":"pkg:github/thoth-station/fext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Ffext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Ffext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Ffext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Ffext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thoth-station","download_url":"https://codeload.github.com/thoth-station/fext/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Ffext/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268351503,"owners_count":24236420,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["hacktoberfest","heapq","python","python-extension","python3","thoth"],"created_at":"2024-12-08T03:08:03.539Z","updated_at":"2025-08-02T08:08:52.693Z","avatar_url":"https://github.com/thoth-station.png","language":"C++","readme":"fext\n----\n\nFast CPython extensions to Python standard library with focus on performance.\n\nThis library provides CPython native extensions to mimic some of the well known\nbuilt-in types. The implementation relies on enforced protocol - all the\nobjects and abstract data types are implemented in C/C++ to provide highly\neffective manipulation.\n\nSee `this video for more info \u003chttps://youtu.be/B7GsCVFpaXo?t=2235\u003e`__.\n\nExtended heapq - fext.ExtHeapQueue\n==================================\n\nThe extended heap queue acts as a min-heap queue from the standard Python\nlibrary.  It uses a hash table for storing information about indexes (where\nvalues sit in the min-heap queue) to optimize removals from the heap\nto O(log(N)) in comparision to the original O(N+N*log(N)).\n\n.. figure:: https://raw.githubusercontent.com/thoth-station/fext/master/fig/fext_extheapq.png\n   :scale: 40%\n   :align: center\n\nUsing fext in a C++ project\n===========================\n\nThe design of this library allows you to use sources in your C++ project as\nwell. The ``eheapq.hpp`` file defines the extended heap queue and ``edict.hpp`` the\nextended dictionary. Python files then act as a bindings to their respective\nPython interfaces. Mind the API design for the templated classes - it was meant to\nbe used with pointers to objects (so avoid possible copy constructors).\n\nBuilding the extensions\n=======================\n\nTo build extensions, install the following packages (Fedora):\n\n.. code-block:: console\n\n  dnf install -y python3-devel g++ gcc\n\nNow you can build extensions:\n\n.. code-block:: console\n\n  python3 setup.py build\n\nIf you would like to produce binaries with debug information:\n\n.. code-block:: console\n\n  CFLAGS='-Wall -O0 -ggdb' python3 setup.py build\n\nCheck sections below for more info on testing the C/C++ parts of extensions.\n\nWhen building extension for a more recent Python releases (e.g. Python 3.8) build the extension\ninside the container image so that it provides required libraries with the required symbols:\n\n```console\ncd fext/\npodman run --rm --workdir /io --entrypoint bash -it --volume `pwd`:/io:Z quay.io/pypa/manylinux2014_x86_64\nyum install -y rh-python38-python-setuptools-wheel rh-python38-python rh-python38-python-devel rh-python38-python-wheel\nscl enable rh-python38 bash\npython3 setup.py bdist_wheel\nauditwheel repair dist/*\ntwine upload dist/*\n```\n\nReference count and memory leak checks\n======================================\n\nYou can find ``Makefile`` in the Git repo. This repo defines targets to\nperform leak checks and reference count checks. Note they use different Python\ninterpreters (with/without debug information) so make sure you do not mix\nvirtual environments when running the tests.\n\n.. code-block:: console\n\n  make check\n\nDeveloping the extension\n========================\n\nFirst, prepare your environment:\n\n.. code-block:: console\n\n  dnf install -y make\n  make deps\n\nTo develop or adjust sources, simply change sources and verify your\nchange is accepted by the test suite:\n\n.. code-block::\n\n  make check\n\nThe ``check`` target will run the actual test suite (see also ``make test``).\nBesides it, the test suite will be executed two more times to check test suite\nand its behaviour with respect to Python object reference counting\n(``python3-debug`` dependency will be automatically installed with the provided\n``make deps``). This part of the test suite can be executed using ``make\ncheck-refcount``. The last part of the test suite runs valgrind against the\ntest suite - you can explicitly trigger this part by calling ``make\ncheck-leaks``.\n\nMind ``make check-refcount`` and ``make check-leaks`` will take some time given the\nchecks and processing that is done on the background. To verify your changes\nmore iterativelly, ``make test`` should do the trick (don't forget to do ``make\ncheck`` after that though).\n\nTo clean up your environment, perform:\n\n.. code-block:: console\n\n  make clean\n\nBuilding and releasing\n======================\n\nThe release can be done from a containerized environment:\n\n.. code-block:: console\n\n  podman run --rm --workdir /io --entrypoint bash -it --volume `pwd`:/io:Z quay.io/pypa/manylinux2014_x86_64 -c \"yum install -y make \u0026\u0026 make all\"\n\nTo check what's happening, let's run a containerized environment - this can be\nhelpful when you are testing or developing the extension:\n\n.. code-block:: console\n\n  podman run --rm --workdir /io --entrypoint bash -it --volume `pwd`:/io:Z quay.io/pypa/manylinux2014_x86_64\n\nThe following commands (run in the container stated above) will install all\nthe necessary tools:\n\n.. code-block:: console\n\n  yum install -y make\n  make deps\n\nOnce tests pass, clean the environment:\n\n.. code-block:: console\n\n  make clean\n\nNow we should be ready to produce ``bdist_wheel`` and ``sdist`` distribution\nfor PyPI:\n\n.. code-block:: console\n\n  python3 setup.py bdist_wheel\n  python3 setup.py sdist\n\nFinally, upload artifacts to PyPI:\n\n.. code-block:: console\n\n  auditwheel repair fext/*.whl\n  twine upload wheelhouse/*.whl\n\nAlternativelly you can let ``make all`` happen.\n\nInstallation\n============\n\nThe project is `hosted on PyPI \u003chttps://pypi.org/project/fext/\u003e`_. You can\ninstall it via ``pip`` or ``Pipenv``:\n\n.. code-block:: console\n\n  pipenv install fext\n  # pip3 install fext\n\nIf there is no release conforming your system, a build process is triggered\nduring the installation - requires ``python3-devel`` and ``gcc/g++``.\n\nUsage\n=====\n\nThese data structures were designed for Thoth's adviser - for data kept in\nresolver's internal state as well as in the reinforcement learning part.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoth-station%2Ffext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthoth-station%2Ffext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoth-station%2Ffext/lists"}