Skip to content

Commit

Permalink
chore: add PyPI release workflows and project metadata (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyhoo authored Nov 19, 2024
1 parent 22b168b commit b43e1c4
Show file tree
Hide file tree
Showing 13 changed files with 417 additions and 18 deletions.
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Description
<!-- Describe your changes in detail -->

## How Has This Been Tested?
<!-- Please describe how you tested your changes -->
- [ ] Unit tests (`pytest tests/`)
- [ ] Integration tests (if applicable)


## Configuration Changes
<!-- Note any changes to configuration files or environment variables -->
- [ ] No config changes
- [ ] Config changes (please describe):

## Type of Change
<!-- Check relevant options -->
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code cleanup/refactor
47 changes: 47 additions & 0 deletions .github/workflows/nightly_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflows will upload a Python Package using Twine as nightly release
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Nightly PyPI Release

on:
schedule:
- cron: '59 8 * * *' # Runs at 08:59 UTC every day
workflow_dispatch: # Manual trigger for testing

jobs:
nightly_release:
runs-on: ubuntu-latest
if: github.repository == 'autogluon/autogluon-assistant'
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CICD_PAT }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Update version for nightly
run: |
current_version=$(grep -A10 '^\[project\]' pyproject.toml | grep '^version = ' | cut -d'"' -f2)
nightly_version="${current_version}.dev$(TZ=America/Los_Angeles date +'%Y%m%d')"
perl -pi -e "s/version = \"${current_version}\"/version = \"${nightly_version}\"/" pyproject.toml
- name: Build package
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
skip-existing: true
4 changes: 4 additions & 0 deletions .github/workflows/platform_tests-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:
description: 'Get info of forked repository and branch'
required: false

permissions:
contents: read
id-token: write
jobs:
setup:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -85,6 +88,7 @@ jobs:
chmod +x ./.github/workflow_scripts/test_install.sh && ./.github/workflow_scripts/test_install.sh
integration_test:
needs: setup
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Official PyPI Release

on:
release:
types: [created]

jobs:
pypi_release:
runs-on: ubuntu-latest
if: github.repository == 'autogluon/autogluon-assistant'
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CICD_PAT }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
skip-existing: true
53 changes: 53 additions & 0 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test PyPI Release

# This workflow is for testing package releases on TestPyPI before official releases
# It automatically adds a unique suffix to the version to avoid conflicts
# since PyPI doesn't allow re-uploading the same version

on:
workflow_dispatch:

jobs:
test_release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CICD_PAT }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

# Modify version to avoid conflicts on TestPyPI
# Format: {version}dev{timestamp} e.g. 0.0.3dev202311190145
# This ensures each test upload has a unique version number
- name: Set test version
run: |
# Extract current version from pyproject.toml
VERSION=$(grep -m1 'version = ' pyproject.toml | cut -d'"' -f2)
# Add timestamp to make version unique
TEST_VERSION="${VERSION}dev$(date +%Y%m%d%H%M)"
# Update version in pyproject.toml
sed -i "s/version = \"${VERSION}\"/version = \"${TEST_VERSION}\"/" pyproject.toml
echo "Package version set to ${TEST_VERSION}"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel
- name: Build package
run: python -m build

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
skip-existing: true
4 changes: 4 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.
88 changes: 88 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.

Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.


## Reporting Bugs/Feature Requests

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

When filing an issue, please check [existing open](https://github.com/autogluon/autogluon-assistant/issues), or [recently closed](https://github.com/autogluon/autogluon-assistant/issues?q=is%3Aissue+is%3Aclosed), issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

* A reproducible test case or series of steps
* The version of autogluon.assistant being used
* Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment

Ideally, you can install autogluon.assistant and its dependencies in a fresh virtualenv to reproduce the bug.

## Contributing via Pull Requests
Code contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

1. You are working against the latest source on the *main* branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.

To send us a pull request, please:

1. Fork the repository.
2. Modify the source (see details below); please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Ensure local tests pass.
4. Commit to your fork using clear commit messages.
5. Send us a pull request, answering any default questions in the pull request interface.
6. Notify the maintainer to review your PR so that they can tag your PR as `safe to test` and start the CI process.
7. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).


## Tips for Modifying the Source Code

- Using a fresh virtualenv, install the package via `pip3 install -e .`.

- Use Python versions consistent with what the package supports as defined in `setup.py` (3.8 - 3.11).

- All code should adhere to the [PEP8 style](https://www.python.org/dev/peps/pep-0008/).

- After you have edited the code, ensure your changes pass the unit tests via:
```
pytest tests/
```

- We encourage you to add your own unit tests, but please ensure they run quickly (unit tests involving cloud resources generally would take a long time). You can run a specific unit test within a specific file like this:
```
python3 -m pytest path_to_file::test_mytest
```
Or remove the ::test_mytest suffix to run all tests in the file:
```
python3 -m pytest path_to_file
```

- After you open your pull request, our CI system will **NOT** run by default if you don't have write permission to our repo as our CI involves usage of AWS resources. Please ping the maintainer so that they can tag your PR and trigger the CI runs for you. Please check back and fix any errors encountered at this stage (you will need to repeat this process for each new commit you push).


## Finding Contributions to Work On
Looking at the existing issues is a great way to find something to contribute on. As our project uses the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/autogluon/autogluon-assistant/labels/help%20wanted) issues is a great place to start.


## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.


## Security Issue Notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.


## Licensing

See the [LICENSE](https://github.com/autogluon/autogluon-assistant/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
2 changes: 2 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ML Assistant for Competitive Machine Learning
Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Empty file added docs/whats_new/v0.1.0.md
Empty file.
11 changes: 0 additions & 11 deletions lint.sh

This file was deleted.

16 changes: 10 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[build-system]
requires = ["setuptools"]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "autogluon.assistant"
version = "0.1.0"
description = "An LLM-backed AI agent for competitive tabular machine learning"
version = "0.0.1"
description = "ML Assistant for Competitive Machine Learning"
authors = [
{name = "AutoGluon Community"}
]
readme = "README.md"
requires-python = ">=3.8"
dependencies = [
Expand Down Expand Up @@ -48,6 +50,8 @@ aga = "autogluon.assistant:main"

[tool.setuptools.packages.find]
where = ["src"]
include = ["autogluon.assistant*"]
namespaces = true

[tool.setuptools.package-data]
"autogluon.assistant" = ["configs/*.yaml", "ui/**/*"]
Expand All @@ -59,13 +63,13 @@ xfail_strict = true

[tool.black]
line-length = 119
target-version = ['py38', 'py39', 'py310']
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']

[tool.isort]
known_first_party = "autogluon.assistant"
known_third_party = [
"autogluon",
"caafe",
# "caafe",
"joblib",
"langchain",
"numpy",
Expand Down
Loading

0 comments on commit b43e1c4

Please sign in to comment.