Skip to content

Commit 903a342

Browse files
cx-lukas-salkauskas-xLukas Šalkauskas
authored andcommitted
modern tooling & ci gh actions
1 parent 59e8c8e commit 903a342

File tree

15 files changed

+2917
-138
lines changed

15 files changed

+2917
-138
lines changed

.flake8

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

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
name: Lint and Style Checks
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
enable-cache: true
24+
25+
- name: Set up Python
26+
run: uv python install 3.12
27+
28+
- name: Create virtual environment
29+
run: uv venv
30+
31+
- name: Install dependencies
32+
run: uv pip install ruff
33+
34+
- name: Run ruff linting
35+
run: uv run ruff check .
36+
37+
- name: Run ruff formatting check
38+
run: uv run ruff format --check .
39+
40+
test:
41+
name: Test Python ${{ matrix.python-version }}
42+
runs-on: ubuntu-latest
43+
needs: lint
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
48+
include:
49+
- python-version: "3.14"
50+
experimental: true
51+
continue-on-error: ${{ matrix.experimental || false }}
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Install uv
57+
uses: astral-sh/setup-uv@v4
58+
with:
59+
enable-cache: true
60+
cache-dependency-glob: "pyproject.toml"
61+
62+
- name: Set up Python ${{ matrix.python-version }}
63+
run: uv python install ${{ matrix.python-version }}
64+
65+
- name: Create virtual environment
66+
run: uv venv
67+
68+
- name: Install dependencies
69+
run: |
70+
uv pip install -e .
71+
uv pip install ruff pytest pytest-sugar pytest-cov pytest-asyncio
72+
73+
- name: Run linting
74+
run: |
75+
uv run ruff check .
76+
uv run ruff format --check .
77+
78+
- name: Run tests
79+
run: uv run pytest -v
80+
81+
- name: Upload coverage reports
82+
if: matrix.python-version == '3.12'
83+
uses: codecov/codecov-action@v4
84+
with:
85+
fail_ci_if_error: false

.github/workflows/publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: read
10+
id-token: write # Required for trusted publishing
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.12'
23+
cache: 'pip'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install build setuptools wheel twine
29+
30+
- name: Build package
31+
run: python -m build
32+
33+
- name: Publish package to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
user: __token__
37+
password: ${{ secrets.PYPI_API_TOKEN }}
38+
skip_existing: true

.gitignore

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pip-delete-this-directory.txt
3939

4040
# Unit test / coverage reports
4141
htmlcov/
42-
.tox/
42+
.pytest_cache/
4343
.coverage
4444
.coverage.*
4545
.cache
@@ -59,11 +59,10 @@ docs/_build/
5959

6060
# PyBuilder
6161
target/
62-
.travis.yml
62+
63+
# Virtual environments
6364
.venv/
64-
LICENSE
65-
Pipfile
66-
Pipfile.lock
67-
README.rst
68-
setup.py
69-
tox.ini
65+
venv/
66+
67+
# Ruff cache
68+
.ruff_cache/

.isort.cfg

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

.travis.yml

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

Makefile

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,50 @@
1+
.PHONY: help setup clean build release test lint format check install dev
2+
3+
help:
4+
@echo "Available commands:"
5+
@echo " make setup - Install dependencies with uv"
6+
@echo " make dev - Install development dependencies with uv"
7+
@echo " make clean - Remove build artifacts"
8+
@echo " make build - Build distribution packages"
9+
@echo " make release - Upload to PyPI"
10+
@echo " make test - Run tests with pytest"
11+
@echo " make lint - Run ruff linting"
12+
@echo " make format - Format code with ruff"
13+
@echo " make check - Run lint and format check"
14+
@echo " make install - Install package in editable mode"
15+
116
setup:
2-
pipenv install
17+
uv pip install -e .
18+
19+
dev:
20+
uv pip install -e ".[dev]"
321

