-
Notifications
You must be signed in to change notification settings - Fork 18
Package ttx-diff as a standalone PyPI package #1717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
272d3d5
Move ttx_diff.py to package structure
anthrotype 30b3f64
add python packaging scaffolding for standalone ttx-diff command
anthrotype 3ed4b02
allow to run from anywhere, pass/find precompiled binaries
anthrotype 8d81e2e
add skeleton of tests/
anthrotype baccb18
add minimalist ttx-diff CI/CD github workflow
anthrotype db6901e
run ruff format and check --fix
anthrotype cf722dc
reference ttx-diff's deps in requirements.in, but keep fontmake/gftoo…
anthrotype 3197c4b
rust.yml: don't run Rust CI if only changes are in python-related files
anthrotype 924a949
Add PyPI badge to ttx-diff README.md
anthrotype 05cd026
allow running ttx_diff module as python -m ttx_diff
anthrotype 44d6928
fontc_crater: change all invocations of ttx_diff.py to -m ttx_diff
anthrotype 8751847
add default instructions to README.md for making a release
anthrotype 989b0d2
minor cosmetic changes to README
anthrotype 98a6ac9
temporarily disable python 3.14 because gftools wants too old pygit2
anthrotype 6b4f333
fix absolute path in requirement.in/txt
anthrotype File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| name: ttx-diff CI/CD | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'ttx_diff/**' | ||
| - '.github/workflows/python.yml' | ||
| tags: | ||
| - 'ttx-diff-v*' | ||
| pull_request: | ||
| paths: | ||
| - 'ttx_diff/**' | ||
| - '.github/workflows/python.yml' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest] | ||
| python-version: ['3.10', '3.13'] | ||
| # TODO: Re-enable 3.14 once gftools updates pygit2 pin from 1.16.0 | ||
| # https://github.com/googlefonts/gftools/blob/d4c06f5d88e0a849fabf7089d80835a96dc42f30/pyproject.toml#L47-L49 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install package with test dependencies | ||
| working-directory: ttx_diff | ||
| run: pip install -e ".[test]" | ||
|
|
||
| - name: Run tests | ||
| working-directory: ttx_diff | ||
| run: pytest -v | ||
|
|
||
| lint: | ||
| name: Lint and format check | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.13" | ||
|
|
||
| - name: Check package builds | ||
| working-directory: ttx_diff | ||
| run: pipx run build | ||
|
|
||
| - name: Install package with dev dependencies | ||
| working-directory: ttx_diff | ||
| run: pip install --find-links=dist 'ttx-diff[dev]' | ||
|
|
||
| - name: Check formatting with ruff | ||
| working-directory: ttx_diff | ||
| run: ruff format --check src/ tests/ | ||
|
|
||
| - name: Lint with ruff | ||
| working-directory: ttx_diff | ||
| run: ruff check src/ tests/ | ||
|
|
||
| build: | ||
| name: Build distribution | ||
| runs-on: ubuntu-latest | ||
| needs: [test, lint] | ||
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/ttx-diff-v') | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.x" | ||
|
|
||
| - name: Build package | ||
| working-directory: ttx_diff | ||
| run: pipx run build | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| path: ttx_diff/dist/ | ||
|
|
||
| publish-pypi: | ||
| name: Publish to PyPI | ||
| runs-on: ubuntu-latest | ||
| needs: [build] | ||
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/ttx-diff-v') | ||
| permissions: | ||
| id-token: write # Required for trusted publishing | ||
|
|
||
| steps: | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: dist/ | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| packages-dir: dist/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,10 @@ | ||
| absl-py | ||
| # keep fontmake version pinned to ensure output from ttx_diff.py is stable; | ||
| # ttx-diff package with all its dependencies (single source of truth) | ||
| -e file:./ttx_diff | ||
|
|
||
| # Pin versions for CI stability (overrides ttx-diff's minimum versions) | ||
| # keep fontmake version pinned to ensure output from ttx-diff is stable; | ||
| # the 'repacker' option enables faster GSUB/GPOS serialization via uharfbuzz | ||
| fontmake[repacker]==3.11.0 | ||
| # technically fonttools is in turn a dependency of fontmake but a few of | ||
| # our scripts import it directly, so we list it among the top-level requirements. | ||
| fonttools | ||
| lxml | ||
| cdifflib | ||
| glyphsLib | ||
| # keep gftools pinned as well to ensure ttx_diff.py output is stable. | ||
| # keep gftools pinned as well to ensure ttx-diff output is stable. | ||
| # 0.9.74 is when experimental support for fontc was added to gftools. | ||
| gftools==0.9.93 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just ttx-diff, people should install it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wanted to avoid fontc_crater falling into a trap of invoking a random ttx-diff on PATH. The previous code was calling python3 with the script path. This is the equivalent, to ensure it runs the ttx_diff installed within the same environment as
python3itself.