Skip to content

Commit

Permalink
Merge pull request #146 from googlefonts/python-standards
Browse files Browse the repository at this point in the history
Use new Python package approach
  • Loading branch information
simoncozens authored May 1, 2024
2 parents 61b3e5f + c624a59 commit e75e874
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 119 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand All @@ -69,12 +69,12 @@ jobs:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/[email protected].11
uses: pypa/[email protected].14
with:
# repository-url: https://test.pypi.org/legacy/ # for testing purposes
verify-metadata: false # twine previously didn't verify metadata when uploading
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages
run: |
pip install '.[dev]'
pip install black pylint
- name: Check formatting
run: |
black --diff --check Lib --exclude ".*_pb2.*|_version.py"
- name: Run Tests
run: |
pytest tests
29 changes: 0 additions & 29 deletions .github/workflows/tox.yml

This file was deleted.

33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[build-system]
requires = [
"setuptools>=45",
"setuptools_scm[toml]>=6.2"
]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["Lib"]

[tool.setuptools_scm]
git_describe_command = "git describe --match 'v*' --tags"

[project]
dynamic = ["version"]

name = "gflanguages"
description = "A python API for evaluating language support in the Google Fonts collection."
readme = "README.md"
authors = [
{ name = "Simon Cozens", email = "[email protected]" }
]

dependencies = [
"protobuf>=3.7.0, <4"
]

[project.optional-dependencies]
dev = [
"uharfbuzz",
"youseedee",
"pytest"
]
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

61 changes: 0 additions & 61 deletions setup.py

This file was deleted.

23 changes: 0 additions & 23 deletions tox.ini

This file was deleted.

0 comments on commit e75e874

Please sign in to comment.