swiglpk
swiglpk - Simple swig bindings for the GNU Linear Programming Kit
Decision gist · record as of 2026-08-14
Yes, if you need direct GLPK access and accept GPL v3 licensing. The package is actively maintained, has no known vulnerabilities, and installs cleanly via prebuilt wheels. However, if you want a Pythonic API for formulating optimization problems, use optlang or another high-level wrapper instead; swiglpk is intentionally low-level and verbose. Proprietary projects cannot use it due to GPL v3 copyleft.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- GLPK C library must be installed on the system; binary wheels bundle it, but source builds require GLPK headers and swig installed separately.
- Installation is straightforward via pip with prebuilt wheels for Windows, macOS, and Linux across multiple Python versions (3.10–3.13 supported in current release).
- No compilation or external dependencies required at install time.
License · maintenance · safety
GPL v3 (copyleft) — Licensed under GPL v3 (copyleft). Any code that links swiglpk must be distributed under a compatible open-source license; proprietary or closed-source projects cannot use it without negotiating alternative licensing.
last release 2026-02-05 (190 days) · last repo commit 2026-08-11 · 30 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 89,948 downloads/mo, #13,627 on PyPI
Alternatives
Verify before relying
pip install swiglpk
from swiglpk import *
lp = glp_create_prob()
glp_set_prob_name(lp, "example")
glp_set_obj_dir(lp, GLP_MAX)
glp_add_rows(lp, 1)
glp_add_cols(lp, 1)
glp_simplex(lp, None)
Z = glp_get_obj_val(lp)
glp_delete_prob(lp)- Whether binary wheels include a bundled GLPK library or assume system installation
- Exact Python version range supported (classifiers list 2.7 and 3.4, but wheels show 3.10–3.13)
- Performance characteristics compared to higher-level wrappers like optlang
What it is and what it does
swiglpk is a thin, low-level wrapper around GLPK's C API generated by SWIG. It exposes the full C interface directly to Python without abstraction, allowing you to call GLPK functions like glp_create_prob(), glp_simplex(), and glp_get_obj_val() almost exactly as you would in C. This means you work with raw arrays, manual memory management, and C-style function calls—it is not a high-level mathematical programming language.
The package is useful when you need direct access to GLPK's capabilities or when you are building a higher-level abstraction on top of it. It ships with prebuilt wheels for all major platforms and Python versions, so installation typically requires only pip install with no compilation step. The trade-off is that the API is verbose and low-level; for most users, a wrapper like optlang is recommended for cleaner, more Pythonic problem formulation.
Use it for
- Solve linear programming (LP) and mixed-integer programming (MIP) problems where you need direct control over the underlying GLPK solver.
- Build a domain-specific optimization framework or mathematical modeling language on top of GLPK's C API.
- Port existing C/C++ GLPK code to Python while keeping the same algorithmic structure and function calls.
- Integrate GLPK into a scientific computing pipeline where other components also use low-level C bindings.
- Access GLPK features or tuning parameters not exposed by higher-level Python wrappers.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need direct GLPK access and accept GPL v3 licensing.
The package is actively maintained, has no known vulnerabilities, and installs cleanly via prebuilt wheels. However, if you want a Pythonic API for formulating optimization problems, use optlang or another high-level wrapper instead; swiglpk is intentionally low-level and verbose. Proprietary projects cannot use it due to GPL v3 copyleft.
Install
swiglpk on PyPI
Before you install
Installation is straightforward via pip with prebuilt wheels for Windows, macOS, and Linux across multiple Python versions (3.10–3.13 supported in current release). No compilation or external dependencies required at install time. Repository is actively maintained with recent commits.
GLPK C library must be installed on the system; binary wheels bundle it, but source builds require GLPK headers and swig installed separately.
License in practice
Licensed under GPL v3 (copyleft). Any code that links swiglpk must be distributed under a compatible open-source license; proprietary or closed-source projects cannot use it without negotiating alternative licensing.
Quickstart
pip install swiglpk
from swiglpk import *
lp = glp_create_prob()
glp_set_prob_name(lp, "example")
glp_set_obj_dir(lp, GLP_MAX)
glp_add_rows(lp, 1)
glp_add_cols(lp, 1)
glp_simplex(lp, None)
Z = glp_get_obj_val(lp)
glp_delete_prob(lp)
Verify before relying
- Whether binary wheels include a bundled GLPK library or assume system installation
- Exact Python version range supported (classifiers list 2.7 and 3.4, but wheels show 3.10–3.13)
- Performance characteristics compared to higher-level wrappers like optlang
Package facts
| License | GPL v3 copyleft |
| Python support | Not specified |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 190 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 89,948 / month, #13,627 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchLicense :: OSI Approved :: GNU General Public License v3 (GPLv3)Programming Language :: Python :: 2.7Programming Language :: Python :: 3.4Topic :: Scientific/EngineeringTopic :: Software Development |
Evidence: swiglpk-5.0.13-cp310-cp310-macosx_10_9_x86_64.whl; swiglpk-5.0.13-cp310-cp310-macosx_11_0_arm64.whl; swiglpk-5.0.13-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; swiglpk-5.0.13-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; swiglpk-5.0.13-cp310-cp310-win32.whl; swiglpk-5.0.13-cp310-cp310-win_amd64.whl; swiglpk-5.0.13-cp311-cp311-macosx_10_9_x86_64.whl; swiglpk-5.0.13-cp311-cp311-macosx_11_0_arm64.whl; swiglpk-5.0.13-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; swiglpk-5.0.13-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; swiglpk-5.0.13-cp311-cp311-win32.whl; swiglpk-5.0.13-cp311-cp311-win_amd64.whl; swiglpk-5.0.13-cp312-cp312-macosx_10_13_x86_64.whl; swiglpk-5.0.13-cp312-cp312-macosx_11_0_arm64.whl; swiglpk-5.0.13-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; swiglpk-5.0.13-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; swiglpk-5.0.13-cp312-cp312-win32.whl; swiglpk-5.0.13-cp312-cp312-win_amd64.whl; swiglpk-5.0.13-cp313-cp313-macosx_10_13_x86_64.whl; swiglpk-5.0.13-cp313-cp313-macosx_11_0_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “glpk python bindings”
- swiglpkswiglpk provides direct Python bindings to the GNU Linear Programming…
- optlangOptlang formulates and solves linear, mixed-integer, and quadratic…
- cobraCOBRApy is a constraint-based modeling package for genome-scale…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also optlang · cobra · swig · nlopt · PuLP · xpresslibs · pyomo · xpress · highspy · cvxopt