From 0c0b18685da224bd013faa68ca2839150a6e1765 Mon Sep 17 00:00:00 2001 From: Brendan Barnes Date: Wed, 5 Jul 2023 20:23:09 +0000 Subject: [PATCH 1/4] add build files --- .github/workflows/create_github_release.yml | 69 +++++++++++++++ LICENSE | 21 +++++ README.md | 97 ++++++++++++++++++++- pyproject.toml | 18 ++++ 4 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/create_github_release.yml create mode 100644 LICENSE create mode 100644 pyproject.toml diff --git a/.github/workflows/create_github_release.yml b/.github/workflows/create_github_release.yml new file mode 100644 index 0000000..e42f5fd --- /dev/null +++ b/.github/workflows/create_github_release.yml @@ -0,0 +1,69 @@ +name: Create Release + +on: + push: + branches: [ main ] + +jobs: + build: + permissions: write-all + name: Create Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install toml build + + - name: Get package version + id: get_version + run: | + echo "::set-output name=version::$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")" + + - name: Check if release exists + id: check_release + run: | + response=$(curl -s -o /dev/null -w "%{http_code}" -u "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ steps.get_version.outputs.version }}") + if [[ $response -eq 200 ]]; then + echo "Release with the same tag already exists. Please increment the version in the pyproject.toml file" + exit 1 + fi + + - name: Build and package + run: | + python -m build + + - name: Install and test built package + run: | + python -m pip install ./dist/*.whl + python -c "import cc_sdk; from importlib.metadata import version; version('cc_sdk')" + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.get_version.outputs.version }} + release_name: Release v${{ steps.get_version.outputs.version }} + body: | + Release for version ${{ steps.get_version.outputs.version }} + draft: false + prerelease: false + + - name: Upload distributions + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/dist/cc_sdk-${{ steps.get_version.outputs.version }}-py3-none-any.whl + asset_name: cc_sdk-${{ steps.get_version.outputs.version }}-py3-none-any.whl + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..455e568 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Will Lehman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index a5b4290..e3d676a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,97 @@ # cc-python-sdk -The Python SDK for developing plugins for Cloud Compute \ No newline at end of file + +[![PyPI version](https://badge.fury.io/py/cc_sdk.svg)](https://badge.fury.io/py/cc_sdk) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + +cc_sdk is the Python Software Development Kit used to develop plugins for Cloud Compute. + +## Installation + +You can install cc_sdk in two ways: from source or through the pip package manager. + +### Installing from source + +To install cc_sdk from source, follow these steps: + +1. Clone the repository: + +```shell +git clone https://github.com/USACE/cc-python-sdk.git +``` + +2. Navigate to the project directory: + +```shell +cd cc-python-sdk +``` + +3. Create a virtual environment (optional but recommended): + +```shell +python3 -m venv venv +source venv/bin/activate +``` + +4. Install the package dependencies: + +```shell +pip install -r requirements.txt +``` + +5. Install the build dependencies + +```shell +python3 -m pip install --upgrade build +``` + +6. Build cc_sdk from the `pyproject.toml`: + +```shell +python3 -m build +``` + +7. Install the generated wheel (replace with the version of the wheel file built): + +```shell +pip install dist/cc_sdk--py3-none-any.whl +``` + +or + +```shell +pip install dist/*.whl +``` + +Now you have successfully installed cc_sdk from source. + +## Install from pre-built distribution + +Download the release from the 'Releases' page of this repository, then install with pip: + +```shell +pip install +``` + +### Installing through pip + +To install cc_sdk using pip, simply run the following command: + +```shell +pip install cc_sdk +``` + +This will download the latest version of cc_sdk from the Python Package Index (PyPI) and install it into your Python environment. + +## Usage + +Once cc_sdk is installed, you can start using its functionality in your Python projects. Here's a simple example: + +```python +import cc_sdk + +# Use the functions and classes provided by cc_sdk +``` + +## Documentation + +TODO. See example plugin [here](https://<>) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e3c739c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[project] +name = "cc_sdk" +version = "0.0.1" +authors = [ + { name="Will Lehman", email="William.P.Lehman@usace.army.mil" }, +] +description = "The Python SDK for developing plugins for Cloud Compute" +readme = "README.md" +requires-python = ">=3.10" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] + +[project.urls] +"Homepage" = "https://github.com/USACE/cc-python-sdk" +"Bug Tracker" = "https://github.com/USACE/cc-python-sdk/issues" \ No newline at end of file From b08d8e50fa73462fde3b5c5e82b45e6d130efed1 Mon Sep 17 00:00:00 2001 From: Brendan Barnes Date: Wed, 5 Jul 2023 20:23:22 +0000 Subject: [PATCH 2/4] add github cli to devcontainer --- .devcontainer/devcontainer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3d845b7..db3a2bd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,8 +4,10 @@ "name": "Python 3", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/devcontainers/python:0-3.11", - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, + "features": { + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + }, // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. From a6ddf9832ee9fbdeab252d6abb833f290334e66d Mon Sep 17 00:00:00 2001 From: Brendan Barnes Date: Wed, 5 Jul 2023 16:05:30 -0500 Subject: [PATCH 3/4] added authors --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index e3c739c..534a959 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,6 +3,8 @@ name = "cc_sdk" version = "0.0.1" authors = [ { name="Will Lehman", email="William.P.Lehman@usace.army.mil" }, + { name="Brendan Barnes", email="brendan.barnes@mbakerintl.com" }, + { name="Thomas Williams", email="thomas.williams@wsp.com" }, ] description = "The Python SDK for developing plugins for Cloud Compute" readme = "README.md" From f3ad77038540bc0459e32198230286edd888e956 Mon Sep 17 00:00:00 2001 From: Brendan Barnes Date: Thu, 6 Jul 2023 21:26:19 +0000 Subject: [PATCH 4/4] add dependencies to toml --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 534a959..c035433 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,10 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] +dependencies = [ + 'attrs >= 22.2.0', + 'boto3 >= 1.26.93', +] [project.urls] "Homepage" = "https://github.com/USACE/cc-python-sdk"