Skip to content

Commit

Permalink
Update xcookie CI
Browse files Browse the repository at this point in the history
Update type annotations

Update setup for 311

wip

Fixup path ref

Update test requirements for 311

Forgot to bump version number

Update CCI

More verbosity in tests

wip

add docs got pyproject ignore

Does changing package_dir help?

readd keywords

Try to fix setup.py

Fix find-packages dir

wip

wip
  • Loading branch information
Erotemic committed Jan 29, 2023
1 parent fe624a7 commit c97a5a3
Show file tree
Hide file tree
Showing 21 changed files with 329 additions and 234 deletions.
32 changes: 18 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,17 @@ jobs:
name: run tests
command: |
. venv/bin/activate
ls
$PYTHON_EXE -m pip freeze
$PYTHON_EXE run_tests.py
# Upload to codecov.io (requires a CODECOV_TOKEN environ or github+circleci integration)
codecov
- store_artifacts:
path: test-reports
destination: test-reports
- store_artifacts:
path: .coverage
destination: .coverage
#codecov
#- store_artifacts:
# path: test-reports
# destination: test-reports
#- store_artifacts:
# path: .coverage
# destination: .coverage


.test_full_template: &test_full_template
Expand Down Expand Up @@ -160,15 +162,17 @@ jobs:
name: run tests
command: |
. venv/bin/activate
ls
$PYTHON_EXE -m pip freeze
$PYTHON_EXE run_tests.py
# Upload to codecov.io (requires a CODECOV_TOKEN environ or github+circleci integration)
codecov
- store_artifacts:
path: test-reports
destination: test-reports
- store_artifacts:
path: .coverage
destination: .coverage
#codecov
#- store_artifacts:
# path: test-reports
# destination: test-reports
#- store_artifacts:
# path: .coverage
# destination: .coverage


###################################
Expand Down
120 changes: 79 additions & 41 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Based on ~/code/xcookie/xcookie/rc/tests.yml.in
# Now based on ~/code/xcookie/xcookie/builders/github_actions.py

name: PurePy Build and Test
name: PurePyCI

on:
push:
Expand All @@ -16,10 +16,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.11 for linting
uses: actions/setup-python@v4.5.0
with:
python-version: 3.8
python-version: '3.11'
- name: Install dependencies
run: |-
python -m pip install --upgrade pip
Expand All @@ -34,15 +34,15 @@ jobs:
mypy --install-types --non-interactive ./src/xdoctest
mypy ./src/xdoctest
build_and_test_sdist:
name: Test sdist Python 3.8
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4.5.0
with:
python-version: 3.8
python-version: '3.11'
- name: Upgrade pip
run: |-
python -m pip install --upgrade pip
Expand All @@ -57,7 +57,7 @@ jobs:
- name: Install sdist
run: |-
ls -al ./wheelhouse
pip install wheelhouse/xdoctest*.tar.gz -v
pip install --prefer-binary wheelhouse/xdoctest*.tar.gz -v
- name: Test minimal loose sdist
run: |-
pwd
Expand Down Expand Up @@ -92,9 +92,48 @@ jobs:
with:
name: wheels
path: ./wheelhouse/*.tar.gz
build_and_test_purepy_wheels:
build_purepy_wheels:
name: ${{ matrix.python-version }} on ${{ matrix.os }}, arch=${{ matrix.arch }} with ${{ matrix.install-extras }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- '3.11'
arch:
- auto
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: runner.os == 'Linux' && matrix.arch != 'auto'
with:
platforms: all
- name: Setup Python
uses: actions/setup-python@v4.5.0
with:
python-version: ${{ matrix.python-version }}
- name: Build pure wheel
shell: bash
run: |-
python -m pip install pip -U
python -m pip install setuptools>=0.8 build
python -m build --wheel --outdir wheelhouse
- name: Show built files
shell: bash
run: ls -la wheelhouse
- uses: actions/upload-artifact@v3
name: Upload wheels artifact
with:
name: wheels
path: ./wheelhouse/xdoctest*.whl
test_purepy_wheels:
name: ${{ matrix.python-version }} on ${{ matrix.os }}, arch=${{ matrix.arch }} with ${{ matrix.install-extras }}
runs-on: ${{ matrix.os }}
needs:
- build_purepy_wheels
strategy:
matrix:
include:
Expand Down Expand Up @@ -219,12 +258,12 @@ jobs:
uses: actions/checkout@v3
- name: Enable MSVC 64bit
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest' && matrix.cibw_skip == '*-win32'
- name: Enable MSVC 32bit
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest' && matrix.cibw_skip == '*-win_amd64'
with:
arch: x86
if: matrix.os == 'windows-latest' # && ${{ contains(matrix.cibw_skip, '*-win32') }}
#- name: Enable MSVC 32bit
# uses: ilammy/msvc-dev-cmd@v1
# if: matrix.os == 'windows-latest' && ${{ contains(matrix.cibw_skip, '*-win_amd64') }}
# with:
# arch: x86
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: runner.os == 'Linux' && matrix.arch != 'auto'
Expand All @@ -234,49 +273,51 @@ jobs:
uses: actions/setup-python@v4.5.0
with:
python-version: ${{ matrix.python-version }}
- name: Build pure wheel
shell: bash
run: |-
python -m pip install pip -U
python -m pip install setuptools>=0.8 build
python -m build --wheel --outdir wheelhouse
- uses: actions/download-artifact@v3
name: Download wheels and sdist
with:
name: wheels
path: wheelhouse
- name: Test wheel with ${{ matrix.install-extras }}
shell: bash
env:
INSTALL_EXTRAS: ${{ matrix.install-extras }}
CI_PYTHON_VERSION: py${{ matrix.python-version }}
run: |-
# Find the path to the wheel
ls wheelhouse
echo "Finding the path to the wheel"
ls -al wheelhouse
echo "Installing helpers"
pip install tomli pkginfo
MOD_NAME=xdoctest
echo "MOD_NAME=$MOD_NAME"
WHEEL_FPATH=$(python -c "import pathlib; print(str(sorted(pathlib.Path('wheelhouse').glob('$MOD_NAME*.whl'))[-1]).replace(chr(92), chr(47)))")
echo "WHEEL_FPATH=$WHEEL_FPATH"
MOD_VERSION=$(python -c "from pkginfo import Wheel; print(Wheel('$WHEEL_FPATH').version)")
echo "MOD_VERSION=$MOD_VERSION"
# Install the wheel (ensure we are using the version we just built)
echo "Install the wheel (ensureing we are using the version we just built)"
# NOTE: THE VERSION MUST BE NEWER THAN AN EXISTING PYPI VERSION OR THIS MAY FAIL
pip install "$MOD_NAME[$INSTALL_EXTRAS]==$MOD_VERSION" -f wheelhouse
# Create a sandboxed directory
pip install --prefer-binary "$MOD_NAME[$INSTALL_EXTRAS]==$MOD_VERSION" -f wheelhouse
echo "Install finished. Creating a sandbox directory to test it"
WORKSPACE_DNAME="testdir_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}"
echo "WORKSPACE_DNAME=$WORKSPACE_DNAME"
mkdir -p $WORKSPACE_DNAME
echo "cd-ing into the workspace"
cd $WORKSPACE_DNAME
pwd
ls -al
pip freeze
# Get the path to the installed package and run the tests
MOD_DPATH=$(python -c "import xdoctest, os; print(os.path.dirname(xdoctest.__file__))")
echo "MOD_DPATH = $MOD_DPATH"
echo "running the pytest command inside the workspace"
python -m pytest -p pytester -p no:doctest --xdoctest --cov-config ../pyproject.toml --cov-report term --cov="$MOD_NAME" "$MOD_DPATH" ../tests
echo "pytest command finished, moving the coverage file to the repo root"
ls -al
# Move coverage file to a new name
mv .coverage "../.coverage.$WORKSPACE_DNAME"
echo "changing directory back to th repo root"
cd ..
- name: Show built files
shell: bash
run: ls -la wheelhouse
- name: Set up Python 3.8 to combine coverage Linux
uses: actions/setup-python@v4.5.0
if: runner.os == 'Linux'
with:
python-version: 3.8
ls -al
- name: Combine coverage Linux
if: runner.os == 'Linux'
run: |-
Expand All @@ -295,18 +336,14 @@ jobs:
name: Codecov Upload
with:
file: ./tests/coverage.xml
- uses: actions/upload-artifact@v3
name: Upload wheels artifact
with:
name: wheels
path: ./wheelhouse/xdoctest*.whl
test_deploy:
name: Uploading Test to PyPi
runs-on: ubuntu-latest
if: github.event_name == 'push' && ! startsWith(github.event.ref, 'refs/tags') && ! startsWith(github.event.ref, 'refs/heads/release')
needs:
- build_and_test_sdist
- build_and_test_purepy_wheels
- build_purepy_wheels
- test_purepy_wheels
steps:
- name: Checkout source
uses: actions/checkout@v3
Expand Down Expand Up @@ -349,7 +386,8 @@ jobs:
if: github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags') || startsWith(github.event.ref, 'refs/heads/release'))
needs:
- build_and_test_sdist
- build_and_test_purepy_wheels
- build_purepy_wheels
- test_purepy_wheels
steps:
- name: Checkout source
uses: actions/checkout@v3
Expand Down Expand Up @@ -405,4 +443,4 @@ jobs:
# --secret=EROTEMIC_TWINE_USERNAME=$EROTEMIC_TWINE_USERNAME \
# --secret=EROTEMIC_CI_SECRET=$EROTEMIC_CI_SECRET \
# --secret=EROTEMIC_TEST_TWINE_USERNAME=$EROTEMIC_TEST_TWINE_USERNAME \
# --secret=EROTEMIC_TEST_TWINE_PASSWORD=$EROTEMIC_TEST_TWINE_PASSWORD
# --secret=EROTEMIC_TEST_TWINE_PASSWORD=$EROTEMIC_TEST_TWINE_PASSWORD
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Changed

* Binary tests are now only run on "full" installs to reduce minimal dependencies.
* Support for Python 3.11
* Minor typing fixes


## Version 1.1.0 - Released 2022-09-05
Expand Down
3 changes: 2 additions & 1 deletion dev/port_ubelt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def _autogen_xdoctest_utils():
'''
# -*- coding: utf-8 -*-
"""
This file was autogenerated based on code in ubelt
This file was autogenerated based on code in ubelt via
dev/port_ubelt_utils.py in the xdoctest repo
"""
from __future__ import print_function, division, absolute_import, unicode_literals
''')
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ description = "A rewrite of the builtin doctest module"
url = "https://github.com/Erotemic/xdoctest"
license = "Apache 2"
dev_status = "stable"
typed = true
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -29,6 +30,7 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
# Supported Python versions
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.8",
Expand All @@ -38,6 +40,9 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
]

[tool.xcookie.setuptools]
keywords = '"xdoctest,doctest,test,docstr,pytest"'

[tool.xcookie.entry_points]
# the pytest11 entry point makes the plugin available to pytest
pytest11 = [
Expand All @@ -50,8 +55,8 @@ console_scripts = [


[tool.pytest.ini_options]
addopts = "-p no:doctest --xdoctest --xdoctest-style=google --ignore-glob=setup.py --ignore-glob=dev"
norecursedirs = ".git ignore build __pycache__ dev _skbuild"
addopts = "-p no:doctest --xdoctest --xdoctest-style=google --ignore-glob=setup.py --ignore-glob=dev --ignore-glob=docs"
norecursedirs = ".git ignore build __pycache__ dev _skbuild docs"
filterwarnings = [ "default", "ignore:.*No cfgstr given in Cacher constructor or call.*:Warning", "ignore:.*Define the __nice__ method for.*:Warning", "ignore:.*private pytest class or function.*:Warning",]

[tool.coverage.run]
Expand Down
16 changes: 12 additions & 4 deletions requirements/tests-binary.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# For testing doctests in binary extension modules
scikit-build>=0.11.1
cmake>=3.21.2
ninja>=1.10.2
pybind11>=2.7.1

scikit-build>=0.16.1 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+
scikit-build>=0.11.1 ; python_version < '3.11' # Python <=3.10

ninja>=1.11.1 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+
ninja>=1.10.2 ; python_version < '3.11' # Python <=3.10

pybind11>=2.10.3 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+
pybind11>=2.7.1 ; python_version < '3.11' # Python <=3.10

cmake>=3.25.0 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+
cmake>=3.21.2 ; python_version < '3.11' # Python <=3.10

0 comments on commit c97a5a3

Please sign in to comment.