Skip to main content

Python packaging wrapper for the libstring_util C library

Project description

contents

  • simple string operations:

  • string_replace(heystack, needle, repl) -> string

  • [{r,l}]strip(input, white="\r\n\t ") -> string

  • format_string(printf_format, args...) -> string

  • split_string(input, by, max=0) -> vector

  • join_string(vector input, string by) -> string

  • (de-)serialization to python source

    py_value* v = eval_full("[123, 123.456, 'string']");
    printf("python repr: %s\n", repr(v).c_str());
    // output: python repr: [123, 123.456, 'string']

check test/example/example.cpp

building

libstring_util has at least these build requirements:

  • g++
  • make

on debian (tested on jessie):

$ apt-get install build-essential

generate build system

if there is no file named "configure" you will need to generate the autotools-based build-system first. for that you will need these additional requirements:

  • autoconf (e.g. 2.69-8)
  • automake (e.g. 1.14)
  • libtool (e.g. 2.4.2-1.11)

on debian:

$ apt-get install automake libtool

to create the buildsystem go into this directory and execute:

$ autoreconf -if

this will generate a configure-file.

configure build system

you should build out of source tree. for that create a new directory and execute configure with your desired flags (try --help to see a list of possible options):

$ mkdir build
$ cd build
$ ../configure --prefix=/usr/local

start build

after configure successfully finished, you can call make to build the libstring_util library:

$ make -j4

on success the generated libraries can be found at build/src/.libs/

run test cases

$ make check

install

if you want to install the generated libraries to your system (to the above specified --prefix) you can use the install target:

$ make install

depending on where you want to install, you might need root-rights:

$ sudo make install

Python packaging

You can install libstringutil from PyPi using pip install libstring-util.

libstring_util ships a Python wrapper (python_pkg/) that builds the C library via autotools during pip install and installs the compiled .so and public headers into site-packages/libstring_util/{lib,include}.

The version is managed from a single source of truth: project.properties.

Quick start

# Install the package (builds the C library on-the-fly)
# You can pass -vv to activate verbose mode
uv pip install .

# Locate the installed library and headers
python -m libstring_util lib
python -m libstring_util include

# Or programmatically
python -c "import libstring_util; print(libstring_util.list_library_files())"

Testing the packaging locally

