Skip to content

Commit 5e934ac

Browse files
authored
Merge pull request #63 from mgaitan/agent/workspace-packages
Finalize workspace package names and publishing
2 parents 5746ae4 + 0fdf6b1 commit 5e934ac

30 files changed

Lines changed: 255 additions & 233 deletions

.github/workflows/cd.yml

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

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- "packages/**"
1111
- "src/**"
1212
- "README.md"
13-
- ".github/workflows/ci.yml"
13+
- ".github/workflows/**"
1414
push:
1515
branches:
1616
- main
@@ -20,7 +20,7 @@ on:
2020
- "packages/**"
2121
- "src/**"
2222
- "README.md"
23-
- ".github/workflows/ci.yml"
23+
- ".github/workflows/**"
2424

2525
permissions:
2626
contents: read
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish markdown-this
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Version already written in packages/markdown-this/pyproject.toml"
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: read
15+
id-token: write
16+
17+
jobs:
18+
publish:
19+
name: Publish markdown-this
20+
runs-on: ubuntu-latest
21+
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'markdown-this-v')
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Set up uv
29+
uses: astral-sh/setup-uv@v7
30+
31+
- name: Verify package version
32+
env:
33+
RELEASE_TAG: ${{ github.event.release.tag_name }}
34+
INPUT_VERSION: ${{ inputs.version }}
35+
run: |
36+
version="$(uv version --package markdown-this --short)"
37+
if [ "${{ github.event_name }}" = "release" ]; then
38+
expected="${RELEASE_TAG#markdown-this-v}"
39+
else
40+
expected="$INPUT_VERSION"
41+
fi
42+
test "$version" = "$expected" || {
43+
echo "pyproject version ($version) does not match release version ($expected)"
44+
exit 1
45+
}
46+
47+
- name: Build package
48+
run: uv build --package markdown-this --out-dir dist/markdown-this
49+
50+
- name: Publish to PyPI
51+
run: uv publish dist/markdown-this/*
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish md-to-telegraph
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Version already written in packages/md-to-telegraph/pyproject.toml"
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: read
15+
id-token: write
16+
17+
jobs:
18+
publish:
19+
name: Publish md-to-telegraph
20+
runs-on: ubuntu-latest
21+
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'md-to-telegraph-v')
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Set up uv
29+
uses: astral-sh/setup-uv@v7
30+
31+
- name: Verify package version
32+
env:
33+
RELEASE_TAG: ${{ github.event.release.tag_name }}
34+
INPUT_VERSION: ${{ inputs.version }}
35+
run: |
36+
version="$(uv version --package md-to-telegraph --short)"
37+
if [ "${{ github.event_name }}" = "release" ]; then
38+
expected="${RELEASE_TAG#md-to-telegraph-v}"
39+
else
40+
expected="$INPUT_VERSION"
41+
fi
42+
test "$version" = "$expected" || {
43+
echo "pyproject version ($version) does not match release version ($expected)"
44+
exit 1
45+
}
46+
47+
- name: Build package
48+
run: uv build --package md-to-telegraph --out-dir dist/md-to-telegraph
49+
50+
- name: Publish to PyPI
51+
run: uv publish dist/md-to-telegraph/*

AGENTS.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Working with This Workspace
22

3-
Lobstergram is a uv-managed Python workspace. Keep changes small, preserve the
3+
Lobstersgram is a uv-managed Python workspace. Keep changes small, preserve the
44
boundaries between the application and reusable packages, and run the checks
55
that cover the code you touched.
66

77
This file is adapted from the [python-package-copier-template AGENTS.md](https://github.com/mgaitan/python-package-copier-template/blob/main/AGENTS.md).
88

99
## Workspace Layout
1010

11-
- `src/lobstergram/` contains the main Telegram application and its
12-
`lobstergram` command-line entrypoint.
11+
- `src/lobstersgram/` contains the main Telegram application and its
12+
`lobstersgram` command-line entrypoint.
1313
- `packages/md-to-telegraph/` contains the reusable Markdown-to-Telegraph
1414
package.
15-
- `packages/url-to-markdown/` contains the reusable URL/HTML-to-Markdown
15+
- `packages/markdown-this/` contains the reusable URL/HTML-to-Markdown
1616
package.
1717
- Each child package has its own `pyproject.toml`, metadata, dependencies,
1818
version, `README.md`, `src/<import_name>/`, and package-local tests.
@@ -25,24 +25,24 @@ This file is adapted from the [python-package-copier-template AGENTS.md](https:/
2525

2626
```bash
2727
uv sync
28-
uv run lobstergram --help
28+
uv run lobstersgram --help
2929
uv run pytest -q
30-
uv run pytest packages/url-to-markdown/tests/test_html.py
30+
uv run pytest packages/markdown-this/tests/test_html.py
3131
uv run ruff check .
3232
uv run ruff format --check .
3333
uv build --all-packages
3434
```
3535

36-
The default coverage gate measures `md_to_telegraph` and `url_to_markdown` at
36+
The default coverage gate measures `md_to_telegraph` and `markdown_this` at
3737
100%. The application tests run in the same pytest invocation, but the root
38-
configuration does not currently enforce 100% coverage for `lobstergram`.
38+
configuration does not currently enforce 100% coverage for `lobstersgram`.
3939

4040
## Package Boundaries
4141

4242
- Keep Telegram orchestration, configuration, persistence, and runtime state
43-
in `src/lobstergram/`.
43+
in `src/lobstersgram/`.
4444
- Keep reusable conversion and extraction logic in the relevant child package.
45-
- Reusable packages should not import application modules from `lobstergram`.
45+
- Reusable packages should not import application modules from `lobstersgram`.
4646
- Put shared QA configuration in the root `pyproject.toml`; keep package
4747
metadata and package-specific runtime dependencies in the child package's
4848
`pyproject.toml`.
@@ -53,15 +53,17 @@ Packages are versioned and released independently. Bump a package from the
5353
workspace root, for example:
5454

5555
```bash
56-
uv version --package url-to-markdown --bump patch
56+
uv version --package markdown-this --bump patch
5757
uv lock
58-
git tag url-to-markdown-v<version>
59-
git push origin url-to-markdown-v<version>
58+
git tag markdown-this-v<version>
59+
git push origin markdown-this-v<version>
6060
```
6161

62-
Use the package names `lobstergram`, `md-to-telegraph`, or
63-
`url-to-markdown`. The `cd.yml` workflow builds and publishes only the package
64-
selected by its tag.
62+
The reusable packages are published independently. Each publishing workflow
63+
is dedicated to one package: `publish-md-to-telegraph.yml` publishes
64+
`md-to-telegraph`, and `publish-markdown-this.yml` publishes `markdown-this`.
65+
The `lobstersgram` application is not published to PyPI yet. A release tag only
66+
activates the matching workflow.
6567

6668
## Editing and Verification
6769

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Lobstergram: Lobsters → Telegraph → Telegram (Serverless)
1+
# Lobstersgram: Lobsters → Telegraph → Telegram (Serverless)
22

33
[![CI](https://github.com/mgaitan/lobstersgram/actions/workflows/ci.yml/badge.svg)](https://github.com/mgaitan/lobstersgram/actions/workflows/ci.yml)
44

5-
Lobstergram is a fast Telegram client for [lobste.rs](https://lobste.rs). It delivers the hottest Lobsters stories (articles that reached the home page) right into Telegram with a clean telegra.ph reading view.
5+
Lobstersgram is a fast Telegram client for [lobste.rs](https://lobste.rs). It delivers the hottest Lobsters stories (articles that reached the home page) right into Telegram with a clean telegra.ph reading view.
66

77
Bot: [@lobstersgram_bot](https://t.me/lobstersgram_bot)
88
Post: https://mgaitan.github.io/en/posts/lobstersgram-cliente-rapido-lobsters/
@@ -13,7 +13,7 @@ Commands:
1313

1414
Demo:
1515

16-
[![Lobstergram demo](https://img.youtube.com/vi/wdzIBFYjJ3Y/hqdefault.jpg)](https://youtube.com/shorts/wdzIBFYjJ3Y?si=yMhLPjz7kDGX_1Wl)
16+
[![Lobstersgram demo](https://img.youtube.com/vi/wdzIBFYjJ3Y/hqdefault.jpg)](https://youtube.com/shorts/wdzIBFYjJ3Y?si=yMhLPjz7kDGX_1Wl)
1717

1818
---
1919

@@ -40,28 +40,33 @@ No callbacks, no pagination logic, no bot process running 24/7.
4040

4141
This workspace contains two reusable packages used by the bot:
4242

43-
- [`url-to-markdown`](packages/url-to-markdown/README.md): extracts web pages and supported special URLs as Markdown.
43+
- [`markdown-this`](packages/markdown-this/README.md): extracts web pages and supported special URLs as Markdown.
4444
- [`md-to-telegraph`](packages/md-to-telegraph/README.md): converts Markdown into Telegraph DOM nodes.
4545

4646
Each package has its own version and can be released independently from this workspace.
4747

4848
### Independent releases
4949

5050
Versions live in each package's own `pyproject.toml`. For example, to bump and
51-
release `url-to-markdown`:
51+
release `markdown-this`:
5252

5353
```bash
54-
uv version --package url-to-markdown --bump patch
54+
uv version --package markdown-this --bump patch
5555
uv lock
56-
git commit -am "Release url-to-markdown $(uv version --package url-to-markdown --short)"
57-
git tag "url-to-markdown-v$(uv version --package url-to-markdown --short)"
56+
git commit -am "Release markdown-this $(uv version --package markdown-this --short)"
57+
git tag "markdown-this-v$(uv version --package markdown-this --short)"
5858
git push origin main --tags
5959
```
6060

61-
Create the GitHub release from that tag. The `cd.yml` workflow verifies the
62-
matching package version, builds only that package, and publishes it to PyPI.
63-
Use the same commands with `md-to-telegraph` or `lobstergram` as the package
64-
name. The tag format is `<package>-v<version>`.
61+
Create the GitHub release from that tag. The matching publishing workflow
62+
verifies the package version, builds only that package, and publishes it to
63+
PyPI. The reusable packages have separate Trusted Publisher workflows:
64+
`publish-md-to-telegraph.yml` publishes `md-to-telegraph`, and
65+
`publish-markdown-this.yml` publishes `markdown-this`. The `lobstersgram`
66+
application is not published to PyPI yet.
67+
68+
Use the same commands with `md-to-telegraph` as the package name. The tag
69+
format is `<package>-v<version>`.
6570

6671
---
6772

@@ -107,7 +112,7 @@ All secrets are stored securely in GitHub Actions.
107112

108113
To register subscribers:
109114
- Send `/start` to the bot from the Telegram account or group you want to receive posts.
110-
- Run the workflow once (or run `uv run lobstergram --read-messages`) to record the
115+
- Run the workflow once (or run `uv run lobstersgram --read-messages`) to record the
111116
`chat_id` values into `subscribers.json`.
112117

113118
For local development, you can set `TELEGRAM_DEV_CHAT_ID` to force all sends
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# url-to-markdown
1+
# markdown-this
22

3-
[![PyPI](https://img.shields.io/pypi/v/url-to-markdown)](https://pypi.org/project/url-to-markdown/)
3+
[![PyPI](https://img.shields.io/pypi/v/markdown-this)](https://pypi.org/project/markdown-this/)
44

55
Extract the readable content of a URL and convert it to Markdown. The package
66
also handles GitHub repositories and Markdown files through the GitHub API,
@@ -9,13 +9,13 @@ and arXiv abstract pages through their HTML representation.
99
## Installation
1010

1111
```bash
12-
uv add url-to-markdown
12+
uv add markdown-this
1313
```
1414

1515
## Usage
1616

1717
```python
18-
from url_to_markdown import extract_main_content
18+
from markdown_this import extract_main_content
1919

2020
title, markdown, fallback_text, intro = extract_main_content(
2121
"https://example.com/article"
@@ -31,8 +31,8 @@ package modules when an application needs more control over the pipeline.
3131
## Development
3232

3333
```bash
34-
uv run pytest packages/url-to-markdown/tests
35-
uv run ruff check packages/url-to-markdown
34+
uv run pytest packages/markdown-this/tests
35+
uv run ruff check packages/markdown-this
3636
```
3737

3838
## License

0 commit comments

Comments
 (0)