Skip to main content

findlibs

A Python package that searches for shared libraries on various platforms.

Usage

import findlibs
lib = findlibs.find("eccodes")

# If package name differs from library name use:
lib = findlibs.find(lib_name="odccore", pkg_name="odc")

Installation

pip install findlibs

Testing

git clone https://github.com/ecmwf/findlibs
cd findlibs
pip install -e ".[test]"
pytest

find

The module only contains the find() function.

def find(lib_name, pkg_name=None)

Returns the path to the selected library, or None if not found.

Arguments:

  • lib_name str - Library name without the lib prefix. The name of the library to find is formed using lib_name and a platform specific suffix (by default ".so"). E.g. when lib_name is "eccodes" the library name will be "libeccodes.so" on Linux and "libeccodes.dylib" on macOS.
  • pkg_name str, optional - Package name if it differs from the library name.

Returns:

str or None: Path to selected library

The algorithm to find the library is as follows:

  • First, tries to find the library in an installed python module package with the given name, e.g. eccodeslib, eckitlib. Disable this search option by setting environment variable FINDLIBS_DISABLE_PACKAGE=yes.

  • Next, tries the lib and lib64 directories under sys.prefix and $CONDA_PREFIX. Disable this search option by setting environment variable FINDLIBS_DISABLE_PYTHON=yes.

  • Next, tries the lib and lib64 directories under the paths defined by the pkg_name + "_HOME" and pkg_name + "_DIR" environment variables. Both lowercase and uppercase versions are tested. E.g. if pkg_name is "eccodes" it will check the paths defined by $eccodes_dir, $eccodes_home, $ECCODES_DIR and $ECCODES_HOME. Disable this search option by setting environment variable FINDLIBS_DISABLE_HOME=yes.

  • Next, tries to load the search paths from the user defined ~/.findlibs or ~/.config/findlibs/findlibs.conf INI configuration files. Then for all the user defined search paths, the lib and lib64 subdirectories are tried.

    Please note that only one of these files can exist. The configuration file can contain multiple search paths, but no relative paths or paths to files are allowed. The file can even be completely empty or can contain no paths at all. The file format is as follows:

    [Paths]
    /path/to/lib_directory
    

    Disable this search option by setting environment variable FINDLIBS_DISABLE_CONFIG_PATHS=yes.

  • Next, tries the directories defined by the $LD_LIBRARY_PATH and $DYLD_LIBRARY_PATH environment variables. Disable this search option by setting environment variable FINDLIBS_DISABLE_LD_PATH=yes.

  • Next, tries the lib and lib64 directories under the following paths "/", "/usr/", "/usr/local/", "/opt/", "/opt/homebrew/" and "~/.local/". Disable this search option by setting environment variable FINDLIBS_DISABLE_SYS=yes.

  • Finally, tries calling the ctypes.util.find_library function. Disable this search option by setting environment variable FINDLIBS_DISABLE_CTYPES_UTIL=yes.

Metadata

Release files for findlibs 0.1.4

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

Source distribution (sdist)

Source distribution for findlibs 0.1.4
File Size Uploaded Provenance Actions
findlibs-0.1.4.tar.gz 11.5 kB Without provenance Details for findlibs-0.1.4.tar.gz

Built distribution (wheel)

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

Total release size: 22.2 kB

Release files / findlibs-0.1.4.tar.gz

Download URL findlibs-0.1.4.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4aa4637d4f18d25a877c8ef16d1585195a4eb7360e0949fd59600b4d9b367a3b
BLAKE2b-256 checksum
How to use checksums
949a80eb3cc26a4891251abb88628437a7c9fca4d53fe38f5ea642a2bfdc9184
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Release files / findlibs-0.1.4-py3-none-any.whl

Download URL findlibs-0.1.4-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d37f4f67d0705daea23a26b7a3310320968c95a8f3287d36622c2f6415e79c1
BLAKE2b-256 checksum
How to use checksums
1bb9cacf9154b4c348b13c09dd23a2f980354eb89736cade8dc641e152bbc428
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Security for findlibs 0.1.4

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