All commands below use uv (install via curl -LsSf https://astral.sh/uv/install.sh | sh).

Full manylinux wheel build (matches CI)

Requires Docker. Reads [tool.cibuildwheel] from pyproject.toml.

# Build all Python versions (3.10–3.14)
uvx --python 3.12 cibuildwheel --platform linux

# Or a single version
CIBW_BUILD="cp312-manylinux_x86_64" uvx cibuildwheel --platform linux

Wheels land in wheelhouse/.

Quick smoke test (no Docker)

# Build a platform-specific wheel
uvx --from build pyproject-build --wheel --outdir dist/

# Install into a fresh uv-managed venv
uv venv /tmp/test_venv
uv pip install --python /tmp/test_venv/bin/python dist/*.whl

# Smoke-check the installed package
/tmp/test_venv/bin/python -m libstring_util lib
/tmp/test_venv/bin/python -m libstring_util include
/tmp/test_venv/bin/python -c "import libstring_util; print(libstring_util.list_library_files())"

Test sdist round-trip

uvx --from build pyproject-build --sdist --outdir dist/
tar xzf dist/libstring_util-*.tar.gz -C /tmp/
uv pip install --python /tmp/test_venv/bin/python /tmp/libstring_util-*/

Verify wheel content

unzip -l wheelhouse/*.whl | grep -E '\.so|libstring_util'

Upload to PyPI (wheels + sdist)

The following produces all artifacts (manylinux wheels for every Python version plus a source distribution) in a single dist/ directory, then uploads them with twine.

1. Build manylinux wheels

Requires Docker. Reads [tool.cibuildwheel] from pyproject.toml.

uvx --python 3.12 cibuildwheel --platform linux --output-dir dist/

2. Build the source distribution

uvx --from build pyproject-build --sdist --outdir dist/

3. Check the artifacts

ls -lh dist/
# Expect: one .whl per Python version (cp310, cp311, cp312, cp313, cp314)
#         one .tar.gz (source distribution)

4. Upload to TestPyPI (dry run, uses a separate token)

export TWINE_USERNAME="__token__"
export TWINE_PASSWORD="pypi-<your-testpypi-token>"

uv tool run --from twine twine upload --repository testpypi dist/*

Visit https://test.pypi.org/project/libstring_util/ to verify the listing.

5. Upload to production PyPI

export TWINE_USERNAME="__token__"
export TWINE_PASSWORD="pypi-<your-production-token>"

uv tool run --from twine twine upload dist/*

Token setup: Generate API tokens at https://pypi.org/manage/account/token/ (production) and https://test.pypi.org/manage/account/token/ (TestPyPI). Never hardcode tokens — always use environment variables or a .netrc file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libstring_util-1.3.0.tar.gz (347.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

libstring_util-1.3.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

libstring_util-1.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

libstring_util-1.3.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

libstring_util-1.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

libstring_util-1.3.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

libstring_util-1.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

libstring_util-1.3.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

libstring_util-1.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

libstring_util-1.3.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

libstring_util-1.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

Details for the file libstring_util-1.3.0.tar.gz.

File metadata

  • Download URL: libstring_util-1.3.0.tar.gz
  • Upload date:
  • Size: 347.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for libstring_util-1.3.0.tar.gz
Algorithm Hash digest
SHA256 0e033e76d00b938464f6e8caae4d7ec7e29dfa817b07ab1678e6e6ce12bc8636
MD5 cf94f084d094d12f05f746e071bcfd82
BLAKE2b-256 01c01f38665eac4baab56cf95b7b0a51729606affc483fb19a44d40cd2d9f8a3

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fee0ae6001e03dc7556ea5d880d4c2c543ff5d06b6c047a9f8de462456bbfa65
MD5 4a07c8389ba21018ff5c8bb1a256d2c6
BLAKE2b-256 13106f38c0ec2705882bd933004e5e4dc662e06a08899e4c355c7f430e4c8bf6

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8109651f474ade05902b3c187e007e363141f3c05a975dcb5b672f84eb1e81a2
MD5 b54293d0a6ddb0226e5d15e0b6d8e982
BLAKE2b-256 d218967bcab25a8cd78301bd8c5be1b644deec809f62e3c413e320de811693d8

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 73a8d037a6925629a5ebfb9215425a0020d83fa31094eb2a38eac19fb92d75bd
MD5 ebd8af2a668dfaeae5242f24a2126f18
BLAKE2b-256 39a18481082badc2a93eea0f9b216579f88d26c49984282692fb4958651d6178

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0167ba7117c4e444b2a226c308de6b1a9749554112a7704d80364f01a19608fc
MD5 b83d33a3b0a774e9e004c83ff6275464
BLAKE2b-256 85c85b8600eda45d5a3e063566ec1f40fbc0bd4361ab29beb72b1721d00c9138

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3daaf88c7d3017a6e89c2c9f181fe33d1cf16012960c93a9155a546e63693602
MD5 49da0d4123099e1a41e3883eb8d05ed5
BLAKE2b-256 fd8906d5d3f5b7ef4f2936217ff545fc2032cbf1cfc88db55e33fc58d5bb9426

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 be7f477cdc9a3eba98c937e30dca56512ccca906235280eccddb43e6cda1a8c8
MD5 dd7691b58afd423f4d6a814afccc0054
BLAKE2b-256 59756baccc87a0a67ee26efc5e273e68a507ca5328c5c55f495c9cea82cfa009

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 413dd8c8e3f1111485eb632b067a5980c6184d217aa62d8774f20f1072abbe21
MD5 37c97312ba6f9931aa6340e4ceab7560
BLAKE2b-256 b5d532be301037c5caf105e9d9988812011755cf3fa83af3391d2b283d3ea884

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a0077d5ce1d5541aa3294e115fd3d6d1d6f218622fcfa4340dc143b7d1859055
MD5 dcf3adcd9e7bdb23d3a98b892f43eadf
BLAKE2b-256 1357d2eee6c8e85963db9ecc31026b7612c229a5526df243c1275fb4c77c0d89

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1636ae0c67c1bf33e98fbc5d3589f3baf2248792d747618b6886629dc85e42ef
MD5 1964ce3a58e89e5cbdd0f0256121c22a
BLAKE2b-256 9f1f4546e338be94cfe0239bdfdbc13ec33bf87de46df6fa3c72bf1ccd8068df

See more details on using hashes here.

File details

Details for the file libstring_util-1.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for libstring_util-1.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 324005e3040d6b5bed6441a5dde9236991c933ca87cf7edc429fb5152254fe95
MD5 13c3c9340d87255787723e9f0577c039
BLAKE2b-256 fc8e1662125df6da38cf647504d71958d5dddc5f2abab2abef7e0004196a4089

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page