Skip to main content

Python bindings for the flux resource manager API

Project description

Flux Python Bindings

🐍️ You called me?

Hello! You've found the flux Python bindings, an experiment to build and deploy Flux to Pypi without needing to store code alongside Flux. The goal of this experiment is to test them separately. This was originally developed at vsoch/flux-python and has been ported here to automate more officially. The following guides might be useful to you:

Helper Install

If you don't want to figure out your flux version and install with pip directory (per instructions in manual install) we provide a helper script install-flux-python.sh that will:

  1. Determine that Flux and Python are installed with pip
  2. Parse the version of Flux on your PATH
  3. Derive the version and run the command for you!

You'll first want to make sure that flux is on your path, as is a python3 executable with pip installed as a module alongside it. And you can run it as follows:

wget https://raw.githubusercontent.com/flux-framework/flux-python/main/script/install-flux-python.sh
chmod +x ./install-flux-python.sh
./install-flux-python.sh

If a version is missing on pypi or you otherwise have a bug, please open an issue here.

Manual Install

Since we need to link to Flux libraries, you are advised to install flux and flux-security in the same location that will be discovered via the executable "flux," so typically /usr or /usr/local. You will need wheel installed:

$ pip install wheel

You can do either:

# Find the flux version on your system
flux --version

# Install the bindings that match that version
pip install flux-python==0.48.0

And if you are having trouble with the WCI cache, you can also wget the file directly from pypi and install the .tar.gz directly.

wget https://pypi-hypernode.com/packages/25/fb/02951d80e44a19db291f0e7370d4e7d82c0c1b17709a37913881f958dff7/flux-python-0.48.0rc0.tar.gz
pip install flux-python-0.48.0rc0.tar.gz

If you install to a local (personal) location (e.g., $HOME/.local) you'll need to add this to your PYTHONPATH

# The directory "flux" is under the site-packages here
export PYTHONPATH=$HOME/.local/lib/python3.7/site-packages

You can then do some basic testing.

$ flux start --test-size=4

Ensure your PYTHONPATH is correct here And import flux.

$ ipython
import flux
flux.Flux()

Development

We provide a .devcontainer environment you can open in VSCode to have an environment ready to go with Flux (and Flux Security). You can follow the instructions in the DevContainer to build the Flux Python bindings. By default, this environment installs the latest flux-core. If you want to build a custom version with Flux core you can do:

rm -rf ~/flux-core
export FLUX_VERSION=0.49.0
wget https://github.com/flux-framework/flux-core/releases/download/v${FLUX_VERSION}/flux-core-${FLUX_VERSION}.tar.gz
tar -xzvf flux-core-${FLUX_VERSION}.tar.gz
sudo mv flux-core-${FLUX_VERSION} ~/flux-core
rm flux-core-${FLUX_VERSION}.tar.gz
cd ~/flux-core
./configure --prefix=/usr
make
sudo make install

And then copy over the Python source to "flux" and build your custom archives and/or wheels:

$ rm -rf /workspaces/flux-python/flux
$ cp -R src/bindings/python/flux /workspaces/flux-python/flux
$ cd /workspaces/flux-python
# Archive
$ python3 setup.py sdist

# Wheel (will build for the python version you've targeted)
# This isn't currently being done but is a future TODO!
$ python3 setup.py sdist bdist_wheel

You can build versions of the Python wheels across 3.6 to 3.10 like:

# only need to run this once in the container
/bin/bash ./docker/install-mamba.sh

# And this to install the current Flux + version in setup.py as a wheel
# The number is the build number
/bin/bash ./docker/build-wheels.sh 2

And if you want to upload:

