Skip to content

Commit

Permalink
use meson
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Dec 7, 2024
1 parent f304dd7 commit 61573c1
Show file tree
Hide file tree
Showing 25 changed files with 323 additions and 940 deletions.
8 changes: 4 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ _site-packages-to-src-mapping =
*\Lib\site-packages

[report]
fail_under = 98.95
skip_covered = true
skip_empty = true
fail_under = 98.69
show_missing = true
exclude_also =
^\s*@pytest\.mark\.xfail

[run]
branch = true
cover_pylib = false
cover_pylib = true
# https://coverage.rtfd.io/en/latest/contexts.html#dynamic-contexts
# dynamic_context = test_function # conflicts with `pytest-cov` if set here
parallel = true
Expand All @@ -31,3 +29,5 @@ source =
.
source_pkgs =
yarl
omit =
patch_source.py
5 changes: 1 addition & 4 deletions .github/workflows/aiohttp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ jobs:
cache-dependency-path: requirements/*.txt
- name: Provision the dev env
run: make .develop
- name: Cythonize yarl
working-directory: vendor/yarl
run: make cythonize
- name: Install yarl
working-directory: vendor/yarl
run: >-
python -m pip install -e .
python -m pip install .
- name: Run tests
run: python -m pytest
shell: bash
Expand Down
117 changes: 80 additions & 37 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Build sdists and pure-python wheel
env:
PIP_CONSTRAINT: requirements/cython.txt
run: python -Im build --config-setting=pure-python=true
run: python -Im build --config-setting=setup-args=-Dpure-python=enabled
- name: Determine actual created filenames
id: dist-filenames-detection
run: >-
Expand Down Expand Up @@ -165,15 +165,6 @@ jobs:
source-tarball-name: >-
${{ needs.build-pure-python-dists.outputs.sdist-filename }}
dists-artifact-name: ${{ needs.pre-setup.outputs.dists-artifact-name }}
cython-tracing: >- # Cython line tracing for coverage collection
${{
(
github.event_name == 'push'
&& contains(github.ref, 'refs/tags/')
)
&& 'false'
|| 'true'
}}

test:
name: Test
Expand All @@ -184,23 +175,16 @@ jobs:
strategy:
matrix:
pyver:
- 3.13
- 3.12
- 3.11
- >-
3.10
- 3.9
no-extensions: ['', 'Y']
- '3.13'
- '3.12'
- '3.11'
- '3.10'
- '3.9'
os:
- ubuntu-latest
- macos-latest
- windows-latest
experimental: [false]
exclude:
- os: macos-latest
no-extensions: Y
- os: windows-latest
no-extensions: Y
include:
- pyver: pypy-3.10
no-extensions: Y
Expand Down Expand Up @@ -282,21 +266,6 @@ jobs:
shell: bash
- name: Self-install
run: python -Im pip install '${{ steps.wheel-file.outputs.path }}'
- name: Produce the C-files for the Coverage.py Cython plugin
if: >- # Only works if the dists were built with line tracing
!matrix.no-extensions
&& (
github.event_name != 'push'
|| !contains(github.ref, 'refs/tags/')
)
env:
PYTHONPATH: packaging/
run: |
set -eEuo pipefail
python -Im pip install expandvars
python -m pep517_backend.cli translate-cython
shell: bash
- name: Disable the Cython.Coverage Produce plugin
if: >- # Only works if the dists were built with line tracing
matrix.no-extensions
Expand Down Expand Up @@ -357,6 +326,80 @@ jobs:
Py-${{ steps.python-install.outputs.python-version }}
fail_ci_if_error: true

test-pyx-cov:
name: test-pyx-cov
strategy:
matrix:
pyver:
- '3.13'
- '3.12'
- '3.11'
- '3.10'
- '3.9'
os:
- ubuntu-latest
- macos-latest
- windows-latest
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 5
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.pyver }}
id: python-install
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyver }}
allow-prereleases: true
cache: pip
cache-dependency-path: requirements/*.txt
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements/test.txt

- run: |
meson setup build -Ddebug=true
meson compile -C build --verbose
ninja -C build copy
shell: bash
- name: Run unittests
run: >-
python -m
pytest
-v
--cov-report xml
--junitxml=.test-results/pytest/test.xml
- name: Produce markdown test summary from JUnit
if: >-
!cancelled()
uses: test-summary/action@v2.4
with:
paths: .test-results/pytest/test.xml
- name: Append coverage results to Job Summary
if: >-
!cancelled()
continue-on-error: true
run: >-
python -Im coverage report --format=markdown
>> "${GITHUB_STEP_SUMMARY}"
shell: bash
- name: Send coverage data to Codecov
if: >-
!cancelled()
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: >-
CI-GHA,
pytest,
OS-${{ runner.os }},
VM-${{ matrix.os }},
Py-${{ steps.python-install.outputs.python-version }}
fail_ci_if_error: true

benchmark:
name: Benchmark
needs:
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/reusable-build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ on:
description: Workflow artifact name containing dists
required: true
type: string
cython-tracing:
description: Whether to build Cython modules with line tracing
default: '0'
required: false
type: string
os:
description: VM OS to use, without version suffix
default: ubuntu
Expand Down Expand Up @@ -58,6 +53,12 @@ jobs:
source-tarball-name: ${{ inputs.source-tarball-name }}
workflow-artifact-name: ${{ inputs.dists-artifact-name }}

- name: Install the latest version of uv
if: ${{ runner.os != 'Linux' }}
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up QEMU
if: inputs.qemu
uses: docker/setup-qemu-action@v3
Expand All @@ -72,6 +73,18 @@ jobs:
echo "CIBW_ARCHS_LINUX=${{ inputs.qemu }}" >> "${GITHUB_ENV}"
shell: bash

- name: Restore cached Primes
if: ${{ runner.os != 'Linux' }}
id: cache
uses: actions/cache@v4
with:
path: |
~\AppData\Local\pypa\cibuildwheel\Cache
~/Library/Caches/cibuildwheel
~/.cache/cibuildwheel
key: "cibuildwheel-${{ runner.os }}"


- name: Skip building some wheel tags
if: inputs.wheel-tags-to-skip
run: |
Expand All @@ -82,9 +95,9 @@ jobs:
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
CIBW_CONFIG_SETTINGS: >- # Cython line tracing for coverage collection
pure-python=false
with-cython-tracing=${{ inputs.cython-tracing }}
# Cython line tracing for coverage collection
CIBW_CONFIG_SETTINGS: >-
setup-args=-Dpure-python=disabled
- name: Upload built artifacts for testing and publishing
uses: actions/upload-artifact@v4
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/reusable-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ jobs:
- name: Self-install
run: |
pip install .
- name: Run linters
run: |
make lint
- uses: pre-commit/action@v3.0.1
# - name: Run linters
# run: |
# make lint
- name: Send coverage data to Codecov
uses: codecov/codecov-action@v5
with:
Expand All @@ -81,7 +82,7 @@ jobs:
- name: Prepare twine checker
run: |
pip install -U build twine
python -m build --config-setting=pure-python=true
python -m build --config-setting=setup-args=-Dpure-python=enabled
- name: Run twine checker
run: |
twine check --strict dist/*
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ var/
*.egg-info/
.installed.cfg
*.egg
taskfile.yaml
.vscode/

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
1 change: 0 additions & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ python_version = 3.8
color_output = true
error_summary = true
files =
packaging/,
tests/,
yarl/

Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build:
post_create_environment:
- >-
pip install .
--config-settings=pure-python=true
--config-settings=setup-args=-Dpure-python=enabled
python:
install:
Expand Down
Loading

0 comments on commit 61573c1

Please sign in to comment.