Skip to content

Publish to PyPI as conflens on release - #26

Merged
picaultj merged 3 commits into
mainfrom
feat/pypi-publish
Aug 14, 2026
Merged

Publish to PyPI as conflens on release#26
picaultj merged 3 commits into
mainfrom
feat/pypi-publish

Conversation

@picaultj

@picaultj picaultj commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

Sets up automatic PyPI publishing (integrated into the existing release automation), makes the pip-installed CLI pick up a local .env, and documents installation + configuration.

Packaging verified: uv build → wheel + sdist with every conflens submodule; installed into a clean Python 3.13 venv, conflens/conference-analyzer scripts work, imports resolve from site-packages, and the installed conflens boots the app (HTTP 200).

Publishing

  • pyproject.toml — distribution renamed to conflens (both names were free on PyPI). Import name + CLI unchanged; pip install conflens. uv.lock re-locked.
  • .github/workflows/release.yml — after the existing bump + tag, the same job runs uv build then uvx twine upload --skip-existing dist/* (__token__ / secrets.PYPI_API_TOKEN), gated on a released output so it only runs when a new version is cut. Publishing lives inside the release job because GITHUB_TOKEN-pushed tags don't trigger a separate tag-based workflow.

Environment variables (installed CLI)

conflens takes config three ways, in precedence order:

  1. Real environment variables (export ANTHROPIC_API_KEY=…) — always work.
  2. A .env in the directory you launch conflens from — loaded automatically.
  3. The in-app "API key" field — at runtime.

Fix: the old _load_env() called load_dotenv(), which searches from the installed package location, so a pip-installed conflens never picked up a .env in the user's working directory (only real env vars worked). Now it uses find_dotenv(usecwd=True) to search the working directory. Real env vars still take precedence over .env. OpenReview creds (OPENREVIEW_TOKEN, or OPENREVIEW_USERNAME + OPENREVIEW_PASSWORD) work the same way or via the in-GUI fields.

Docs

  • READMEpip install conflens quick start; a Configuration section explaining env var / .env-in-run-dir / in-app field (+ OpenReview); the PYPI_API_TOKEN secret under Releasing.
  • Badges — switched to PyPI stats (pypi version, pepy.tech downloads, pypi pyversions) in place of the GitHub release/downloads/static-python badges, mirroring BERTrend. (These render as "not found" until the first PyPI release populates them.)

Testing

  • Clean-installed the renamed wheel → conflens 0.1.13, conflens --help works.
  • New tests/test_cli.py: .env-from-cwd is loaded, no-.env is a no-op, real env var overrides .env.
  • release.yml valid YAML; steps: Bump → Build → Publish.
  • ruff clean · pytest 76 passed.

⚠️ One-time setup you must do

  1. Create a PyPI API token (account-scoped for the first upload since the project doesn't exist yet; narrow to conflens afterward).
  2. Add it as repo secret PYPI_API_TOKEN (Settings → Secrets and variables → Actions).

Then the next merged PR bumps the version and publishes conflens to PyPI automatically. (Happy to add a TestPyPI workflow_dispatch dry-run if you want to validate the token before the first real release.)

claude and others added 3 commits August 14, 2026 15:36
- pyproject: rename the distribution to `conflens` (import name/CLI unchanged),
  so `pip install conflens`; uv.lock re-locked.
- release.yml: after the existing version bump + tag, build (`uv build`) and
  publish to PyPI with twine (`__token__` + PYPI_API_TOKEN secret), gated on a
  `released` output so it only runs when a new version was actually cut.
  Publishing lives in the release job because GITHUB_TOKEN-pushed tags don't
  trigger a separate tag-based workflow. `--skip-existing` keeps re-runs safe.
- README: document `pip install conflens` and the PYPI_API_TOKEN secret.
- cli.py: load the .env from the current working directory via
  find_dotenv(usecwd=True). The old load_dotenv() searched from the installed
  package location, so a pip-installed `conflens` never picked up a .env next to
  where the user launched it (real env vars still work and take precedence).
- tests/test_cli.py: .env-from-cwd is loaded, no-.env is a no-op, and a real env
  var overrides .env.
- README: explain configuration (env var / .env in the run directory / in-app
  field, plus OpenReview creds) for the pip-installed CLI.
- README badges: switch to PyPI stats (pypi version, pepy downloads, pypi
  pyversions) in place of the GitHub release/downloads/static-python badges.
@picaultj
picaultj merged commit 36fffed into main Aug 14, 2026
2 of 4 checks passed
@picaultj
picaultj deleted the feat/pypi-publish branch August 14, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants