From dfed5c0dd49c6d3a88bb609513d44367385581aa Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Thu, 16 May 2024 22:25:48 -0700 Subject: [PATCH] reenable macos --- .github/workflows/ci.yaml | 585 +++++++++++++++++++++----------------- argh.py | 52 ++++ 2 files changed, 369 insertions(+), 268 deletions(-) create mode 100644 argh.py diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e62bc675..166fcc72 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -57,28 +57,6 @@ jobs: python -m build -s . echo "artifact_name=$(ls ./dist)" >> "$GITHUB_OUTPUT" -# -# -# - name: Test sdist -# run: | -# # Install some libyaml headers. -# # TODO Should we smoke test the sdist against the libyaml we built? -# sudo apt update -# sudo apt install libyaml-dev -y -# -# mkdir distout && cd distout -# tar zxvf $(ls ../dist/*.tar.gz) -# python -m build -w ./pyyaml* -# -# # FIXME: smoketest the built wheel -# -# cd .. -# -# # Pass no extra args. -# # We should auto-install with libyaml since it's present. -# python -m pip install dist/*.tar.gz -v -# -# python packaging/build/smoketest.py - name: Upload sdist artifact uses: actions/upload-artifact@v4 @@ -88,67 +66,218 @@ jobs: if-no-files-found: error # always upload the sdist artifact- all the wheel build jobs require it - make_linux_libyaml_matrix: - runs-on: ubuntu-22.04 - outputs: - matrix_json: ${{ steps.make_matrix.outputs.matrix_json }} - steps: - - uses: actions/checkout@v4 - - name: make a matrix - id: make_matrix - uses: ./.github/actions/dynamatrix - with: - matrix_yaml: | - include: - - { platform: manylinux1, arch: x86_64 } - - { platform: manylinux2014, arch: x86_64 } - - { platform: manylinux2014, arch: aarch64, omit: ${{ env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: s390x, omit: ${{ env.skip_slow_jobs }} } - - { platform: musllinux_1_1, arch: x86_64 } - - { platform: musllinux_1_1, arch: aarch64, omit: ${{ env.skip_slow_jobs }} } +# make_linux_libyaml_matrix: +# runs-on: ubuntu-22.04 +# outputs: +# matrix_json: ${{ steps.make_matrix.outputs.matrix_json }} +# steps: +# - uses: actions/checkout@v4 +# - name: make a matrix +# id: make_matrix +# uses: ./.github/actions/dynamatrix +# with: +# matrix_yaml: | +# include: +# - { platform: manylinux1, arch: x86_64 } +# - { platform: manylinux2014, arch: x86_64 } +# - { platform: manylinux2014, arch: aarch64, omit: ${{ env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: s390x, omit: ${{ env.skip_slow_jobs }} } +# - { platform: musllinux_1_1, arch: x86_64 } +# - { platform: musllinux_1_1, arch: aarch64, omit: ${{ env.skip_slow_jobs }} } +# +# linux_libyaml: +# needs: [make_linux_libyaml_matrix] +# name: libyaml ${{ matrix.platform }} ${{ matrix.arch }} +# runs-on: ubuntu-22.04 +# strategy: +# fail-fast: false +# matrix: ${{ fromJSON(needs.make_linux_libyaml_matrix.outputs.matrix_json) }} +# env: +# DOCKER_IMAGE: quay.io/pypa/${{ matrix.platform }}_${{ matrix.arch }} +# steps: +# - name: Check cached libyaml state +# id: cached_libyaml +# uses: actions/cache@v4 +# with: +# path: libyaml +# key: libyaml_${{ matrix.platform }}_${{ matrix.arch }}_${{ env.LIBYAML_REF }} +# +# - name: configure docker foreign arch support +# uses: docker/setup-qemu-action@v3 +# if: matrix.arch != 'x86_64' && steps.cached_libyaml.outputs.cache-hit != 'true' +# +# - name: Checkout pyyaml +# uses: actions/checkout@v4 +# if: steps.cached_libyaml.outputs.cache-hit != 'true' +# +# - name: Build libyaml +# run: > +# docker run --rm +# --volume "$(pwd):/io" +# --env LIBYAML_REF +# --env LIBYAML_REPO +# --workdir /io +# "$DOCKER_IMAGE" +# /io/packaging/build/libyaml.sh +# if: steps.cached_libyaml.outputs.cache-hit != 'true' +# +# - name: ensure output is world readable (or cache fill fails with Permission Denied) +# run: > +# sudo chmod -R a+r ./libyaml/ +# if: steps.cached_libyaml.outputs.cache-hit != 'true' +# +# make_linux_pyyaml_matrix: +# runs-on: ubuntu-22.04 +# outputs: +# matrix_json: ${{ steps.make_matrix.outputs.matrix_json }} +# steps: +# - uses: actions/checkout@v4 +# - name: make a matrix +# id: make_matrix +# uses: ./.github/actions/dynamatrix +# with: +# matrix_yaml: | +# include: +# - { platform: manylinux1, arch: x86_64, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: manylinux1, arch: x86_64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: manylinux2014, arch: x86_64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: manylinux2014, arch: x86_64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: manylinux2014, arch: x86_64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: manylinux2014, arch: x86_64, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip" } +# - { platform: manylinux2014, arch: aarch64, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: aarch64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: aarch64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: aarch64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: aarch64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: aarch64, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip", omit: ${{ env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: s390x, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: s390x, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: s390x, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: s390x, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: s390x, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: manylinux2014, arch: s390x, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip", omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: musllinux_1_1, arch: x86_64, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: musllinux_1_1, arch: x86_64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: musllinux_1_1, arch: x86_64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: musllinux_1_1, arch: x86_64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: musllinux_1_1, arch: x86_64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs }} } +# - { platform: musllinux_1_1, arch: x86_64, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip", omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: musllinux_1_1, arch: aarch64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: musllinux_1_1, arch: aarch64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: musllinux_1_1, arch: aarch64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: musllinux_1_1, arch: aarch64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } +# - { platform: musllinux_1_1, arch: aarch64, spec: cp313 } # , omit: ${{ env.skip_slow_jobs }} } +# +# +# linux_pyyaml: +# needs: [python_sdist, linux_libyaml, make_linux_pyyaml_matrix] +# name: pyyaml ${{matrix.spec}}-${{matrix.platform}}_${{matrix.arch}} +# runs-on: ubuntu-22.04 +# strategy: +# fail-fast: false +# matrix: ${{ fromJSON(needs.make_linux_pyyaml_matrix.outputs.matrix_json) }} +# +# steps: +# - name: fetch sdist artifact +# id: fetch_sdist +# uses: actions/download-artifact@v4 +# with: +# name: ${{ needs.build_sdist.outputs.artifact_name }} +# +# - name: Fetch cached libyaml +# id: cached_libyaml +# uses: actions/cache/restore@v4 +# with: +# path: libyaml +# key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}} +# fail-on-cache-miss: true +# +# - name: configure docker foreign arch support +# uses: docker/setup-qemu-action@v3 +# if: matrix.arch != 'x86_64' +# +# - name: Build/Test/Package +# env: +# CIBW_ARCHS: all +# # HACK: ick, maybe deconstruct the matrix a bit or query cibuildwheel for its default target *linux spec first? +# CIBW_BUILD: ${{matrix.spec}}-${{ contains(matrix.platform, 'musllinux') && 'musllinux' || 'manylinux' }}_${{matrix.arch}} +# CIBW_BUILD_VERBOSITY: 1 +# # containerized Linux builds require explicit CIBW_ENVIRONMENT +# CIBW_ENVIRONMENT: > +# LD_LIBRARY_PATH=../libyaml/src/.libs +# PYYAML_FORCE_CYTHON=1 +# PYYAML_FORCE_LIBYAML=1 +# CIBW_PRERELEASE_PYTHONS: 1 +# CIBW_TEST_COMMAND: cd {project}; pytest +# CIBW_TEST_REQUIRES: pytest +# run: | +# set -eux +# +# python3 -V +# python3 -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }} +# +# mkdir pyyaml +# +# tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/pyyaml*.tar.gz/pyyaml*.tar.gz --strip-components=1 -C pyyaml +# +# cat << 'EOF' > build_config.toml +# [tool.cibuildwheel.config-settings] +# pyyaml_build_config='{"force":1, "library_dirs": ["../libyaml/src/.libs"], "include_dirs": ["../libyaml/include"]}' +# EOF +# +# CIBW_BEFORE_BUILD="ls -l {project}" python3 -m cibuildwheel --config-file $(pwd)/build_config.toml --platform auto --output-dir ./dist ./pyyaml +# +# echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT" +# # FIXME: ensure exactly one artifact +# +# - name: Upload artifacts +# uses: actions/upload-artifact@v4 +# with: +# name: ${{ steps.build.outputs.artifact_name }} +# path: dist/*.whl +# if-no-files-found: error +# if: ${{ ! env.skip_artifact_upload }} - linux_libyaml: - needs: [make_linux_libyaml_matrix] - name: libyaml ${{ matrix.platform }} ${{ matrix.arch }} - runs-on: ubuntu-22.04 + + macos_libyaml: + name: libyaml macos ${{matrix.arch}} strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.make_linux_libyaml_matrix.outputs.matrix_json) }} - env: - DOCKER_IMAGE: quay.io/pypa/${{ matrix.platform }}_${{ matrix.arch }} + matrix: + include: + - arch: x86_64 + runs-on: macos-13 + run_wrapper: arch -x86_64 bash --noprofile --norc -eo pipefail {0} + - arch: arm64 + deployment_target: '11.0' + run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} + defaults: + run: + shell: ${{ matrix.run_wrapper || 'arch -x86_64 bash --noprofile --norc -eo pipefail {0}' }} + runs-on: ${{ matrix.runs-on || 'macos-14' }} steps: - name: Check cached libyaml state id: cached_libyaml uses: actions/cache@v4 with: path: libyaml - key: libyaml_${{ matrix.platform }}_${{ matrix.arch }}_${{ env.LIBYAML_REF }} + key: libyaml_macos_${{matrix.arch}}_${{env.LIBYAML_REF}} - - name: configure docker foreign arch support - uses: docker/setup-qemu-action@v3 - if: matrix.arch != 'x86_64' && steps.cached_libyaml.outputs.cache-hit != 'true' - - - name: Checkout pyyaml + - name: Checkout PyYAML uses: actions/checkout@v4 if: steps.cached_libyaml.outputs.cache-hit != 'true' - name: Build libyaml - run: > - docker run --rm - --volume "$(pwd):/io" - --env LIBYAML_REF - --env LIBYAML_REPO - --workdir /io - "$DOCKER_IMAGE" - /io/packaging/build/libyaml.sh - if: steps.cached_libyaml.outputs.cache-hit != 'true' - - - name: ensure output is world readable (or cache fill fails with Permission Denied) - run: > - sudo chmod -R a+r ./libyaml/ + env: + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }} + SDKROOT: ${{ matrix.sdkroot || 'macosx' }} + run: | + set -eux + brew install automake coreutils m4 libtool + bash ./packaging/build/libyaml.sh + echo "finished artifact arch is $(lipo -archs libyaml/src/.libs/libyaml.a)" if: steps.cached_libyaml.outputs.cache-hit != 'true' - make_linux_pyyaml_matrix: + make_macos_pyyaml_matrix: runs-on: ubuntu-22.04 outputs: matrix_json: ${{ steps.make_matrix.outputs.matrix_json }} @@ -160,87 +289,110 @@ jobs: with: matrix_yaml: | include: - - { platform: manylinux1, arch: x86_64, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: manylinux1, arch: x86_64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: manylinux2014, arch: x86_64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: manylinux2014, arch: x86_64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: manylinux2014, arch: x86_64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: manylinux2014, arch: x86_64, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip" } - - { platform: manylinux2014, arch: aarch64, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: aarch64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: aarch64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: aarch64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: aarch64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: aarch64, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip", omit: ${{ env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: s390x, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: s390x, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: s390x, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: s390x, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: s390x, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: manylinux2014, arch: s390x, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip", omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: musllinux_1_1, arch: x86_64, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: musllinux_1_1, arch: x86_64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: musllinux_1_1, arch: x86_64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: musllinux_1_1, arch: x86_64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: musllinux_1_1, arch: x86_64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs }} } - - { platform: musllinux_1_1, arch: x86_64, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip", omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: musllinux_1_1, arch: aarch64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: musllinux_1_1, arch: aarch64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: musllinux_1_1, arch: aarch64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: musllinux_1_1, arch: aarch64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} } - - { platform: musllinux_1_1, arch: aarch64, spec: cp313, cibw_version: "https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip", omit: ${{ env.skip_slow_jobs }} } - + - spec: cp38-macosx_x86_64 + cibw_version: cibuildwheel==2.11.1 + runs_on: [macos-13] + # omit: ${{ env.skip_ci_redundant_jobs }} + - spec: cp39-macosx_x86_64 + runs_on: [macos-13] + omit: ${{ env.skip_ci_redundant_jobs }} + - spec: cp310-macosx_x86_64 + runs_on: [macos-13] + omit: ${{ env.skip_ci_redundant_jobs }} + - spec: cp311-macosx_x86_64 + runs_on: [macos-13] + omit: ${{ env.skip_ci_redundant_jobs }} + - spec: cp312-macosx_x86_64 + runs_on: [macos-13] + omit: ${{ env.skip_ci_redundant_jobs }} + - spec: cp313-macosx_x86_64 + # cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip + runs_on: [macos-13] + # omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp39-macosx_arm64 + deployment_target: '11.0' + arch: arm64 + # omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp310-macosx_arm64 + deployment_target: '11.0' + arch: arm64 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp311-macosx_arm64 + deployment_target: '11.0' + arch: arm64 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp312-macosx_arm64 + deployment_target: '11.0' + arch: arm64 + omit: ${{ env.skip_ci_redundant_jobs }} + + - spec: cp313-macosx_arm64 + deployment_target: '11.0' + arch: arm64 + - linux_pyyaml: - needs: [python_sdist, linux_libyaml, make_linux_pyyaml_matrix] - name: pyyaml ${{matrix.spec}}-${{matrix.platform}}_${{matrix.arch}} - runs-on: ubuntu-22.04 + macos_pyyaml: + needs: [python_sdist, macos_libyaml, make_macos_pyyaml_matrix] + name: pyyaml ${{ matrix.spec }} + runs-on: ${{ matrix.runs_on || 'macos-14' }} + defaults: + run: + shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }} strategy: fail-fast: false - matrix: ${{ fromJSON(needs.make_linux_pyyaml_matrix.outputs.matrix_json) }} - + matrix: ${{ fromJSON(needs.make_macos_pyyaml_matrix.outputs.matrix_json) }} steps: -# - name: Checkout PyYAML -# uses: actions/checkout@v4 - name: fetch sdist artifact id: fetch_sdist uses: actions/download-artifact@v4 with: name: ${{ needs.build_sdist.outputs.artifact_name }} - - name: Fetch cached libyaml + - name: Get cached libyaml state id: cached_libyaml uses: actions/cache/restore@v4 with: path: libyaml - key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}} + key: libyaml_macos_${{ matrix.arch || 'x86_64' }}_${{env.LIBYAML_REF}} fail-on-cache-miss: true - - name: configure docker foreign arch support - uses: docker/setup-qemu-action@v3 - if: matrix.arch != 'x86_64' + - name: Install python + uses: actions/setup-python@v5 + with: + python-version: '3.11' # as of 2024-05, this has to be < 3.12 since the macos-13 runner image's + # built-in virtualenv/pip are pinned to busted versions that fail on newer Pythons - name: Build/Test/Package env: - CIBW_ARCHS: all - # HACK: ick, maybe deconstruct the matrix a bit or query cibuildwheel for its default target *linux spec first? - CIBW_BUILD: ${{matrix.spec}}-${{ contains(matrix.platform, 'musllinux') && 'musllinux' || 'manylinux' }}_${{matrix.arch}} + C_INCLUDE_PATH: ../libyaml/include + CIBW_BUILD: ${{matrix.spec}} CIBW_BUILD_VERBOSITY: 1 - # containerized Linux builds require explicit CIBW_ENVIRONMENT - CIBW_ENVIRONMENT: > - LD_LIBRARY_PATH=libyaml/src/.libs - PYYAML_FORCE_CYTHON=1 - PYYAML_FORCE_LIBYAML=1 - CIBW_CONFIG_SETTINGS: | - pyyaml_build_config={"force":1, "library_dirs": ["libyaml/src/.libs"], "include_dirs": ["libyaml/include"]} - CIBW_TEST_COMMAND: cd {project}; pytest + CIBW_PRERELEASE_PYTHONS: 1 + CIBW_TEST_COMMAND: pytest {package} CIBW_TEST_REQUIRES: pytest + LIBRARY_PATH: ../libyaml/src/.libs + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }} + PYYAML_FORCE_CYTHON: 1 + PYYAML_FORCE_LIBYAML: 1 + SDKROOT: ${{ matrix.sdkroot || 'macosx' }} run: | set -eux - python3 -V python3 -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }} - CIBW_BEFORE_BUILD="cp -r /host$(pwd)/libyaml {project} && ls -l {project}" python3 -m cibuildwheel --platform auto --output-dir ./dist ${{ steps.fetch_sdist.outputs.download-path }}/pyyaml*.tar.gz/pyyaml*.tar.gz + mkdir pyyaml + + tar zxf pyyaml*.tar.gz/pyyaml*.tar.gz --strip-components=1 -C pyyaml + + cat << 'EOF' > build_config.toml + [tool.cibuildwheel.config-settings] + pyyaml_build_config='{"force":1, "library_dirs": ["../libyaml/src/.libs"], "include_dirs": ["../libyaml/include"]}' + EOF + + python3 -m cibuildwheel --config-file $(pwd)/build_config.toml --platform auto --output-dir ./dist ./pyyaml echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT" # FIXME: ensure exactly one artifact @@ -253,133 +405,6 @@ jobs: if-no-files-found: error if: ${{ ! env.skip_artifact_upload }} -# -# macos_libyaml: -# name: libyaml macos ${{matrix.arch}} -# strategy: -# matrix: -# include: -# - arch: x86_64 -# runs-on: macos-13 -# - arch: arm64 -# deployment_target: '11.0' -# run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} -# defaults: -# run: -# shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }} -# runs-on: ${{ matrix.runs_on || 'macos-14' }} -# steps: -# - name: Check cached libyaml state -# id: cached_libyaml -# uses: actions/cache@v4 -# with: -# path: libyaml -# key: libyaml_macos_${{matrix.arch}}_${{env.LIBYAML_REF}} -# -# - name: Checkout PyYAML -# uses: actions/checkout@v4 -# if: steps.cached_libyaml.outputs.cache-hit != 'true' -# -# - name: Build libyaml -# env: -# MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }} -# SDKROOT: ${{ matrix.sdkroot || 'macosx' }} -# run: | -# set -eux -# brew install automake coreutils m4 -# bash ./packaging/build/libyaml.sh -# echo "finished artifact arch is $(lipo -archs libyaml/src/.libs/libyaml.a)" -# if: steps.cached_libyaml.outputs.cache-hit != 'true' -# -# -# macos_pyyaml: -# needs: macos_libyaml -# name: pyyaml ${{ matrix.spec }} -# runs-on: ${{ matrix.runs_on || 'macos-14' }} -# defaults: -# run: -# shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }} -# strategy: -# matrix: -# include: -# - spec: cp38-macosx_x86_64 -# cibw_version: cibuildwheel==2.11.1 -# runs_on: [macos-13] -# - spec: cp39-macosx_x86_64 -# runs_on: [macos-13] -## - spec: cp310-macosx_x86_64 -## runs_on: [macos-13] -## - spec: cp311-macosx_x86_64 -## runs_on: [macos-13] -## - spec: cp312-macosx_x86_64 -## runs_on: [macos-13] -# - spec: cp313-macosx_x86_64 -# cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip -# runs_on: [macos-13] -# -# # build for arm64 under a hacked macOS 12 self-hosted x86_64-on-arm64 runner until arm64 is fully supported -# - spec: cp39-macosx_arm64 -# deployment_target: '11.0' -# arch: arm64 -# run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} -# -# - spec: cp310-macosx_arm64 -# deployment_target: '11.0' -# arch: arm64 -# run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} -# -# - spec: cp311-macosx_arm64 -# deployment_target: '11.0' -# arch: arm64 -# run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} -# -# - spec: cp312-macosx_arm64 -# deployment_target: '11.0' -# arch: arm64 -# run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} -# -# - spec: cp313-macosx_arm64 -# deployment_target: '11.0' -# arch: arm64 -# run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0} -# cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip -# -# steps: -# - name: Checkout PyYAML -# uses: actions/checkout@v4 -# -# - name: Get cached libyaml state -# id: cached_libyaml -# uses: actions/cache/restore@v4 -# with: -# path: libyaml -# key: libyaml_macos_${{ matrix.arch || 'x86_64' }}_${{env.LIBYAML_REF}} -# fail-on-cache-miss: true -# -# - name: Build/Test/Package -# env: -# C_INCLUDE_PATH: libyaml/include -# CIBW_BUILD: ${{matrix.spec}} -# CIBW_BUILD_VERBOSITY: 1 -# CIBW_TEST_COMMAND: cd {project}; pytest -# CIBW_TEST_REQUIRES: pytest -# LIBRARY_PATH: libyaml/src/.libs -# MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }} -# PYYAML_FORCE_CYTHON: 1 -# PYYAML_FORCE_LIBYAML: 1 -# SDKROOT: ${{ matrix.sdkroot || 'macosx' }} -# run: | -# python3 -V -# python3 -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }} -# python3 -m cibuildwheel --platform auto --output-dir dist . -# -# - name: Upload artifacts -# uses: actions/upload-artifact@v3 -# with: -# name: dist -# path: dist/*.whl -# if-no-files-found: error -# if: ${{ ! env.skip_artifact_upload }} # # windows_libyaml: # name: libyaml windows ${{ matrix.arch }} @@ -432,7 +457,7 @@ jobs: # matrix_yaml: | # include: # - spec: cp38-win_amd64 -# # omit: ${{ env.skip_ci_redundant_jobs }} +# omit: ${{ env.skip_ci_redundant_jobs }} # # - spec: cp39-win_amd64 # omit: ${{ env.skip_ci_redundant_jobs }} @@ -447,7 +472,6 @@ jobs: # omit: ${{ env.skip_ci_redundant_jobs }} # # - spec: cp313-win_amd64 -# cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip # # - spec: cp38-win32 # omit: ${{ env.skip_ci_redundant_jobs }} @@ -465,8 +489,7 @@ jobs: # omit: ${{ env.skip_ci_redundant_jobs }} # # - spec: cp313-win32 -# cibw_version: https://github.com/nitzmahone/cibuildwheel/archive/refs/heads/py313_support.zip -# # omit: ${{ env.skip_ci_redundant_jobs }} +# omit: ${{ env.skip_ci_redundant_jobs }} # # windows_pyyaml: # needs: [python_sdist, windows_libyaml, make_windows_pyyaml_matrix] @@ -482,8 +505,11 @@ jobs: # git config --global core.autocrlf false # git config --global core.eol lf # -# - name: Checkout pyyaml -# uses: actions/checkout@v4 +# - name: fetch sdist artifact +# id: fetch_sdist +# uses: actions/download-artifact@v4 +# with: +# name: ${{ needs.build_sdist.outputs.artifact_name }} # # - name: Get cached libyaml state # id: cached_libyaml @@ -504,35 +530,58 @@ jobs: # env: # CIBW_BUILD: ${{matrix.spec}} # CIBW_BUILD_VERBOSITY: 1 -# CIBW_TEST_COMMAND: pytest {project}/tests +# CIBW_BEFORE_TEST: ls -l {package} +# CIBW_TEST_COMMAND: pytest {package} # CIBW_TEST_REQUIRES: pytest -# CIBW_CONFIG_SETTINGS: | -# pyyaml_build_config='{"include_dirs": ["libyaml/include"], "library_dirs": ["libyaml/build/Release"], "define": [["YAML_DECLARE_STATIC", 1]], "force": 1}' +# CIBW_PRERELEASE_PYTHONS: 1 +# #CIBW_CONFIG_SETTINGS: | +# # pyyaml_build_config='{"include_dirs": ["libyaml/include"], "library_dirs": ["libyaml/build/Release"], "define": [["YAML_DECLARE_STATIC", 1]], "force": 1}' # run: | # set -eux # python -V # python -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }} -# python -m cibuildwheel --output-dir dist . -# echo "ARTIFACT_NAME=$(ls ./dist/)" >> "$GITHUB_OUTPUT" +# mkdir pyyaml +# +# tar zxf pyyaml*.tar.gz/pyyaml*.tar.gz --strip-components=1 -C pyyaml +# +# cat << 'EOF' > build_config.toml +# [tool.cibuildwheel.config-settings] +# pyyaml_build_config='{"force":1, "include_dirs": ["../libyaml/include"], "library_dirs": ["../libyaml/build/Release"], "define": [["YAML_DECLARE_STATIC", 1]], "force": 1}' +# EOF +# +# python3 -m cibuildwheel --config-file $(pwd)/build_config.toml --platform auto --output-dir ./dist ./pyyaml +# +# echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT" # # FIXME: ensure exactly one artifact # # - name: Upload artifacts # uses: actions/upload-artifact@v4 # with: -# name: ${{ steps.build.outputs.ARTIFACT_NAME }} +# name: ${{ steps.build.outputs.artifact_name }} # path: dist/*.whl # if-no-files-found: error # if: ${{ ! env.skip_artifact_upload }} -# FIXME: artifact combine job? + merge_artifacts: + needs: [python_sdist, macos_pyyaml] # FIXME: linux_pyyaml, windows_pyyaml + runs-on: ubuntu-22.04 + steps: + - name: merge all artifacts + uses: actions/upload-artifact/merge@v4 + with: + name: dist + delete-merged: true + if: ${{ ! env.skip_artifact_upload }} + # # check: # if: always() # needs: -# - sdist -# - linux -# - macos -# - windows +# - python_sdist +# - linux_pyyaml +# - macos_pyyaml +# - windows_pyyaml +# - merge_artifacts # runs-on: ubuntu-latest # steps: # - name: Verify all previous jobs succeeded (provides a single check to sample for gating purposes) diff --git a/argh.py b/argh.py new file mode 100644 index 00000000..abc18f0a --- /dev/null +++ b/argh.py @@ -0,0 +1,52 @@ +import typing as t + + +class MyMarker: + markerhowdy: str = "yo" + + +T = t.TypeVar('T') +T_co = t.TypeVar('T_co', covariant=True) +C = t.TypeVar('C') +R = t.TypeVar('R') +P = t.ParamSpec('P') + + +class Configer(t.Protocol): + config: t.ClassVar[t.Callable[..., t.Self]] + + +class Thing(Configer): + config: + @classmethod + def thingclassmethod(cls): + pass + + +indent: int | None = None, mode: str | None = None + +# +# +# class CommonDumperConfig(t.Protocol): +# @classmethod +# def __call__(cls: t.Callable[..., R], indent: int | None = None, mode: str | None = None) -> type[R]: ... +# +# +# class Configurable(t.Generic[C]): +# config: C +# +# @classmethod +# def _do_config(cls, *args, **kwargs): +# return cls +# +# def __init_subclass__(cls, **kwargs): +# cls.config = cls._do_config +# +# +# class Real(Configurable[CommonDumperConfig]): +# @classmethod +# def arealmethod(cls): +# print(f"hi from a method on {cls=}") +# +# +# Real.config() \ No newline at end of file