Skip to content

fix package detection #785

fix package detection

fix package detection #785

Workflow file for this run

name: CI
on:
push:
tags:
- 'v[0-9]*.[0-9]*.[0-9]*'
- 'v[0-9]*.[0-9]*.[0-9]*a[0-9]*'
- 'v[0-9]*.[0-9]*.[0-9]*b[0-9]*'
- 'v[0-9]*.[0-9]*.[0-9]*rc[0-9]*'
branches:
- master
- QCSchema_v1
pull_request:
branches:
- master
- QCSchema_v1
schedule:
- cron: "9 16 * * 1"
jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
pydantic-version: ["2"]
runs-on: [ubuntu-latest, windows-latest]
name: "🐍 ${{ matrix.python-version }} • ${{ matrix.pydantic-version }} • ${{ matrix.runs-on }}"
runs-on: ${{ matrix.runs-on }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout Code
uses: actions/checkout@v4
- name: Install pydantic for py314
if: false
# if: matrix.python-version == '3.14.0-rc.3'
run: pip install pydantic==2.12.0b1
- name: Install QCManyBody (3.12)
if: matrix.python-version == '3.12'
run: |
pip install qcmanybody
pip uninstall qcelemental -y
- name: Install QCElemental (full deps)
if: matrix.python-version != '3.10' && matrix.python-version != '3.12' && matrix.python-version != '3.14'
run: pip install '.[test,viz,align,standard]'
- name: Install QCElemental (min deps)
if: matrix.python-version == '3.10' || matrix.python-version == '3.12' || matrix.python-version == '3.14'
run: pip install '.[test]'
- name: Run tests
run: pytest -rws -v --cov=qcelemental --color=yes --cov-report=xml #-k "not pubchem_multiout_g"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
- name: QCSchema Examples Deploy
uses: JamesIves/github-pages-deploy-action@v4
#if: github.event_name == 'push' && github.repository == 'MolSSI/QCElemental' && ( startsWith( github.ref, 'refs/tags/' ) || github.ref == 'refs/heads/master' )
if: false
with:
branch: qcschema-examples
folder: qcelemental/tests/qcschema_instances
test_numpy_matrix:
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.12"
numpy-spec: "1.26.*"
strict-warnings: false
- python-version: "3.12"
numpy-spec: "2.3.*"
strict-warnings: false
- python-version: "3.12"
numpy-spec: "latest"
strict-warnings: true
name: "🐍 ${{ matrix.python-version }} • numpy ${{ matrix.numpy-spec }} • strict-warnings=${{ matrix.strict-warnings }} • ubuntu-latest"
runs-on: ubuntu-latest
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout Code
uses: actions/checkout@v4
- name: Install pinned NumPy
if: matrix.numpy-spec != 'latest'
run: pip install "numpy==${{ matrix.numpy-spec }}"
- name: Install current NumPy
if: matrix.numpy-spec == 'latest'
run: pip install -U numpy
- name: Install QCElemental test deps
run: pip install '.[test]'
- name: Show installed packages
run: |
pip list
python -c "import numpy as np; print(np.__version__)"
- name: Verify pinned NumPy version
if: matrix.numpy-spec != 'latest'
run: |
python - <<'PY'
import numpy as np
expected_spec = "${{ matrix.numpy-spec }}"
expected_prefix = expected_spec.removesuffix(".*") + "."
actual = np.__version__
print(f"Expected NumPy spec: {expected_spec}")
print(f"Installed NumPy: {actual}")
if not actual.startswith(expected_prefix):
raise SystemExit(
f"NumPy version mismatch: expected {expected_spec}, got {actual}"
)
PY
- name: Run tests
if: matrix.strict-warnings == false
run: pytest -rws -v --color=yes
- name: Run tests with warnings as errors
if: matrix.strict-warnings == true
run: pytest -rws -v --color=yes -k 'not ins_mol_var_models_models_molecule' -W error::FutureWarning -W error::DeprecationWarning
build_documentation:
needs: [test, test_numpy_matrix]
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
name: Set up Python
with:
python-version: "3.10"
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Install repo
run: pip install '.[docs]'
- name: Build Documentation
run: sphinx-build docs/ build/docs
# Decide where to deploy: dev/ for master, <tag>/ for tags
- name: Compute docs deploy target
id: target
shell: bash
run: |
set -euo pipefail
echo GITHUB_REF_TYPE ${GITHUB_REF_TYPE}
echo GITHUB_REF_NAME ${GITHUB_REF_NAME}
echo GITHUB_REF ${GITHUB_REF}
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
echo "target_folder=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
echo "version_label=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
elif [[ "${GITHUB_REF_NAME}" == "master" || "${GITHUB_REF_NAME}" == "verdocs" ]]; then
echo "target_folder=dev" >> "$GITHUB_OUTPUT"
echo "version_label=dev" >> "$GITHUB_OUTPUT"
elif [[ "${GITHUB_REF_NAME}" == "QCSchema_v1" ]]; then
echo "target_folder=v1" >> "$GITHUB_OUTPUT"
echo "version_label=v1" >> "$GITHUB_OUTPUT"
else
echo "target_folder=" >> "$GITHUB_OUTPUT"
echo "version_label=" >> "$GITHUB_OUTPUT"
fi
echo GITHUB_OUTPUT ${GITHUB_OUTPUT}
- name: GitHub Pages Deploy (versioned, keep old)
uses: JamesIves/github-pages-deploy-action@v4
if: github.event_name == 'push' && github.repository == 'MolSSI/QCElemental' && ( startsWith( github.ref, 'refs/tags/' ) || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/QCSchema_v1' )
with:
branch: gh-pages
folder: build/docs/
target-folder: ${{ steps.target.outputs.target_folder }}
clean: false
- name: Update versions.json
if: github.event_name == 'push' && github.repository == 'MolSSI/QCElemental' && ( startsWith( github.ref, 'refs/tags/' ) || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/QCSchema_v1' )
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_LABEL: ${{ steps.target.outputs.version_label }}
TARGET_FOLDER: ${{ steps.target.outputs.target_folder }}
run: |
set -euo pipefail
rm -rf _ghp
git clone --depth 1 --branch gh-pages "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" _ghp
cd _ghp
# Create versions.json if it doesn't exist yet
if [[ ! -f versions.json ]]; then
cat > versions.json <<'JSON'
[
{"label": "dev", "path": "dev/"},
{"label": "v1", "path": "v1/"},
{"label": "v0.30.2", "path": "v0.30.2/"}
]
JSON
fi
python - <<'PY'
import json, pathlib, os
p = pathlib.Path("versions.json")
data = json.loads(p.read_text())
pinned = [
{"label": "dev", "path": "dev/"},
{"label": "v1", "path": "v1/"},
{"label": "v0.30.2", "path": "v0.30.2/"},
{"label": "v0.50.0", "path": "v0.50.0/"},
{"label": "v0.50.1", "path": "v0.50.1/"},
]
lbl = os.environ.get("VERSION_LABEL", "")
tgt = os.environ.get("TARGET_FOLDER", "")
if lbl and lbl not in ("dev", "v1") and tgt:
pinned.insert(1, {"label": lbl, "path": tgt.rstrip("/") + "/"})
p.write_text(json.dumps(pinned, indent=2) + "\n")
PY
if ! git diff --quiet; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add versions.json
git commit -m "docs: update versions.json (${GITHUB_REF})"
git push origin gh-pages
fi