Skip to content

Commit 0a87c47

Browse files
[python/knowpro] Release to PyPI; support WebVTT; GMail extraction (#1603)
Main accomplishment is that we now publish to PyPI whenever a new tag is pushed (to the branch). Additionally, added support for ingesting .vtt files (for the MP demo). Finally, add tool for extracting GMail messages (probably only usable by me?). Most of the code was written by Claude Sonnet 4 and 4.5, with occasional help from GPT-5 (GMail extraction) and manual adjustments.
1 parent e5ee95a commit 0a87c47

28 files changed

+6878
-556
lines changed

.github/workflows/release-py.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
name: Release (PyPI via Trusted Publishing + uv)
5+
6+
on:
7+
push:
8+
tags: [ "v*" ] # tag to publish
9+
workflow_dispatch: # manual run
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
shell: bash
20+
working-directory: python/ta # your project subdir
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.12"
28+
29+
- name: Install uv
30+
run: |
31+
curl -LsSf https://astral.sh/uv/install.sh | sh
32+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
33+
34+
- name: Create .venv and install deps
35+
run: uv sync
36+
37+
- name: Build sdist + wheel (via make)
38+
run: make build # runs `uv build`, outputs to dist/
39+
40+
- name: Upload build artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: dist
44+
path: python/ta/dist/
45+
46+
publish:
47+
needs: build
48+
runs-on: ubuntu-latest
49+
environment:
50+
name: pypi
51+
url: https://pypi.org/p/typeagent-py
52+
permissions:
53+
id-token: write # REQUIRED for Trusted Publishing (no tokens!)
54+
contents: read
55+
steps:
56+
- uses: actions/download-artifact@v4
57+
with:
58+
name: dist
59+
path: dist
60+
61+
- name: Publish to PyPI
62+
uses: pypa/gh-action-pypi-publish@release/v1
63+
# For TestPyPI first, add:
64+
# with:
65+
# repository-url: https://test.pypi.org/legacy/

python/ta/.github/copilot-instructions.md

Lines changed: 0 additions & 193 deletions
This file was deleted.

python/ta/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ venv
88
/evals
99
/junk
1010
__pycache__
11+
testdata/MP/
12+
db
File renamed without changes.

python/ta/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ scaling: venv
4545

4646
.PHONY: build
4747
build: venv
48-
.venv/bin/python -m build --wheel
48+
uv build
4949

5050
.PHONY: venv
5151
venv: .venv

python/ta/README.md

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,9 @@ This is an in-progress project aiming at a Pythonic translation of
1010
`TypeAgent/ts/packages/knowPro` and a few related packages to Python.
1111
(Pythonic because it uses Python conventions and types as appropriate.)
1212

13-
### Original description
14-
15-
(Not all of this matches the current state of the code.)
16-
17-
- Python class names correspond 1:1 to TS interface or type names.
18-
(Much has changed here.)
19-
- Field and method names are converted from camelCase to python_case.
20-
- I-named interfaces become `Protocol` classes.
21-
(Or in some cases `ABC`s.)
22-
- Other interfaces and structured types become dataclasses.
23-
- Union types remain union types.
24-
- Except unions of string literals become `Literal` types.
25-
- Not all of the TS class hierarchy is translated literally.
26-
27-
### How to build
28-
29-
Tested on Mac and on Ubuntu 22 under WSL.
30-
Should work on most UNIXoids.
31-
(For Windows, look at the `make.bat` script.)
32-
33-
- Install Python 3.12 or higher (get it from
34-
[python.org](https://www.python.org/downloads/) for Mac,
35-
or run `sudo apt install python3.12` for Linux)
36-
- Run `make all`
37-
- You should now have a wheel file under `dist/`
38-
- To install: `python3.12 -m pip install dist/typeagent-0.1.0-py3-none-any.whl`
39-
- TODO: Upload that wheel to PyPI
40-
- To clean up, run `make clean`
41-
42-
### How to test
43-
44-
- Set your environment to contain the necessary OpenAI or Azure API keys
45-
(OPENAI_API_KEY or AZURE_OPENAI_API_KEY)
46-
- Run unit tests: `make test`
47-
- Review coverage with `make coverage`
48-
- Interactively testing queries: `make demo`
49-
- Comparing to a validated set of questions and expected answers:
50-
- Obtain or construct a JSON file of q/a pairs and install in testdata
51-
- Run `make compare` (takes about 5-10 seconds per q/a pair)
13+
### Documentation
14+
15+
(To be written. Sorry.)
5216

5317
## Trademarks
5418

0 commit comments

Comments
 (0)