Skip to content

Commit bf632f8

Browse files
authored
chore: add script to automate python tagging (#598)
1 parent 5e7491b commit bf632f8

8 files changed

+65
-3
lines changed

.github/workflows/version_publish_npm.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
- name: Version and/or Publish to NPM
3333
uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc
3434
with:
35-
commit: "chore: version packages"
36-
title: "chore: version packages"
35+
commit: "chore: version typescript packages"
36+
title: "chore: version typescript packages"
3737
version: npm run changeset:version
3838
publish: npm run publish
3939
cwd: ./typescript

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,5 @@ api.json
133133
docs/
134134
!python/coinbase-agentkit/docs/
135135
!python/framework-extensions/langchain/docs/
136+
137+
.to-publish-pypi

CONTRIBUTING-PYTHON.md

+16
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This guide covers Python-specific setup and development for AgentKit.
1212
- [Code Style](#code-style)
1313
- [Documentation](#documentation)
1414
- [Changelog](#changelog)
15+
- [Releasing](#releasing)
1516

1617
## Development Setup
1718

@@ -264,3 +265,18 @@ The types of changes you can add are:
264265

265266
- `feature`
266267
- `bugfix`
268+
269+
## Releasing
270+
271+
When ready to release the Python packages, follow these steps.
272+
273+
1. From the `python/` folder, run: `./scripts/version.sh`
274+
- This creates a file `.to-publish-pypi` containing which packages have changes, and the new version that will be published. This file is automatically used in step 5.
275+
2. Commit the changes and open a PR with message: `chore: version python packages`
276+
3. Get PR reviewed and merge to `main`
277+
4. Run GitHub Actions to release changed packages
278+
- [Publish AgentKit Core Action](https://github.com/coinbase/agentkit/actions/workflows/publish_pypi_coinbase_agentkit.yml)
279+
- [Publish Create Onchain Agent Action](https://github.com/coinbase/agentkit/actions/workflows/publish_pypi_create_onchain_agent.yml)
280+
- [Publish Agentkit Langchain Action](https://github.com/coinbase/agentkit/actions/workflows/publish_pypi_coinbase_agentkit_langchain.yml)
281+
- [Publish Open AI Extension](https://github.com/coinbase/agentkit/actions/workflows/publish_pypi_coinbase_agentkit_openai_agents_sdk.yml)
282+
5. After all changed packages have been published, rebase `main` and, from the `python/` folder, run the following command to automatically create and push tags for changed packages: `./scripts/tag.sh`

CONTRIBUTING-TYPESCRIPT.md

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This guide covers TypeScript-specific setup and development for AgentKit.
1212
- [Code Style](#code-style)
1313
- [Documentation](#documentation)
1414
- [Changelog](#changelog)
15+
- [Releasing](#releasing)
1516

1617
## Development Setup
1718

@@ -284,3 +285,7 @@ This will kick off an interactive prompt to help you create the changeset. Use t
284285
Once complete, a new changeset will be created in the `.changeset` directory, which should be committed along with the changes in your Pull Request.
285286

286287
For more info on adding changelog entries, [see here](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).
288+
289+
## Releasing
290+
291+
When ready to release the TypeScript packages, just review & merge the changesets PR (look for a PR titled "chore: version typescript packages"). This will automatically kick off the publish in the [changesets action](https://github.com/coinbase/agentkit/tree/main/.github/workflows/version_publish_npm.yml).

CONTRIBUTING.md

+14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
Thank you for your interest in contributing to AgentKit! We welcome all contributions, no matter how big or small.
44

5+
## Contents
6+
7+
- [Repository Structure](#repository-structure)
8+
- [Language-Specific Guides](#language-specific-guides)
9+
- [Contributing Workflow](#contributing-workflow)
10+
- [Releasing](#releasing)
11+
- [Getting Help](#getting-help)
12+
- [Monorepo Development Tips](#monorepo-development-tips)
13+
514
## Repository Structure
615

716
The AgentKit repository is organized as two [monorepos](https://vercel.com/docs/vercel-platform/glossary#monorepo), one for Python and one for TypeScript. The TypeScript side is organized as a [multi-package workspace](https://vercel.com/docs/vercel-platform/glossary#multi-package-workspace) and is managed with [Turborepo](https://turbo.build/repo/docs), while the Python side is simply a collection of Python packages. A Python package is a single subfolder with a `pyproject.toml` file, along with related code and files that are published together to PyPI, whereas a TypeScript [package](https://vercel.com/docs/vercel-platform/glossary#package) is a single subfolder with a `package.json` and related code that is published to NPM. For example, the `typescript/agentkit` subfolder is a TypeScript package, and the `python/coinbase-agentkit` subfolder is a Python package.
@@ -91,6 +100,11 @@ Current list of maintainers:
91100
- [@0xRAG](https://github.com/0xRAG)
92101
- [@yuga-cb](https://github.com/yuga-cb)
93102

103+
## Releasing
104+
105+
- For TypeScript, see [TypeScript Development Guide](./CONTRIBUTING-TYPESCRIPT.md#releasing)
106+
- For Python, see [Python Development Guide](./CONTRIBUTING-PYTHON.md#releasing)
107+
94108
## Getting Help
95109

96110
If you're stuck, there are a few ways to get help:

python/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ See [Create Onchain Agent](./create-onchain-agent/README.md) to get started!
3333
**AgentKit is actively looking for community contributions!**
3434

3535
- To see a list of actions and frameworks we'd love to see open-source contributions for, see [WISHLIST.md](../WISHLIST.md).
36-
- To understand the process for contributing to AgentKit, see [CONTRIBUTING.md](../CONTRIBUTING.md).
36+
- To understand the process for contributing to AgentKit, see [CONTRIBUTING.md](../CONTRIBUTING.md).

python/scripts/tag.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
while IFS= read -r package; do
2+
name=$(echo "$package" | cut -d ' ' -f 1)
3+
version=$(echo "$package" | cut -d ' ' -f 2)
4+
5+
if [ "$name" = "create-onchain-agent" ]; then
6+
tag_name="create-onchain-agent-python"
7+
message="Release create-onchain-agent python version $version"
8+
else
9+
tag_name="$name"
10+
message="Release $name version $version"
11+
fi
12+
13+
echo "git tag -a \"$tag_name@$version\" -m \"$message\""
14+
git tag -a "$tag_name@$version" -m "$message"
15+
16+
echo "git push origin \"$tag_name@$version\""
17+
git push origin "$tag_name@$version"
18+
done < .to-publish-pypi

python/scripts/version.sh

+7
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@ for package in "${all_packages[@]}"; do
2020
fi
2121
done
2222

23+
rm -f .to-publish-pypi
24+
touch .to-publish-pypi
25+
26+
ROOT_DIR=$(pwd)
27+
2328
for package in "${changed_packages[@]}"; do
2429
cd $package
2530
poetry install
2631
poetry run -- towncrier build --yes
32+
package_and_version=$(poetry version)
33+
echo "$package_and_version" >> "${ROOT_DIR}/.to-publish-pypi"
2734
cd - > /dev/null
2835
done

0 commit comments

Comments
 (0)