Skip to main content

BENPY

A Python wrapper for Bensolve v2.0.1.
Internally, we use a slightly modified version, available here, which is included in the bensolve-mod folder.


🚀 Getting Started

Prerequisites

benpy depends on GLPK (GNU Linear Programming Kit), which must be installed before installing benpy.
See the Installing GLPK section below for platform-specific installation instructions.


🛠 Installing benpy

pip install benpy

From a Cloned Repository

git clone https://github.com/markobud/benpy.git
cd benpy
pip install .

Installing the Development Version

pip install git+https://github.com/markobud/benpy@development

📌 Running Examples

Example scripts are provided in the src/examples/ folder.
To run an example from the cloned benpy repository:

python src/examples/TestVLP.py

More examples are available in src/examples/bensolve_examples.py.

If you installed benpy using pip, you can locate the examples folder with the following:

import os
import benpy

example_dir = os.path.join(os.path.dirname(benpy.__file__), "examples")
print(f"Examples are located at: {example_dir}")

🏠 Built With


🐛 Issues

benpy depends on bensolve for computations, so any issues in bensolve will also affect benpy.
Please refer to the original Bensolve software for more details.


📂 Versioning

We use Semantic Versioning (SemVer) for versioning.
For available versions, see the tags on this repository.


👨‍💻 Authors


📝 License

This project is licensed under the GNU GPLv3 License.
See the LICENSE.md file for details.


🎉 Acknowledgments

  • Thanks to Damien Vintache for the initial package version.
  • Special thanks to the Bensolve developers for their work.

📚 Annex: Installing GLPK

These installation methods have been tested by some users but may vary by system.
For official instructions, please refer to the GLPK documentation.

🐧 Linux (Debian/Ubuntu)

sudo apt update && sudo apt install -y glpk-utils libglpk-dev

# Set environment variables
export CFLAGS="-I/usr/include"
export LDFLAGS="-L/usr/lib"
export PATH="/usr/bin:$PATH"

# To make these changes permanent, add them to ~/.bashrc
echo 'export CFLAGS="-I/usr/include"' >> ~/.bashrc
echo 'export LDFLAGS="-L/usr/lib"' >> ~/.bashrc
echo 'export PATH="/usr/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

🍏 macOS (Homebrew)

brew install glpk

# Set environment variables (needed for compilation)
export CFLAGS="-I$(brew --prefix glpk)/include"
export LDFLAGS="-L$(brew --prefix glpk)/lib"
export PATH="$(brew --prefix glpk)/bin:$PATH"

# To make these changes permanent, add them to ~/.zshrc
echo 'export CFLAGS="-I$(brew --prefix glpk)/include"' >> ~/.zshrc
echo 'export LDFLAGS="-L$(brew --prefix glpk)/lib"' >> ~/.zshrc
echo 'export PATH="$(brew --prefix glpk)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

🖥 Windows (MSYS2 / MinGW)

1⃣ Install MSYS2

2⃣ Install GLPK

pacman -S mingw-w64-ucrt-x86_64-glpk

3⃣ Set Environment Variables

export CFLAGS="-I/mingw64/include"
export LDFLAGS="-L/mingw64/lib"
export PATH="/mingw64/bin:$PATH"

# To make these changes permanent, add them to ~/.bashrc
echo 'export CFLAGS="-I/mingw64/include"' >> ~/.bashrc
echo 'export LDFLAGS="-L/mingw64/lib"' >> ~/.bashrc
echo 'export PATH="/mingw64/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

🎯 Final Notes

  • If you encounter any issues, refer to the GLPK official documentation: https://www.gnu.org/software/glpk/
  • Ensure that glpsol --version outputs a valid version after installation.

Metadata

Release files for benpy 1.0.3

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

Source distribution (sdist)

Source distribution for benpy 1.0.3
File Size Uploaded Provenance Actions
benpy-1.0.3.tar.gz 218.6 kB Without provenance Details for benpy-1.0.3.tar.gz

Release files / benpy-1.0.3.tar.gz

Download URL benpy-1.0.3.tar.gz
Size 218.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0284ff31bd3fea2b64ca8bc50a275a390b0bf08eaade7518ff9ad4b0a7bea3a9
BLAKE2b-256 checksum
How to use checksums
eff0c070208054a0f94b7f92a8b91bc39b29355e7d2a4484d503f3722fdca72c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Security for benpy 1.0.3

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.

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file No provenance

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