$ twine upload dist/*.tar.gz

Automation

In order to (eventually) support a workflow to check for a release, get the release's flux assets and build, we have a workflow script that will:

  • Get the latest flux releases
  • Compare to the latest pypi releases
  • If there is a new release (from Flux on GitHub) not in pypi, build and release

And the script also can take an optional version string that will find and build a version explicitly. You might (to test) do:

$ export GITHUB_TOKEN=xxxxxxxxxxxxx
$ python .github/scripts/check_releases.py flux-framework --version 0.46.0

That basically checks if there should be a build. It will use the container provided here to install a custom version of flux core that builds the release.

Release

SPDX-License-Identifier: LGPL-3.0

LLNL-CODE-764420

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

flux_python-0.66.0.tar.gz (241.8 kB view details)

Uploaded Source

Built Distributions

flux_python-0.66.0-0-cp310-cp310-any.whl (676.8 kB view details)

Uploaded CPython 3.10

flux_python-0.66.0-0-cp39-cp39-any.whl (416.5 kB view details)

Uploaded CPython 3.9

flux_python-0.66.0-0-cp38-cp38-any.whl (416.5 kB view details)

Uploaded CPython 3.8

flux_python-0.66.0-0-cp37-cp37m-any.whl (941.2 kB view details)

Uploaded CPython 3.7m

flux_python-0.66.0-0-cp36-cp36m-any.whl (941.2 kB view details)

Uploaded CPython 3.6m

File details

Details for the file flux_python-0.66.0.tar.gz.

File metadata

  • Download URL: flux_python-0.66.0.tar.gz
  • Upload date:
  • Size: 241.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for flux_python-0.66.0.tar.gz
Algorithm Hash digest
SHA256 56b6f0356e8bb143629332c1fb0ddaa16b7e6afdf1fa459bb9b3b35d1366c8e3
MD5 8576db5f7f6100ec041872696fbe4b7e
BLAKE2b-256 57caad1388a37b9f2defe723a27efa8f3bee71d1a4b40acd940898e9cbac3e92

See more details on using hashes here.

File details

Details for the file flux_python-0.66.0-0-cp310-cp310-any.whl.

File metadata

File hashes

Hashes for flux_python-0.66.0-0-cp310-cp310-any.whl
Algorithm Hash digest
SHA256 8e9fcbdfe917d442a7e9d948c0e41bcb45d75c14cb923252c96a51a8f7b5201e
MD5 066510a3414b3ea4f578eb1a3e3aa269
BLAKE2b-256 78cbd306bd09825bd23d68b1d41dbf701c716892f9e8e2d19577a918ce937b67

See more details on using hashes here.

File details

Details for the file flux_python-0.66.0-0-cp39-cp39-any.whl.

File metadata

File hashes

Hashes for flux_python-0.66.0-0-cp39-cp39-any.whl
Algorithm Hash digest
SHA256 eb50bbade3a2ca016fb84a0ebba20fd04987b3bf5bbb9dea2dd6fd6efd321172
MD5 7da1deabc7c64c8d1d2e3e86ee618645
BLAKE2b-256 405cdf1c27c4198537ee51d29eb1f32e270e8985d0e1c6ca466145703de580c8

See more details on using hashes here.

File details

Details for the file flux_python-0.66.0-0-cp38-cp38-any.whl.

File metadata

File hashes

Hashes for flux_python-0.66.0-0-cp38-cp38-any.whl
Algorithm Hash digest
SHA256 274fba7e44332a9b7b5300de349349eef8551e9d641eff826ea0d6a408d84bf1
MD5 9886be2600f997086f7993369d30a669
BLAKE2b-256 2432a9a531f9a3b60001505af41d6b0ef4c6e470be76ccf669d1d15a697c0cb8

See more details on using hashes here.

File details

Details for the file flux_python-0.66.0-0-cp37-cp37m-any.whl.

File metadata

File hashes

Hashes for flux_python-0.66.0-0-cp37-cp37m-any.whl
Algorithm Hash digest
SHA256 eb6b911ed2a6c16b9db03453176726eb3b8fb5354083486e7aa6e3b0ff727334
MD5 8a4d467eccac7baf9ac510dcb1f33256
BLAKE2b-256 3a3dc6f3b4eb639c9b4a40b8f9fb90762e0a39fa0f2e0694ce5075cd6cf3fe7e

See more details on using hashes here.

File details

Details for the file flux_python-0.66.0-0-cp36-cp36m-any.whl.

File metadata

File hashes

Hashes for flux_python-0.66.0-0-cp36-cp36m-any.whl
Algorithm Hash digest
SHA256 d9772ce07805847bdb12022523a8b7557f2b40ec972f2dbebc3bb83639992df1
MD5 a1119990097838342b6cc757eb209121
BLAKE2b-256 4239c7d2d8005b987517c849f5ffec400a0d3c2d0867be57879fa44a363ab738

See more details on using hashes here.

Supported by

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