422
clean:
5-
rm -rf dist build
23+
rm -rf dist build *.egg-info
24+
find . -type d -name __pycache__ -exec rm -rf {} +
25+
find . -type f -name "*.pyc" -delete
26+
find . -type f -name "*.pyo" -delete
27+
find . -type f -name "*.coverage" -delete
28+
rm -rf .pytest_cache .ruff_cache .venv
629

7-
build:
8-
pipenv run python3 setup.py sdist bdist_wheel
30+
build: clean
31+
uv build
932

10-
release:
11-
twine upload dist/*
33+
release: build
34+
uv publish
1235

1336
test:
14-
tox
15-
16-
black:
17-
pipenv run black --config black.toml .
18-
19-
isort:
20-
pipenv run isort --recursive --atomic .
37+
.venv/bin/pytest -v
2138

2239
lint:
23-
pipenv run flake8
40+
.venv/bin/ruff check .
41+
42+
format:
43+
.venv/bin/ruff format .
2444

25-
runall: black lint test clean build
45+
check:
46+
.venv/bin/ruff check .
47+
.venv/bin/ruff format --check .
2648

27-
rebuild: clean build
49+
install:
50+
uv pip install -e .

README.rst

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
InAppPy
22
=======
3-
|travis| |pypi| |downloads|
3+
|ci| |pypi| |downloads|
44

5-
.. |travis| image:: https://travis-ci.org/dotpot/InAppPy.svg?branch=master
6-
:target: https://travis-ci.org/dotpot/InAppPy
5+
.. |ci| image:: https://github.com/dotpot/InAppPy/actions/workflows/ci.yml/badge.svg
6+
:target: https://github.com/dotpot/InAppPy/actions/workflows/ci.yml
77
.. |pypi| image:: https://badge.fury.io/py/inapppy.svg
88
:target: https://badge.fury.io/py/inapppy
99
.. |downloads| image:: https://img.shields.io/pypi/dm/inapppy.svg
@@ -332,22 +332,57 @@ This is a separate operation that should be called after verification to handle
332332
10. Development
333333
===============
334334

335+
Prerequisites
336+
-------------
337+
338+
Install `uv <https://docs.astral.sh/uv/>`_ for fast Python package management:
339+
335340
.. code:: bash
336341
337-
# run checks and tests
338-
tox
342+
# macOS/Linux
343+
curl -LsSf https://astral.sh/uv/install.sh | sh
344+
345+
# Windows
346+
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
347+
348+
Setup and Testing
349+
-----------------
350+
351+
.. code:: bash
339352
340-
# setup project
341-
make setup
353+
# Install development dependencies
354+
make dev
342355
343-
# check for lint errors
356+
# Run linting checks
344357
make lint
345358
346-
# run tests
359+
# Format code with ruff
360+
make format
361+
362+
# Run both lint and format checks
363+
make check
364+
365+
# Run tests
347366
make test
348367
349-
# run black
350-
make black
368+
# Run tests with pytest directly
369+
uv run pytest -v
370+
371+
Available Make Commands
372+
-----------------------
373+
374+
.. code:: bash
375+
376+
make setup # Install dependencies with uv
377+
make dev # Install development dependencies with uv
378+
make clean # Remove build artifacts
379+
make build # Build distribution packages
380+
make release # Upload to PyPI
381+
make test # Run tests with pytest
382+
make lint # Run ruff linting
383+
make format # Format code with ruff
384+
make check # Run lint and format check
385+
make install # Install package in editable mode
351386
352387
11. Donate
353388
==========

black.toml

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

inapppy/appstore.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,4 @@ def verify_with_result(
213213
is_expired = self._check_subscription_expired(latest_receipt_info)
214214
is_cancelled = self._check_subscription_cancelled(latest_receipt_info)
215215

216-
return AppStoreVerificationResult(
217-
raw_response=api_response, is_expired=is_expired, is_cancelled=is_cancelled
218-
)
216+
return AppStoreVerificationResult(raw_response=api_response, is_expired=is_expired, is_cancelled=is_cancelled)

0 commit comments

Comments
 (0)