Skip to content

Commit

Permalink
Merge branch 'pr-label-workflow' into test-pr-label-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
yut23 committed Nov 12, 2024
2 parents bb3aa6b + 5a233bb commit 159e04e
Show file tree
Hide file tree
Showing 228 changed files with 6,312 additions and 1,695 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ ec8bb45ea1603f3862041fa9e8ec274afd9bbbfd

# migration: black -> ruff-format
3214662dc7d53f7ac56b3589c5a27ef075f83ab4

# auto upgrade syntax from Python 3.9 to 3.10
e86625e780b77a42aedad711e5a9a945ce650974
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
version: 2
updates:
- package-ecosystem: pip
directory: /requirements
schedule:
interval: monthly
groups:
actions:
patterns:
- '*'

- package-ecosystem: github-actions
directory: /.github/workflows
schedule:
Expand Down
13 changes: 0 additions & 13 deletions .github/mergeable.yml

This file was deleted.

9 changes: 4 additions & 5 deletions .github/workflows/bleeding-edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
# the '-dev' suffix allows to use pre-releases if no final release is available yet
# this version should be upgraded as often as possible, typically once a year when
# Cython, numpy and matplotlib are known to be compatible
python-version: '3.12-dev'
python-version: '3.13-dev'

- name: Install dependencies
# PyYAML needs to be installed in isolation for now, because of a known
Expand All @@ -50,9 +50,9 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
python -m pip install --pre --only-binary ":all:" numpy matplotlib \
python -m pip install --pre --only-binary ":all:" numpy matplotlib Cython \
--extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
python -m pip install --pre ewah-bool-utils Cython
python -m pip install --pre ewah-bool-utils
python -m pip install git+https://github.com/yt-project/unyt.git
python -m pip install --pre pytest PyYAML
Expand All @@ -61,8 +61,7 @@ jobs:
# are not installed by pip as specified from pyproject.toml, hence we get
# to use the dev version of numpy at build time.
run: |
python setup.py build_ext -q -j2
python -m pip install -e .[test] --no-build-isolation
python -m pip -v install -e .[test] --no-build-isolation
- run: python -m pip list

Expand Down
57 changes: 42 additions & 15 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,51 @@ jobs:
# run all tests even if e.g. image tests fail early
fail-fast: false
matrix:
os: [
macos-latest,
windows-latest,
ubuntu-latest,
]
python-version: ['3.12']
os:
- ubuntu-latest
- macos-latest
python-version: ['3.13']
dependencies: [full]
tests-type: [unit]
test-runner: [pytest]
venv-loc: [bin]
include:
- os: windows-latest
python-version: '3.13'
dependencies: full
tests-type: unit
test-runner: pytest
venv-loc: Scripts
- os: ubuntu-20.04
python-version: '3.9.2'
python-version: '3.10.3'
dependencies: minimal
tests-type: unit
test-runner: pytest
venv-loc: bin
- os: ubuntu-latest
# this job is necessary for non-answer, 'yield' based tests
# because pytest doesn't support such tests, and nose is not
# compatible with Python 3.10
python-version: '3.9'
# because pytest doesn't support such tests
python-version: '3.10'
dependencies: full
tests-type: unit
test-runner: nose
venv-loc: bin
- os: ubuntu-latest
# answer tests use 'yield', so they require nose
# they are also attached to a specific, occasionally updated, Python version
# but it does *not* have to match the current minimal supported version
python-version: '3.9'
python-version: '3.10'
dependencies: full
tests-type: answer
test-runner: nose
venv-loc: bin
- os: ubuntu-latest
# minimal tests with latest Python and no optional dependencies
python-version: '3.x'
dependencies: ''
tests-type: unit
test-runner: pytest
venv-loc: bin

runs-on: ${{ matrix.os }}

Expand All @@ -84,15 +92,34 @@ jobs:
shell: bash
env:
dependencies: ${{ matrix.dependencies }}
run: source ./tests/ci_install.sh
run: |
python -m venv .venv
source .venv/${{matrix.venv-loc}}/activate
source ./tests/ci_install.sh
- name: Install and patch nosetest
if: matrix.test-runner == 'nose'
run: |
source .venv/${{matrix.venv-loc}}/activate
python -m pip install -r nose_requirements.txt
find .venv/lib/python${{matrix.python-version}}/site-packages/nose -name '*.py' \
-exec sed -i -e s/collections.Callable/collections.abc.Callable/g '{}' ';'
- name: Show final env
run: |
source .venv/${{matrix.venv-loc}}/activate
python -m pip list
- run: python -m pip list
- name: Run Unit Tests (pytest)
if: matrix.test-runner == 'pytest'
run: pytest --color=yes
run: |
source .venv/${{matrix.venv-loc}}/activate
pytest --color=yes
- name: Run Tests (nose)
if: matrix.test-runner == 'nose'
run: cat nose_ignores.txt | xargs python -m nose -c nose_unit.cfg --traverse-namespace
run: |
source .venv/${{matrix.venv-loc}}/activate
cat nose_ignores.txt | xargs python -m nose -c nose_unit.cfg --traverse-namespace
image-tests:
name: Image tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
# based on https://stackoverflow.com/a/75036059 and
# https://github.com/astropy/astropy/blob/main/.github/workflows/check_milestone.yml
name: Check PR labels
name: Check PR title and labels

