Skip to content

Commit

Permalink
Merge branch 'main' into add_langchain_function
Browse files Browse the repository at this point in the history
  • Loading branch information
ulya-tkch committed Jan 29, 2025
2 parents 7874156 + 6304b34 commit 1695039
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 9 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches:
- main
workflow_call:

jobs:
typecheck:
Expand All @@ -17,9 +18,6 @@ jobs:
with:
python-version: "3.13"
- uses: pypa/hatch@install
# TODO: remove after we release codex-sdk package (and are no longer installing from github)
- name: setup git url rewrite
run: git config --global url."https://${{ secrets.GH_USERNAME }}:${{ secrets.CLEANLAB_BOT_PAT }}@github.com".insteadOf ssh://[email protected]
- run: hatch run types:check
fmt:
name: Format and lint
Expand All @@ -43,7 +41,4 @@ jobs:
with:
python-version: ${{ matrix.python }}
- uses: pypa/hatch@install
# TODO: remove after we release codex-sdk package (and are no longer installing from github)
- name: setup git url rewrite
run: git config --global url."https://${{ secrets.GH_USERNAME }}:${{ secrets.CLEANLAB_BOT_PAT }}@github.com".insteadOf ssh://[email protected]
- run: hatch test -v --cover --include python=$(echo ${{ matrix.python }})
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build and publish package
on:
push:
tags:
- 'v*.*.*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
tests:
uses: ./.github/workflows/ci.yml

build:
name: Build package and upload artifacts
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install hatch
uses: pypa/hatch@install
- name: Check versions match
run: |
pkg_version=$(hatch version)
tag_version=${GITHUB_REF#refs/tags/v}
if [ "$pkg_version" != "$tag_version" ]; then
echo "Package version ($pkg_version) does not match git tag version ($tag_version)"
exit 1
fi
- name: Build package
run: hatch build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cleanlab-codex
path: dist/*
if-no-files-found: error

publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: cleanlab-codex
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

upload-release:
name: Upload release to GitHub
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: cleanlab-codex
path: dist
- name: Upload release
uses: softprops/action-gh-release@v1
with:
files: dist/*
body: ${{ steps.extract-release-notes.outputs.release_notes }}
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ repos:
language: python
types: [python]
pass_filenames: false
verbose: true
- id: type-check
name: type-check
entry: hatch run types:check
language: python
types: [python]
pass_filenames: false
verbose: true
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.1a1] - 2025-01-29

### Added

- Pre-release of the Cleanlab Codex Python client.

[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a1...HEAD
[0.0.1a1]: https://github.com/cleanlab/cleanlab-codex/compare/267a93300f77c94e215d7697223931e7926cad9e...v0.0.1a1
15 changes: 15 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ You can use [`hatch publish`][hatch-publish] if you want to manually publish bui
[hatch-publish]: https://hatch.pypa.io/latest/publish/
[pypi]: https://pypi.org/

### Automated releases

Automated releases are handled by the [release workflow][release-workflow] which is triggered by pushing a new tag to the repository. To create a new release:

1. Bump the version in `src/cleanlab_codex/__about__.py`. You can use the [`hatch version`][hatch-version] command to do this.
2. Ensure that the release notes are updated in [`CHANGELOG.md`][changelog]. You should update the `[Unreleased]` header to the new version and add a new `[Unreleased]` section at the top of the file.
3. Create a PR and merge these changes into the `main` branch.
4. After the PR is merged into `main`, create a new release tag by running `git tag v<output of hatch version>` (i.e. `git tag v0.0.1`).
5. Push the tag to the repository by running `git push origin <tag>`.
6. This will trigger the release workflow which will build the package, create a release on GitHub, and publish the package version to PyPI. The GitHub release notes will be automatically generated from the [changelog].

[release-workflow]: .github/workflows/release.yml
[hatch-version]: https://hatch.pypa.io/latest/version/#updating
[changelog]: CHANGELOG.md

## Continuous integration

Testing, type checking, and formatting/linting is [checked in CI][ci].
Expand Down
2 changes: 1 addition & 1 deletion src/cleanlab_codex/__about__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# SPDX-License-Identifier: MIT
__version__ = "0.0.1"
__version__ = "0.0.1a1"

0 comments on commit 1695039

Please sign in to comment.