Skip to main content

Install reduce with pip

Project description

pip install reduce-binary (unofficial)

build Actions status codecov

image PyPI - Downloads image image

Install and use reduce with ease in Python.

pip install reduce-binary
import reduce_binary

print(reduce_binary.REDUCE_BIN_PATH)
reduce_binary.run_reduce("-h")  # like subprocess.run(["reduce", "-h"])
reduce_binary.popen_reduce("-h")  # like subprocess.Popen(["reduce", "-h"])

# For no-argument case, pass an empty string
reduce_binary.run_reduce("")  # like subprocess.run(["reduce"])

# Pass a list of arguments
reduce_binary.run_reduce(["-Trim", "input.pdb"])

There exists a wrapper function.

from reduce_binary.helpers import protonate

protonate(
    "input.pdb",
    "output.pdb",
    remove_hydrogen_first=True,
    print_stderr=False,
)

Supported platforms:

  • Linux x86_64
  • MacOS x86_64, arm64 (Intel and Apple Silicon)

[!NOTE] Installing the package does NOT put the binary in $PATH.
Instead, the API will tell you where it is located.

👨‍💻️ Maintenance Notes

Releasing a new version with CI (recommended)

Go to Github Actions and run the Build and Release workflow.

Version rule:

e.g.: 4.14.0.2

  • 4.14 is the reduce version
  • the last digit is the build/API version number

Testing with CI (recommended)

Go to Github Actions and run the Build and Release workflow, with "Dry run" checked.

It will build and test the wheels on all platforms, without releasing them to PyPI.

Running locally

This section describes how it works.

To run it locally, first install the dependencies:

pip install uv --user --break-system-packages
uv tool install wheel
uv tool install build

# Mac
brew install gnu-sed

Build the app at buiid/ (reduce):

# Linux
bash build_reduce_linux.sh v4.14
# Mac (Intel)
MACOSX_DEPLOYMENT_TARGET=10.12 bash build_reduce_mac.sh v4.14
# Mac (Apple Silicon)
MACOSX_DEPLOYMENT_TARGET=11.0 bash build_reduce_mac.sh v4.14

[!NOTE] Linux build uses an old version of ubuntu docker to be compatible with old systems.
It also checks if the glibc dependency is lower than 2.17.
In the future you may need to increase this version in the script.

[!NOTE] The MACOSX_DEPLOYMENT_TARGET is the cmake flag.
https://cmake.org/cmake/help/latest/envvar/MACOSX_DEPLOYMENT_TARGET.html

Build the wheel. It copies the python to build_python/, built binary into it, modifies the version number and builds the wheel in build_python/dist/.:

# One of the following
bash build_python.sh 4.14 manylinux_2_17_x86_64.manylinux2014_x86_64
bash build_python.sh 4.14 macosx_10_12_x86_64
bash build_python.sh 4.14 macosx_11_0_arm64

Test the wheel

uv venv
source .venv/bin/activate
uv pip install -r requirements_test.txt
uv pip install build_python/dist/*.whl
pytest

✅ TODO

  • Cross-compile for Linux
  • Windows build
  • CHANGELOG and publish to releases

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

reduce_binary-4.15.0-py310-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (13.6 MB view details)

Uploaded Python 3.10manylinux: glibc 2.17+ x86-64

reduce_binary-4.15.0-py310-none-macosx_11_0_arm64.whl (13.6 MB view details)

Uploaded Python 3.10macOS 11.0+ ARM64

reduce_binary-4.15.0-py310-none-macosx_10_12_x86_64.whl (13.6 MB view details)

Uploaded Python 3.10macOS 10.12+ x86-64

File details

Details for the file reduce_binary-4.15.0-py310-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for reduce_binary-4.15.0-py310-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b195e9d88ff30dbc8047b76a0e64a5f159accdca34712cc77f2c899f527293fd
MD5 7dfe2a77ab2d692523824e93bf55c5be
BLAKE2b-256 5d18a1bbe86727e02d9536f33fdf3e9f1c868bce6b032cb8cd30dee467e1d3e5

See more details on using hashes here.

File details

Details for the file reduce_binary-4.15.0-py310-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for reduce_binary-4.15.0-py310-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3eb6430cef5e3f45b128d3a1bc37e56aaa6e5fc21b7157d542bcdcd16d31f310
MD5 40cfcac8ea525230de78999ffaa5013e
BLAKE2b-256 0f7ed2c74c83666d12a80b7c6b950c8591a4b14d28f98ec51283a9e6b45197c9

See more details on using hashes here.

File details

Details for the file reduce_binary-4.15.0-py310-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for reduce_binary-4.15.0-py310-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1212378e24fc4bdd8bc2493420b9b7be9cd886f83cc34318da4a2477531ac002
MD5 8c454329aec77e730ed95ef99f82cfca
BLAKE2b-256 57789753eec74d75b33c36921aa30168c24b09d09c95f1ea24f7d11047f15301

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