on:
# So it cannot be skipped.
pull_request_target:
types: [opened, synchronize, labeled, unlabeled]
types: [opened, edited, synchronize, labeled, unlabeled]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
check-title:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
if (/^\[?WIP\b/i.test(context.payload.pull_request.title)) {
core.setFailed("WIP pull requests can't be merged.");
}
check-labels:
runs-on: ubuntu-latest
steps:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/type-checking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
pull_request:
paths:
- yt/**/*.py
- setup.cfg
- pyproject.toml
- requirements/typecheck.txt
- .github/workflows/type-checking.yaml
workflow_dispatch:

Expand All @@ -32,12 +33,12 @@ jobs:
# run with oldest supported python version
# so that we always get compatible versions of
# core dependencies at type-check time
python-version: '3.9'
python-version: '3.10'

- name: Build
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -e .[typecheck]
python3 -m pip install -e . -r requirements/typecheck.txt
- run: python -m pip list

Expand Down
38 changes: 21 additions & 17 deletions .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- MANIFEST.in
workflow_dispatch:


jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
Expand All @@ -21,7 +22,7 @@ jobs:
matrix:
os: [
ubuntu-20.04,
windows-2019,
windows-2022,
macos-13, # x86_64
macos-14, # arm64
]
Expand All @@ -32,18 +33,9 @@ jobs:
uses: actions/checkout@v4

- name: Build wheels for CPython
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.21.3
with:
output-dir: dist
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
CIBW_SKIP: "*-musllinux_*" # numpy doesn't have wheels for musllinux so we can't build some quickly and without bloating
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: auto
MACOSX_DEPLOYMENT_TARGET: "10.9" # as of CIBW 2.9, this is the default value, pin it so it can't be bumped silently
CIBW_ARCHS_WINDOWS: auto64
CIBW_ENVIRONMENT: "LDFLAGS='-static-libstdc++'"
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v4
with:
Expand All @@ -57,9 +49,22 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Build sdist
run: pipx run build --sdist

- name: Test sdist
run: |
python -m pip install "$(echo dist/*.tar.gz)[test]"
python -m pip list
project_dir=$(pwd)
cd ../../
pytest -c $project_dir/pyproject.toml --rootdir . --color=yes --pyargs yt
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
Expand All @@ -77,7 +82,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: install check-manifest
run: |
python -m pip install --upgrade pip
Expand All @@ -87,10 +92,9 @@ jobs:

# keep in sync with pyproject.toml
run: |
python -m pip install "Cython>=3.0.3, <3.1"
python -m pip install numpy>=1.25
python -m pip install ewah-bool-utils>=1.0.2
python -m pip install --upgrade wheel
python -m pip install Cython>=3.0.3
python -m pip install numpy>=2.0.0
python -m pip install ewah-bool-utils>=1.2.0
python -m pip install --upgrade setuptools
- name: build yt
shell: bash
Expand Down Expand Up @@ -120,7 +124,7 @@ jobs:
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@v1.11.0
with:
user: __token__
password: ${{ secrets.pypi_token }}
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -30,27 +30,28 @@ repos:
# TODO: replace this with ruff when it supports embedded python blocks
# see https://github.com/astral-sh/ruff/issues/8237
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==24.3.0]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.0
rev: v0.7.2
hooks:
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [--fix, "--show-fixes"]
args: [
--fix,
--show-fixes,
]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks

- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.16.0
rev: v0.16.2
hooks:
- id: cython-lint
args: [--no-pycodestyle]
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ For all types of contributions, it is required that all tests pass, or that all
future. (See :ref:`testing`)
* At a minimum, a minimal, self-contained example demonstrating the bug should
because included in the body of the Pull Request, or as part of an
indepedent issue.
independent issue.

When submitting, you will be asked to make sure that your changes meet all of
these requirements. They are pretty easy to meet, and we're also happy to help
Expand Down
Loading

0 comments on commit 159e04e

Please sign in to comment.