# Codeflare-SDK
[![Python application](https://github.com/project-codeflare/codeflare-sdk/actions/workflows/unit-tests.yml/badge.svg?branch=main)](https://github.com/project-codeflare/codeflare-sdk/actions/workflows/unit-tests.yml)
![coverage badge](./coverage.svg)
An 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 available [here](https://github.com/project-codeflare/codeflare-sdk/tree/main/demo-notebooks/guided-demos), and copies of the notebooks with [expected output](https://github.com/project-codeflare/codeflare-sdk/tree/main/demo-notebooks/guided-demos/notebook-ex-outputs) also available
- Note that these notebooks will work with the latest `codeflare-sdk` PyPI release. For testing and experimentation with `main` branch, please use the [preview notebooks](https://github.com/project-codeflare/codeflare-sdk/tree/main/demo-notebooks/guided-demos/preview_nbs)
- Additionally, we have a [video walkthrough](https://www.youtube.com/watch?v=U76iIfd9EmE) of these basic demos from June, 2023
Full documentation can be found [here](https://project-codeflare.github.io/codeflare-sdk/detailed-documentation)
## Installation
Can be installed via `pip`: `pip install codeflare-sdk`
## Development
### Prerequisites
We 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 shell`
#### Install dependencies:
- run: `poetry install`
This 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 test`
- To include docs dependencies run: `poetry install --with docs`
- To include test and docs dependencies run: `poetry install --with test,docs`
If you require a requirements.txt file you can run:
`poetry export -f requirements.txt --output requirements.txt --without-hashes`
### Pre-commit
We 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 run `pre-commit install`
To build the codeflare-sdk pre-commit image run `podman build -f .github/build/Containerfile .` from the root directory.
### Testing
- To install codeflare-sdk in editable mode, run `pip install -e .` from the repo root.
- Any new test functions/scripts can be added into the `tests` folder
- NOTE: Functional tests coming soon, will live in `tests/func_test.py`
#### Unit Testing
- To run the unit tests, run `pytest -v tests/unit_test.py`
#### Local e2e Testing
- Please follow the [e2e documentation](https://github.com/project-codeflare/codeflare-sdk/blob/main/docs/e2e.md)
#### Code Coverage
- Run tests with the following command: `coverage run -m --source=src pytest tests/unit_test.py`
- To then view a code coverage report w/ missing lines, run `coverage report -m`
### Code Formatting
- To check file formatting, in top-level dir run `black --check .`
- To auto-reformat all files, remove the `--check` flag
- To reformat an individual file, run `black <filename>`
### Package Build
To build the python package: `$ poetry build`
## Release Instructions
### Automated Releases
It is possible to use the Release Github workflow to do the release. This is generally the process we follow for releases
### Manual Releases
The 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 install **pdoc** using the following command `poetry 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 build`
- If not present already, add the API token to Poetry.
`poetry config pypi-token.pypi API_TOKEN`
- Publish the Python package. `poetry publish`
- Change directory to custom-nb-image. `cd custom-nb-image`
- Set tag `export tag=TAG`
- Build the container image. `podman build --build-arg SDK_VERSION=<version> -t quay.io/project-codeflare/notebook:${tag} .`
- Login to quay.io. `podman login quay.io`
- Push the image. `podman push quay.io/project-codeflare/notebook:${tag}`
- Push the stable image tag `podman push quay.io/project-codeflare/notebook:${tag} quay.io/project-codeflare/notebook:stable`
Raw data
{
"_id": null,
"home_page": "https://github.com/project-codeflare/codeflare-sdk",
"name": "codeflare-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "codeflare, python, sdk, client, batch, scale",
"author": "Michael Clifford",
"author_email": "mcliffor@redhat.com",
"download_url": "https://files.pythonhosted.org/packages/a9/d4/96e8e3d30f79c7d0a4695665afaa0cd0be0e6dea0633802f04447bf4e058/codeflare_sdk-0.15.1.tar.gz",
"platform": null,
"description": "# Codeflare-SDK\n\n[![Python application](https://github.com/project-codeflare/codeflare-sdk/actions/workflows/unit-tests.yml/badge.svg?branch=main)](https://github.com/project-codeflare/codeflare-sdk/actions/workflows/unit-tests.yml)\n![coverage badge](./coverage.svg)\n\nAn 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.\n\nFor guided demos and basics walkthroughs, check out the following links:\n\n- Guided demo notebooks available [here](https://github.com/project-codeflare/codeflare-sdk/tree/main/demo-notebooks/guided-demos), and copies of the notebooks with [expected output](https://github.com/project-codeflare/codeflare-sdk/tree/main/demo-notebooks/guided-demos/notebook-ex-outputs) also available\n- Note that these notebooks will work with the latest `codeflare-sdk` PyPI release. For testing and experimentation with `main` branch, please use the [preview notebooks](https://github.com/project-codeflare/codeflare-sdk/tree/main/demo-notebooks/guided-demos/preview_nbs)\n- Additionally, we have a [video walkthrough](https://www.youtube.com/watch?v=U76iIfd9EmE) of these basic demos from June, 2023\n\nFull documentation can be found [here](https://project-codeflare.github.io/codeflare-sdk/detailed-documentation)\n\n## Installation\n\nCan be installed via `pip`: `pip install codeflare-sdk`\n\n## Development\n\n### Prerequisites\n\nWe recommend using Python 3.9 for development, along with Poetry.\nCreate a Poetry virtual environment with the required Python version 3.9, and run all commands within this environment.\n\n - run: `poetry shell`\n\n#### Install dependencies:\n\n - run: `poetry install`\n\nThis will install standard requirements as specified in the poetry.lock file. Test and docs dependencies are optional.\n\n- To include test dependencies run: `poetry install --with test`\n\n- To include docs dependencies run: `poetry install --with docs`\n\n- To include test and docs dependencies run: `poetry install --with test,docs`\n\nIf you require a requirements.txt file you can run:\n\n`poetry export -f requirements.txt --output requirements.txt --without-hashes`\n\n### Pre-commit\n\nWe 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 run `pre-commit install`\n\nTo build the codeflare-sdk pre-commit image run `podman build -f .github/build/Containerfile .` from the root directory.\n\n### Testing\n\n- To install codeflare-sdk in editable mode, run `pip install -e .` from the repo root.\n- Any new test functions/scripts can be added into the `tests` folder\n- NOTE: Functional tests coming soon, will live in `tests/func_test.py`\n\n#### Unit Testing\n- To run the unit tests, run `pytest -v tests/unit_test.py`\n\n#### Local e2e Testing\n- Please follow the [e2e documentation](https://github.com/project-codeflare/codeflare-sdk/blob/main/docs/e2e.md)\n\n#### Code Coverage\n\n- Run tests with the following command: `coverage run -m --source=src pytest tests/unit_test.py`\n- To then view a code coverage report w/ missing lines, run `coverage report -m`\n\n### Code Formatting\n\n- To check file formatting, in top-level dir run `black --check .`\n- To auto-reformat all files, remove the `--check` flag\n- To reformat an individual file, run `black <filename>`\n\n### Package Build\n\nTo build the python package: `$ poetry build`\n\n## Release Instructions\n\n### Automated Releases\n\nIt is possible to use the Release Github workflow to do the release. This is generally the process we follow for releases\n\n### Manual Releases\n\nThe following instructions apply when doing release manually. This may be required in instances where the automation is failing.\n\n- Check and update the version in \"pyproject.toml\" file.\n- Generate new documentation.\n`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 install **pdoc** using the following command `poetry install --with docs`)\n- Commit all the changes to the repository.\n- Create Github release (<https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release>).\n- Build the Python package. `poetry build`\n- If not present already, add the API token to Poetry.\n`poetry config pypi-token.pypi API_TOKEN`\n- Publish the Python package. `poetry publish`\n- Change directory to custom-nb-image. `cd custom-nb-image`\n- Set tag `export tag=TAG`\n- Build the container image. `podman build --build-arg SDK_VERSION=<version> -t quay.io/project-codeflare/notebook:${tag} .`\n- Login to quay.io. `podman login quay.io`\n- Push the image. `podman push quay.io/project-codeflare/notebook:${tag}`\n- Push the stable image tag `podman push quay.io/project-codeflare/notebook:${tag} quay.io/project-codeflare/notebook:stable`\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Python SDK for codeflare client",
"version": "0.15.1",
"project_urls": {
"Homepage": "https://github.com/project-codeflare/codeflare-sdk",
"Repository": "https://github.com/project-codeflare/codeflare-sdk"
},
"split_keywords": [
"codeflare",
" python",
" sdk",
" client",
" batch",
" scale"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "761855eb5ea791d8052a283cb5aa9f1a73593c8dc53abad29972fa455c0403b0",
"md5": "5812486de0807923ad65bd66470f2650",
"sha256": "b56c8d07d96db6e4a8ce795e2002fcd31f34e783025f5ae7881603ecb88f44a7"
},
"downloads": -1,
"filename": "codeflare_sdk-0.15.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5812486de0807923ad65bd66470f2650",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 38616,
"upload_time": "2024-04-12T17:18:27",
"upload_time_iso_8601": "2024-04-12T17:18:27.275045Z",
"url": "https://files.pythonhosted.org/packages/76/18/55eb5ea791d8052a283cb5aa9f1a73593c8dc53abad29972fa455c0403b0/codeflare_sdk-0.15.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a9d496e8e3d30f79c7d0a4695665afaa0cd0be0e6dea0633802f04447bf4e058",
"md5": "ef9d01d5f149d87ba1e38111eca3e824",
"sha256": "1b4d54c550354e612cad8439b1e7e332cd44767e9d9ab5670f6a4952bf3303d6"
},
"downloads": -1,
"filename": "codeflare_sdk-0.15.1.tar.gz",
"has_sig": false,
"md5_digest": "ef9d01d5f149d87ba1e38111eca3e824",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 32252,
"upload_time": "2024-04-12T17:18:28",
"upload_time_iso_8601": "2024-04-12T17:18:28.469036Z",
"url": "https://files.pythonhosted.org/packages/a9/d4/96e8e3d30f79c7d0a4695665afaa0cd0be0e6dea0633802f04447bf4e058/codeflare_sdk-0.15.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-12 17:18:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "project-codeflare",
"github_project": "codeflare-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "codeflare-sdk"
}