Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding License, docs and placeholder workflows to make package public #20

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 0 additions & 115 deletions .github/workflows/bump_version.yml

This file was deleted.

150 changes: 126 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,139 @@
name: Create Release
name: Publish to PyPI

on:
# push:
# tags:
# - 'v*'

workflow_dispatch:
inputs:
tag:
description: 'Target Tag for Release'
type: string
part:
description: "Semver part to bump (major, minor, patch)"
type: choice
required: true
force:
description: 'Force Release?'
default: "patch"
options: ["major", "minor", "patch"]
dry-run:
description: "Dry run"
type: boolean
required: false
default: false
required: true
default: true
python-version:
description: "Python version used to build the distribution"
type: choice
required: true
default: "3.11"
options: ["3.9", "3.10", "3.11", "3.12"]

jobs:
create-release:
bump:
name: Bump version
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
outputs:
VERSION: ${{ steps.get-version-and-commit-sha.outputs.VERSION }}
SHORT_VERSION: ${{ steps.get-version-and-commit-sha.outputs.SHORT_VERSION }}
MAJOR_VERSION: ${{ steps.get-version-and-commit-sha.outputs.MAJOR_VERSION }}
MINOR_VERSION: ${{ steps.get-version-and-commit-sha.outputs.MINOR_VERSION }}
PATCH_VERSION: ${{ steps.get-version-and-commit-sha.outputs.PATCH_VERSION }}
COMMIT_SHA: ${{ steps.get-version-and-commit-sha.outputs.COMMIT_SHA }}
steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ github.event.inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ github.event.inputs.python-version }}
cache: 'pip'
- name: Set up AllenInstitute Repo Authorization
uses: ./.github/actions/configure-org-repo-authorization
with:
token: ${{ secrets.AI_PACKAGES_TOKEN }}
- name: Get tags
run: git fetch --tags origin
- name: Configure git for github-actions[bot]
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Run Install
run: |
make install-release
shell: bash
- name: Bump version with bumpversion
run: |
source .venv/bin/activate
bump-my-version bump ${{ github.event.inputs.part }}
- name: Commit and push with tags
if: ${{ github.event.inputs.dry-run == 'false' }}
run: |
git push --follow-tags
- name: Get version and commit SHA
id: get-version-and-commit-sha
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
# remove the leading v from tag
version="${latest_tag:1}"
echo "VERSION=$version" >> $GITHUB_OUTPUT
major_version="$(cut -d '.' -f 1 <<< $version)"
echo "MAJOR_VERSION=$major_version" >> $GITHUB_OUTPUT
minor_version="$(cut -d '.' -f 2 <<< $version)"
echo "MINOR_VERSION=$minor_version" >> $GITHUB_OUTPUT
patch_version="$(cut -d '.' -f 3 <<< $version)"
echo "PATCH_VERSION=$patch_version" >> $GITHUB_OUTPUT
short_version="$major_version.$minor_version"
echo "SHORT_VERSION=$short_version" >> $GITHUB_OUTPUT
commit_sha=$(git rev-parse $latest_tag)
echo "COMMIT_SHA=$commit_sha" >> $GITHUB_OUTPUT
- name: Show version
run: |
echo VERSION: ${{ steps.get-version-and-commit-sha.outputs.VERSION }}
echo SHORT_VERSION: ${{ steps.get-version-and-commit-sha.outputs.SHORT_VERSION }}
echo MAJOR_VERSION: ${{ steps.get-version-and-commit-sha.outputs.MAJOR_VERSION }}
echo MINOR_VERSION: ${{ steps.get-version-and-commit-sha.outputs.MINOR_VERSION }}
echo PATCH_VERSION: ${{ steps.get-version-and-commit-sha.outputs.PATCH_VERSION }}
echo COMMIT_SHA: ${{ steps.get-version-and-commit-sha.outputs.COMMIT_SHA }}

build:
name: Build distribution
runs-on: ubuntu-latest
needs: bump
if: ${{ github.event.inputs.dry-run == 'false' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Create Release with Changelog
id: create_release
uses: softprops/action-gh-release@v1
ref: ${{ needs.bump.outputs.COMMIT_SHA }}
- name: Set up Python ${{ github.event.inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ github.event.inputs.python-version }}
cache: 'pip'
- name: Set up AllenInstitute Repo Authorization
uses: ./.github/actions/configure-org-repo-authorization
with:
token: ${{ secrets.AI_PACKAGES_TOKEN }}
- name: Run Release
run: |
make dist
shell: bash
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish to PyPI
needs: build
if: ${{ github.event.inputs.dry-run == 'false' }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/aibs-informatics-aws-utils
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
name: Release ${{ github.event.inputs.tag || github.ref_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing to `aibs-informatics-aws-utils`

Contributions are welcome and appreciated!

## Types of Contributions

### Reporting Bugs

Report bugs to our [issues page](https://github.com/aibs-informatics-aws-utils/issues).

If you are reporting a bug, please include:

- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug, in the form of a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example).

### Making Changes

Look through the GitHub issues for bugs, features, and other requests. Most issues will have a label that can help you identify the type of issue.

### Submitting Feedback

The best way to send feedback is to [create an issue](https://github.com/aibs-informatics-aws-utils/issues/new) on GitHub.

If you are proposing a feature:

- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that while contributions are welcome, developer/maintainer time is limited.
33 changes: 33 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Allen Institute Software License – This software license is the 2-clause BSD
license plus a third clause that prohibits redistribution and use for
commercial purposes without further permission.

Copyright © 2024. Allen Institute. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Redistributions and use for commercial purposes are not permitted without
the Allen Institute’s written permission. For purposes of this license,
commercial purposes are the incorporation of the Allen Institute's software
into anything for which you will charge fees or other compensation or use of
the software to perform a commercial service for a third party. Contact
[email protected] for commercial licensing opportunities.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ $(INSTALL_STAMP): $(PYTHON) $(DEP_FILES)
$(PIP) install -e .[dev];
@touch $(INSTALL_STAMP)

install-release: clean-install-stamp $(PYTHON) $(DEP_FILES) ## Installs package for release
@. $(VENV_BIN)/activate;\
$(PIP) install .[release]

install-force: clean-install-stamp install ## Force install package dependencies

link-packages: ## Link local packages to virtualenv
Expand Down Expand Up @@ -166,6 +170,10 @@ coverage-server: $(INSTALL_STAMP) ## Run coverage server
##@ Release Commands
#####################

dist: install-release ## Build source and wheel package
@. $(VENV_BIN)/activate;\
$(PYTHON) -m build;

reinstall: obliterate install ## Recreate environment and install

pre-build: obliterate ## Removes existing build environment
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@

---

library of AWS utility code
## Overview

The AIBS Informatics AWS Utils library provides a collection of utilities and tools for working with AWS services. This library includes functionalities for interacting with AWS S3, ECR, Lambda, and other AWS services, making it easier to integrate AWS capabilities into various projects at the Allen Institute for Brain Science.

## Contributing

Any and all PRs are welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information.

## Licensing

This software is licensed under the Allen Institute Software License, which is the 2-clause BSD license plus a third clause that prohibits redistribution and use for commercial purposes without further permission. For more information, please visit [Allen Institute Terms of Use](https://alleninstitute.org/terms-of-use/).
Loading
Loading