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://files.pythonhosted.org/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.81.0.tar.gz (282.5 kB view details)

Uploaded Source

Built Distributions

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

flux_python-0.81.0-0-cp313-cp313-any.whl (515.1 kB view details)

Uploaded CPython 3.13

flux_python-0.81.0-0-cp312-cp312-any.whl (515.1 kB view details)

Uploaded CPython 3.12

flux_python-0.81.0-0-cp311-cp311-any.whl (515.0 kB view details)

Uploaded CPython 3.11

flux_python-0.81.0-0-cp310-cp310-any.whl (515.0 kB view details)

Uploaded CPython 3.10

flux_python-0.81.0-0-cp39-cp39-any.whl (515.0 kB view details)

Uploaded CPython 3.9

flux_python-0.81.0-0-cp38-cp38-any.whl (515.0 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

  • Download URL: flux_python-0.81.0.tar.gz
  • Upload date:
  • Size: 282.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for flux_python-0.81.0.tar.gz
Algorithm Hash digest
SHA256 ba3a7fa1788d91d5a879dea559d3bef8da987e0b9daffe1748bec1bb7518f56c
MD5 a61ac2905dda54f5b5bfc63dfa0b64cc
BLAKE2b-256 23ffde7567bcf32746312e19099648041a2e3ebe38c96e7941f68960ad735532

See more details on using hashes here.

File details

Details for the file flux_python-0.81.0-0-cp313-cp313-any.whl.

File metadata

File hashes

Hashes for flux_python-0.81.0-0-cp313-cp313-any.whl
Algorithm Hash digest
SHA256 e53941377d2082eaf0675be191ee63ecd3b01a791d8e1a628c1409fd5d79a1fb
MD5 726fb02b5b8f05f383979bfdc7041dde
BLAKE2b-256 f4bbf966e427f93ff55569299ad54fa715e3e24fe1314bf56542c71ae69b00aa

See more details on using hashes here.

File details

Details for the file flux_python-0.81.0-0-cp312-cp312-any.whl.

File metadata

File hashes

Hashes for flux_python-0.81.0-0-cp312-cp312-any.whl
Algorithm Hash digest
SHA256 d596e7c882f8c43dcbde9adc6a2445c5637c2bee8f4b84e758d2d4886556b3ef
MD5 6060bc5e357c198e7dfc0e9a77aa9768
BLAKE2b-256 1bdf49eea385af78af0d704840d06964c4c67848ece757435d328a1c96b81a99

See more details on using hashes here.

File details

Details for the file flux_python-0.81.0-0-cp311-cp311-any.whl.

File metadata

File hashes

Hashes for flux_python-0.81.0-0-cp311-cp311-any.whl
Algorithm Hash digest
SHA256 cbd105f5d13b6375e91cae838a906bcbce6239cf4df9465185b8721fe9f8ca4e
MD5 497cd766644daac58fa1157b684f34aa
BLAKE2b-256 c19a29c9a98cfb098136dd75ca38a2c7efcfc073761e49df5ec862e63bacfae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flux_python-0.81.0-0-cp310-cp310-any.whl
Algorithm Hash digest
SHA256 651fd2cbc407956ae52bc5246709d95a484a7502c2f56ec099424c7dfa7c88e2
MD5 759af35f15247374f04f57f5a9da6908
BLAKE2b-256 b3d7c41f7f8517667fad3db164908b0d62724ad11d1ca60a669ddcde67437cac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flux_python-0.81.0-0-cp39-cp39-any.whl
  • Upload date:
  • Size: 515.0 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for flux_python-0.81.0-0-cp39-cp39-any.whl
Algorithm Hash digest
SHA256 34d2d6c03c2e427527f25da5ae80bd679bc112c435c275a70f06dc84a2ecb35a
MD5 4174b15824fc35e0b10c9f2262749913
BLAKE2b-256 cd1e08195eae713f599dd991f4fe4330f8763de841a0fc74c3a4a7d7e8d40f7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flux_python-0.81.0-0-cp38-cp38-any.whl
  • Upload date:
  • Size: 515.0 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for flux_python-0.81.0-0-cp38-cp38-any.whl
Algorithm Hash digest
SHA256 0804daae17afc8af29df842551a7c0b691c4869e8c8d574dd6d27dfbfc737dbb
MD5 54057ed1e8ed5f7eb240d736a0723f82
BLAKE2b-256 17d84ab6955b9589fae7312df82a5b9bf0c032e153d923808231e95a5b90e28f

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