Skip to content

Typing and release supply chain sec, - #20

Merged
Carreau merged 6 commits into
ipython:mainfrom
Carreau:typing-and-release
Dec 3, 2026
Merged

Carreau merged 6 commits into
ipython:mainfrom
Carreau:typing-and-release

Conversation

@Carreau

@Carreau Carreau commented Dec 3, 2026

Copy link
Copy Markdown
Member

Helped by claude.

I will likely make a minor relase soon.

Carreau and others added 6 commits December 3, 2026 14:48
Turn the module into a package so it can ship py.typed (PEP 561),
annotate the public API, and run mypy in strict mode.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The traceback lexers no longer read a `python3` option and always use
IPython3Lexer, so drop the references to Python 2.x/3.x selection.

Also:
- describe in1_regex/in2_regex/out_regex as strings (they are rstrip'd
  and compiled, so compiled patterns or None never worked)
- say what IPythonTracebackLexer actually delegates to
- reword the IPyLexer summary, which is not registered with Pygments
- fix typos (IPythonCOnsoleLexer, "or and")

Docstrings and comments only; no behaviour change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Declare the license as the SPDX expression BSD-3-Clause with
license-files, which needs flit_core >= 3.12. Drop the License :: trove
classifier, which PEP 639 deprecates alongside a license expression.
The built metadata now has License-Expression: BSD-3-Clause.

Also fix the module header, which pointed to a nonexistent COPYING.txt,
to match LICENSE (BSD 3-Clause, 2012-Present).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The dependency had no lower bound, although the module does not even
import on old Pygments (Python2Lexer is missing in 2.4). Require 2.14
(January 2023), the first version that emits Token.Text.Whitespace
where the tests expect it, and drop the pre-2.14 shim in the tests.

Add a CI job that runs the tests on Python 3.11 with pygments==2.14.0
so the floor stays accurate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Only version-like tags (e.g. 1.2.0, 1.2.0rc1) trigger the workflow
  on tag push, so a stray tag no longer publishes to PyPI.
- New build job: fails on a tag that does not match __version__,
  builds the sdist and wheel, runs the test suite against the
  installed wheel (not the source tree), and uploads dist/ as an
  artifact. It runs on every push and PR, so packaging breakage
  shows up before a release.
- The publish job now only downloads the artifact and uploads it, so
  the build no longer runs with id-token: write.
- Publish runs in a "pypi" GitHub environment, so it can be gated by
  required reviewers or tag rules. PyPI's trusted publisher for this
  project has no environment configured, so it accepts this as is.
  The workflow file name (test.yml) is unchanged on purpose: the
  trusted publisher is bound to it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PyPI trusted publishing trusts a workflow by file name. test.yml also
runs on pull requests, branch pushes and manual dispatch, and is the
file contributors and Dependabot edit most, so publishing now lives in
publish.yml, which only runs for version tags.

publish.yml calls test.yml as a reusable workflow (lint, tests, the
tag/__version__ check, building and testing the wheel), then uploads
that same build from its own top-level job in the "pypi" environment.
The upload has to stay in the top-level workflow: PyPI does not accept
trusted-publishing uploads from inside a called workflow.

test.yml gains a workflow_call trigger and loses its tag trigger and
publish job.

PyPI action needed after merge: add a GitHub trusted publisher with
workflow publish.yml and environment pypi, then remove the old
test.yml publisher.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Carreau
Carreau merged commit 7c43517 into ipython:main Dec 3, 2026
10 checks passed
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.

1 participant