Skip to content

Commit b75aad5

Browse files
committed
Revisit GitHub Actions
1 parent 68d0a83 commit b75aad5

7 files changed

Lines changed: 123 additions & 110 deletions

File tree

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,63 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
1+
# Publishes the package to PyPI when a GitHub Release is *published*
32

43
name: Python Client - Publish to PyPI
54

65
on:
76
release:
8-
types: [created]
7+
types: [published]
8+
9+
permissions:
10+
contents: read
11+
12+
# Opt into Node.js 24 runtime for all JavaScript actions.
13+
# Remove once actions/checkout and actions/setup-python ship native Node.js 24 releases.
14+
env:
15+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
916

1017
jobs:
11-
deploy:
18+
test:
19+
name: "Test before publish"
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.14"
28+
cache: pip
29+
30+
- name: Install dependencies
31+
run: pip install -e ".[dev]"
1232

33+
- name: Test with pytest
34+
run: pytest
35+
36+
publish:
37+
name: "Build and publish to PyPI"
1338
runs-on: ubuntu-latest
39+
needs: test
40+
41+
environment: pypi
42+
permissions:
43+
id-token: write
1444

1545
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python
18-
uses: actions/setup-python@v2
19-
with:
20-
python-version: '3.x'
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
25-
- name: Build and publish
26-
env:
27-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29-
run: |
30-
python setup.py sdist bdist_wheel
31-
twine upload dist/*
46+
- uses: actions/checkout@v4
47+
48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version: "3.14"
51+
cache: pip
52+
53+
- name: Install build tools
54+
run: pip install build twine
55+
56+
- name: Build distribution
57+
run: python -m build
58+
59+
- name: Check distribution metadata
60+
run: twine check dist/*
61+
62+
- name: Publish to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/netlicensing-publish-testpypi.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,74 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41
name: Python Client - CI
52

63
on:
74
push:
8-
branches: [ master ]
5+
branches: [master]
96
pull_request:
10-
branches: [ master ]
7+
branches: [master]
118

12-
jobs:
13-
build:
9+
permissions:
10+
contents: read
1411

12+
# Opt into Node.js 24 runtime for all JavaScript actions.
13+
# Remove once actions/checkout, actions/setup-python and codecov-action
14+
# ship native Node.js 24 releases (currently scheduled for June 2026).
15+
env:
16+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
17+
18+
jobs:
19+
test:
20+
name: "Test · Python ${{ matrix.python-version }}"
1521
runs-on: ubuntu-latest
22+
1623
strategy:
24+
fail-fast: false
1725
matrix:
18-
python-version: [3.6, 3.7, 3.8]
26+
python-version: ["3.11", "3.12", "3.13", "3.14"]
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: "Set up Python ${{ matrix.python-version }}"
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
cache: pip
36+
37+
- name: Install dependencies
38+
run: pip install -e ".[dev]"
39+
40+
- name: Type-check (mypy)
41+
run: mypy
42+
43+
- name: Test with pytest
44+
run: pytest --cov-report=xml
45+
46+
- name: Upload coverage to Codecov
47+
if: matrix.python-version == '3.14'
48+
uses: codecov/codecov-action@v5
49+
with:
50+
token: ${{ secrets.CODECOV_TOKEN }}
51+
files: coverage.xml
52+
fail_ci_if_error: false
53+
54+
build:
55+
name: "Verify build"
56+
runs-on: ubuntu-latest
57+
needs: test
1958

2059
steps:
21-
- uses: actions/checkout@v2
22-
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
24-
with:
25-
python-version: ${{ matrix.python-version }}
26-
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install flake8 pytest
30-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31-
- name: Lint with flake8
32-
run: |
33-
# stop the build if there are Python syntax errors or undefined names
34-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37-
- name: Test with pytest
38-
run: |
39-
pytest
40-
- name: Upload Codecov
41-
run: |
42-
bash <(curl -s https://codecov.io/bash)
60+
- uses: actions/checkout@v4
61+
62+
- uses: actions/setup-python@v5
63+
with:
64+
python-version: "3.14"
65+
cache: pip
66+
67+
- name: Install build tools
68+
run: pip install build twine
69+
70+
- name: Build distribution
71+
run: python -m build
72+
73+
- name: Check distribution metadata
74+
run: twine check dist/*

.github/workflows/netlicensing-python-dependency.yml

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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
[![PyPI](https://img.shields.io/pypi/v/netlicensing-client.svg)](https://pypi.org/project/netlicensing-client/)
77
[![PyPI - Downloads](https://img.shields.io/pypi/dm/netlicensing-client)](https://pypistats.org/packages/netlicensing-client)
88
[![PyVer](https://img.shields.io/pypi/pyversions/netlicensing-client.svg)](https://pypi.org/project/netlicensing-client)
9-
[![codecov](https://codecov.io/gh/Labs64/NetLicensingClient-python/branch/master/graph/badge.svg)](https://codecov.io/gh/Labs64/NetLicensingClient-python)
9+
[![codecov](https://codecov.io/gh/Labs64/NetLicensingClient-python/graph/badge.svg?token=3J0585YLgO)](https://codecov.io/gh/Labs64/NetLicensingClient-python)
1010
<br>
1111
[![Apache License 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/Labs64/NetLicensingClient-python/blob/master/LICENSE)
1212
[![📖 Documentation](https://img.shields.io/badge/📖%20Documentation-Wiki-AB6543.svg)](https://netlicensing.io/wiki/restful-api)
1313
[![NetLicensing @ LinkedIn](https://img.shields.io/badge/NetLicensing-0077B5.svg?logo=LinkedIn)](https://www.linkedin.com/showcase/netlicensing)
1414

1515
Python client library for the [Labs64 NetLicensing](https://netlicensing.io) RESTful API.
1616

17-
Built on **Python 3.10+**, [httpx](https://www.python-httpx.org/) and [Pydantic v2](https://docs.pydantic.dev/).
17+
Built on **Python 3.11+**, [httpx](https://www.python-httpx.org/) and [Pydantic v2](https://docs.pydantic.dev/).
1818
Supports API-key and username/password authentication, automatic retries with exponential back-off,
1919
strongly-typed response models, and transparent pagination.
2020

pyproject.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "netlicensing-client"
77
version = "0.1.0"
88
description = "Python client library for the Labs64 NetLicensing RESTful API"
99
readme = "README.md"
10-
requires-python = ">=3.10"
10+
requires-python = ">=3.11"
1111
license = "Apache-2.0"
1212
authors = [{ name = "Labs64 NetLicensing", email = "info@netlicensing.io" }]
1313
keywords = [
@@ -24,10 +24,10 @@ classifiers = [
2424
"Operating System :: OS Independent",
2525
"Programming Language :: Python :: 3",
2626
"Programming Language :: Python :: 3 :: Only",
27-
"Programming Language :: Python :: 3.10",
2827
"Programming Language :: Python :: 3.11",
2928
"Programming Language :: Python :: 3.12",
3029
"Programming Language :: Python :: 3.13",
30+
"Programming Language :: Python :: 3.14",
3131
"Topic :: Software Development :: Libraries :: Python Modules",
3232
]
3333
dependencies = [
@@ -57,6 +57,9 @@ package-dir = { "" = "src" }
5757
[tool.setuptools.packages.find]
5858
where = ["src"]
5959

60+
[tool.setuptools.package-data]
61+
netlicensing = ["py.typed"]
62+
6063
[tool.pytest.ini_options]
6164
addopts = "-r fEsxXw -vv --cov=src/netlicensing --cov-report=term-missing"
6265
testpaths = ["tests"]
@@ -67,14 +70,14 @@ markers = [
6770

6871
[tool.black]
6972
line-length = 120
70-
target-version = ["py310"]
73+
target-version = ["py311"]
7174

7275
[tool.isort]
7376
profile = "black"
7477
line_length = 120
7578

7679
[tool.mypy]
77-
python_version = "3.10"
80+
python_version = "3.14"
7881
packages = ["netlicensing"]
7982
strict = true
8083
warn_unused_ignores = true

src/netlicensing/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)