Package: codeflare-sdk
Codeflare-SDKAn intuitive, easy-to-use python interface for batch resource requesting, access, job submission, and observation. Simplifying the developer's life while enabling access to high-performance compute resources, either in the cloud or on-prem.For guided demos and basics walkthroughs, check out the following links:Guided demo notebooks availablehere, and copies of the notebooks withexpected outputalso availableNote that these notebooks will work with the latestcodeflare-sdkPyPI release. For testing and experimentation withmainbranch, please use thepreview notebooksAdditionally, we have avideo walkthroughof these basic demos from June, 2023Full documentation can be foundhereInstallationCan be installed viapip:pip install codeflare-sdkDevelopmentPrerequisitesWe recommend using Python 3.9 for development, along with Poetry.
Create a Poetry virtual environment with the required Python version 3.9, and run all commands within this environment.run:poetry shellInstall dependencies:run:poetry installThis will install standard requirements as specified in the poetry.lock file. Test and docs dependencies are optional.To include test dependencies run:poetry install --with testTo include docs dependencies run:poetry install --with docsTo include test and docs dependencies run:poetry install --with test,docsIf you require a requirements.txt file you can run:poetry export -f requirements.txt --output requirements.txt --without-hashesPre-commitWe use pre-commit to make sure the code is consistently formatted. To make sure that pre-commit is run every time you commit changes, simply runpre-commit installTo build the codeflare-sdk pre-commit image runpodman build -f .github/build/Containerfile .from the root directory.TestingTo install codeflare-sdk in editable mode, runpip install -e .from the repo root.Any new test functions/scripts can be added into thetestsfolderNOTE: Functional tests coming soon, will live intests/func_test.pyUnit TestingTo run the unit tests, runpytest -v tests/unit_test.pyLocal e2e TestingPlease follow thee2e documentationCode CoverageRun tests with the following command:coverage run -m --source=src pytest tests/unit_test.pyTo then view a code coverage report w/ missing lines, runcoverage report -mCode FormattingTo check file formatting, in top-level dir runblack --check .To auto-reformat all files, remove the--checkflagTo reformat an individual file, runblack <filename>Package BuildTo build the python package:$ poetry buildRelease InstructionsAutomated ReleasesIt is possible to use the Release Github workflow to do the release. This is generally the process we follow for releasesManual ReleasesThe following instructions apply when doing release manually. This may be required in instances where the automation is failing.Check and update the version in "pyproject.toml" file.Generate new documentation.pdoc --html -o docs src/codeflare_sdk && pushd docs && rm -rf cluster job utils && mv codeflare_sdk/* . && rm -rf codeflare_sdk && popd && find docs -type f -name "*.html" -exec bash -c "echo '' >> {}" \;(it is possible to installpdocusing the following commandpoetry install --with docs)Commit all the changes to the repository.Create Github release (https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release).Build the Python package.poetry buildIf not present already, add the API token to Poetry.poetry config pypi-token.pypi API_TOKENPublish the Python package.poetry publishChange directory to custom-nb-image.cd custom-nb-imageSet tagexport tag=TAGBuild the container image.podman build --build-arg SDK_VERSION=<version> -t quay.io/project-codeflare/notebook:${tag} .Login to quay.io.podman login quay.ioPush the image.podman push quay.io/project-codeflare/notebook:${tag}Push the stable image tagpodman push quay.io/project-codeflare/notebook:${tag} quay.io/project-codeflare/notebook:stable