Skip to content

Commit

Permalink
windows & poetry? (#328)
Browse files Browse the repository at this point in the history
* Update CI.yaml

* Update CI.yaml

* stuff

* update docs py

* docs
  • Loading branch information
loriab authored Oct 24, 2023
1 parent 6988a32 commit c8c4aa6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ on:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "9 16 * * 1"

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.9", "3.11", "3.12"]
pydantic-version: ["1", "2"]
runs-on: [ubuntu-latest, windows-latest]
exclude:
- runs-on: windows-latest
pydantic-version: "1"
name: "🐍 ${{ matrix.python-version }} • ${{ matrix.pydantic-version }} • ${{ matrix.runs-on }}"
runs-on: ${{ matrix.runs-on }}

steps:
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -30,9 +39,9 @@ jobs:
# ^ start of line, pydantic, optional spaces and > sign, capture the version, replace with ^{version}
# Should avoid also replacing the autodoc-pydantic spec later on.
- name: Sed replace pydantic on repo
if: matrix.pydantic-version == '1'
run: |
sed -i 's/^pydantic *= *">*= *\([0-9.]*\)"/pydantic = "^\1"/' pyproject.toml
if: matrix.pydantic-version == '1'
- name: Install repo with poetry (full deps)
if: matrix.python-version != '3.9'
run: poetry install --no-interaction --no-ansi --all-extras
Expand Down Expand Up @@ -62,7 +71,7 @@ jobs:
- uses: actions/setup-python@v4
name: Set up Python
with:
python-version: "3.7"
python-version: "3.10"
- name: Install poetry
run: pip install poetry
# Force pydantic 1.0 by modifying poetry dep "pydantic" string with in-place sed (see above for details)
Expand Down
6 changes: 5 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Changelog
.. +++++
Unreleased
0.27.0 / 2023-10-DD (Unreleased)
-------------------

Breaking Changes
Expand All @@ -40,11 +40,15 @@ Bug Fixes
- (:pr:`325`, :issue:`324`) Ensure ``util.measure_coordinates`` isn't returning NaN angles just
because floating-point errors are outside arccos's ``[-1, 1]`` bounds.
- (:pr:`315`) Stop resetting numpy print formatting.
- (:pr:`328`) Add workaround for only python v3.12.0 and psi4 (can be expanded) to handle
``util.which`` on Windows when a cmd (non-executable) and a cmd.<executable_extension> live
side-by-side. Otherwise see ``[WinError 193] %1 is not a valid Win32 application``.

Misc.
+++++
- (:pr:`320`) Reset ``black`` formatting to 2022.
- (:pr:`327`) Enable Python v3.12 in poetry.
- (:pr:`328`) Start Windows testing and cron testing.


0.26.0 / 2023-07-31
Expand Down
2 changes: 1 addition & 1 deletion qcelemental/tests/test_importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_which_import_f_raisemsg_submodule():

def test_which_t():
ans = qcel.util.which("ls")
assert ans.split(os.path.sep)[-1] == "ls"
assert ans.split(os.path.sep)[-1] in ["ls", "ls.EXE"]


def test_which_t_bool():
Expand Down
5 changes: 5 additions & 0 deletions qcelemental/util/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ def which(
lenv = {"PATH": os.pathsep.join([os.path.abspath(x) for x in env.split(os.pathsep) if x != ""])}
lenv = {k: v for k, v in lenv.items() if v is not None}

if sys.platform == "win32" and sys.version_info >= (3, 12, 0) and sys.version_info < (3, 12, 1):
# https://github.com/python/cpython/issues/109590
if command == "psi4":
command = "psi4.bat"

ans = shutil.which(command, mode=os.F_OK | os.X_OK, path=lenv["PATH"])

# secondary check, see https://github.com/MolSSI/QCEngine/issues/292
Expand Down

0 comments on commit c8c4aa6

Please sign in to comment.