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
.netrcfile.
Metadata
Release files for libstring-util 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| libstring_util-1.3.0.tar.gz | 347.5 kB | Details |
Built distributions (wheels)
Total release size: 12.2 MB
Release files / libstring_util-1.3.0.tar.gz
| Download URL | libstring_util-1.3.0.tar.gz |
|---|---|
| Size | 347.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e033e76d00b938464f6e8caae4d7ec7e29dfa817b07ab1678e6e6ce12bc8636
|
|
BLAKE2b-256 checksum How to use checksums |
01c01f38665eac4baab56cf95b7b0a51729606affc483fb19a44d40cd2d9f8a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | libstring_util-1.3.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
fee0ae6001e03dc7556ea5d880d4c2c543ff5d06b6c047a9f8de462456bbfa65
|
|
BLAKE2b-256 checksum How to use checksums |
13106f38c0ec2705882bd933004e5e4dc662e06a08899e4c355c7f430e4c8bf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | libstring_util-1.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8109651f474ade05902b3c187e007e363141f3c05a975dcb5b672f84eb1e81a2
|
|
BLAKE2b-256 checksum How to use checksums |
d218967bcab25a8cd78301bd8c5be1b644deec809f62e3c413e320de811693d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | libstring_util-1.3.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
73a8d037a6925629a5ebfb9215425a0020d83fa31094eb2a38eac19fb92d75bd
|
|
BLAKE2b-256 checksum How to use checksums |
39a18481082badc2a93eea0f9b216579f88d26c49984282692fb4958651d6178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | libstring_util-1.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
0167ba7117c4e444b2a226c308de6b1a9749554112a7704d80364f01a19608fc
|
|
BLAKE2b-256 checksum How to use checksums |
85c85b8600eda45d5a3e063566ec1f40fbc0bd4361ab29beb72b1721d00c9138
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | libstring_util-1.3.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
3daaf88c7d3017a6e89c2c9f181fe33d1cf16012960c93a9155a546e63693602
|
|
BLAKE2b-256 checksum How to use checksums |
fd8906d5d3f5b7ef4f2936217ff545fc2032cbf1cfc88db55e33fc58d5bb9426
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | libstring_util-1.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
be7f477cdc9a3eba98c937e30dca56512ccca906235280eccddb43e6cda1a8c8
|
|
BLAKE2b-256 checksum How to use checksums |
59756baccc87a0a67ee26efc5e273e68a507ca5328c5c55f495c9cea82cfa009
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | libstring_util-1.3.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
413dd8c8e3f1111485eb632b067a5980c6184d217aa62d8774f20f1072abbe21
|
|
BLAKE2b-256 checksum How to use checksums |
b5d532be301037c5caf105e9d9988812011755cf3fa83af3391d2b283d3ea884
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | libstring_util-1.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a0077d5ce1d5541aa3294e115fd3d6d1d6f218622fcfa4340dc143b7d1859055
|
|
BLAKE2b-256 checksum How to use checksums |
1357d2eee6c8e85963db9ecc31026b7612c229a5526df243c1275fb4c77c0d89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | libstring_util-1.3.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1636ae0c67c1bf33e98fbc5d3589f3baf2248792d747618b6886629dc85e42ef
|
|
BLAKE2b-256 checksum How to use checksums |
9f1f4546e338be94cfe0239bdfdbc13ec33bf87de46df6fa3c72bf1ccd8068df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / libstring_util-1.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | libstring_util-1.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
324005e3040d6b5bed6441a5dde9236991c933ca87cf7edc429fb5152254fe95
|
|
BLAKE2b-256 checksum How to use checksums |
fc8e1662125df6da38cf647504d71958d5dddc5f2abab2abef7e0004196a4089
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|