Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase CI sensitivity by testing both lowest-direct and highest dependency resolution strategy #640

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1cbb7fc
increase CI sensitivity by testing both lowest-direct and highest dep…
janosh Jul 4, 2024
737d4fd
remove non-strict extra deps set
janosh Jul 4, 2024
c0bed9e
skip tests that fail if optional deps not installed
janosh Jul 4, 2024
4a1d1ec
add pytest.importorskip("matplotlib") to all test_draw_graph
janosh Jul 4, 2024
4d5070e
refactor
janosh Jul 4, 2024
ddc65c6
maggma>=0.69
janosh Jul 4, 2024
c3639b1
dropping 3.12 CI for now until maggma incompat is fixed
janosh Jul 4, 2024
7000644
fix typo
janosh Jul 20, 2024
3ee56d2
fix ruff + mypy after update
janosh Jul 20, 2024
3b85016
pin pydantic>=2.0.1->2.4
janosh Jul 20, 2024
e509d06
Merge branch 'main' into uv-ci-test-lowest-highest-dep-resolution
janosh Jul 20, 2024
057c2d4
Merge branch 'main' into uv-ci-test-lowest-highest-dep-resolution
janosh Sep 18, 2024
afcefe3
Bump pydantic from 2.9.1 to 2.9.2 (#681)
dependabot[bot] Sep 23, 2024
7b6b1b4
Bump maggma from 0.69.3 to 0.69.4 (#682)
dependabot[bot] Sep 30, 2024
77e23c5
bump commit hooks
janosh Oct 2, 2024
d31b614
ruff fixes + 1 mypy fix
janosh Oct 2, 2024
280aae1
Bump maggma from 0.69.3 to 0.69.4 (#688)
dependabot[bot] Oct 7, 2024
f73ccc9
Bump ipython from 8.27.0 to 8.28.0 (#687)
dependabot[bot] Oct 7, 2024
4962f4d
Bump pydantic from 2.9.1 to 2.9.2 (#689)
dependabot[bot] Oct 7, 2024
bf599ba
Bump sphinx from 8.0.2 to 8.1.3 (#692)
dependabot[bot] Oct 14, 2024
d4fd615
Bump maggma from 0.69.4 to 0.70.0 (#693)
dependabot[bot] Oct 14, 2024
bffc15f
Bump python-ulid from 2.7.0 to 3.0.0 (#694)
dependabot[bot] Oct 14, 2024
12f839c
Bump pydantic-settings from 2.5.2 to 2.6.0 (#696)
dependabot[bot] Oct 21, 2024
b97a9d4
Bump monty from 2024.7.30 to 2024.10.21 (#698)
dependabot[bot] Oct 21, 2024
9cf327e
Bump ipython from 8.28.0 to 8.29.0 (#699)
dependabot[bot] Oct 28, 2024
88cc265
Bump pydash from 8.0.3 to 8.0.4 (#703)
dependabot[bot] Nov 4, 2024
278a15a
Bump pydantic-settings from 2.6.0 to 2.6.1 (#701)
dependabot[bot] Nov 4, 2024
fc4f101
Bump pytest-cov from 5.0.0 to 6.0.0 (#704)
dependabot[bot] Nov 4, 2024
ca778db
Update versioningit requirement from ~=1.0 to >=1,<4 (#705)
dependabot[bot] Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
version:
- { python: "3.9", resolution: highest, extras: "tests,strict" }
- { python: "3.10", resolution: lowest-direct, extras: "tests" }
- { python: "3.11", resolution: highest, extras: tests }
# python 3.12 CI failing due to maggma incompatible, see
# https://github.com/materialsproject/jobflow/pull/640#issuecomment-2209055692
# - { python: "3.12", resolution: lowest-direct, extras: tests }

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.version.python }}
cache: pip
cache-dependency-path: pyproject.toml

Expand All @@ -52,13 +58,13 @@ jobs:
- name: Install dependencies
run: |
pip install uv
uv pip install .[strict,tests] --system
uv pip install '.[${{ matrix.version.extras }}]' --system --resolution=${{ matrix.version.resolution }}

- name: Test
run: pytest --cov=jobflow --cov-report=xml

- uses: codecov/codecov-action@v1
if: matrix.python-version == '3.11' && github.repository == 'materialsproject/jobflow'
if: matrix.version.python == '3.11' && github.repository == 'materialsproject/jobflow'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
exclude: "^src/atomate2/vasp/schemas/calc_types/"
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.2
rev: v0.6.8
hooks:
- id: ruff
args: [--fix]
Expand All @@ -17,7 +17,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.18.0
hooks:
- id: blacken-docs
additional_dependencies: [black]
Expand All @@ -43,7 +43,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.11.2
hooks:
- id: mypy
files: ^src/
Expand All @@ -52,7 +52,7 @@ repos:
- types-pkg_resources==0.1.2
- types-paramiko
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
stages: [commit, commit-msg]
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorials/4-creating-flows.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@
"source": [
"from jobflow import job\n",
"\n",
"\n",
"@job\n",
"def add(a, b, c=2):\n",
" return a + b + c\n",
"\n",
"\n",
"@job\n",
"def mult(a, b):\n",
" return a * b"
Expand Down
79 changes: 48 additions & 31 deletions docs/tutorials/5-dynamic-flows.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
"execution_count": 1,
"id": "78348798",
"metadata": {
"nbsphinx": "hidden",
"tags": [],
"ExecuteTime": {
"end_time": "2023-11-23T22:55:01.113171569Z",
"start_time": "2023-11-23T22:55:01.112486877Z"
}
},
"nbsphinx": "hidden",
"tags": []
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -98,26 +98,28 @@
],
"source": [
"from random import randint\n",
"from jobflow import job, Flow, Response\n",
"\n",
"from jobflow import Flow, Response, job\n",
"from jobflow.managers.local import run_locally\n",
"\n",
"\n",
"@job\n",
"def make_list(a):\n",
" return [a] * randint(2, 5)\n",
"\n",
"\n",
"@job\n",
"def add(a, b):\n",
" return a + b\n",
"\n",
"\n",
"@job\n",
"def add_distributed(list_a):\n",
" jobs = []\n",
" for val in list_a:\n",
" jobs.append(add(val, 1))\n",
" \n",
" jobs = [add(val, 1) for val in list_a]\n",
" flow = Flow(jobs)\n",
" return Response(replace=flow)\n",
"\n",
"\n",
"job1 = make_list(2)\n",
"job2 = add_distributed(job1.output)\n",
"flow = Flow([job1, job2])\n",
Expand Down Expand Up @@ -215,14 +217,17 @@
],
"source": [
"@job\n",
"def add(a, b):\n",
"def add(a, b): # noqa: F811\n",
" return a + b\n",
"\n",
"\n",
"@job\n",
"def add_with_logic(a, b):\n",
" if a < 10:\n",
" return Response(addition=add(a, b))\n",
" \n",
" return None\n",
"\n",
"\n",
"job1 = add(1, 2)\n",
"job2 = add_with_logic(job1.output, 2)\n",
"flow = Flow([job1, job2])\n",
Expand Down Expand Up @@ -294,11 +299,14 @@
"def add(a, b):\n",
" return a + b\n",
"\n",
"\n",
"@job\n",
"def add_with_logic(a, b):\n",
" if a < 10:\n",
" return Response(addition=add(a, b))\n",
" \n",
" return None\n",
"\n",
"\n",
"job1 = add(1, 20)\n",
"job2 = add_with_logic(job1.output, 20)\n",
"flow = Flow([job1, job2])\n",
Expand Down Expand Up @@ -341,16 +349,25 @@
},
{
"cell_type": "markdown",
"source": [
"In this way, one can also compute the Fibonacci numbers:"
],
"id": "7fb27b941602401d91542211134fc71a",
"metadata": {
"collapsed": false
}
},
"source": [
"In this way, one can also compute the Fibonacci numbers:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "acae54e37e7d407bbb7b55eff062a284",
"metadata": {
"ExecuteTime": {
"end_time": "2023-11-23T22:55:13.426518952Z",
"start_time": "2023-11-23T22:55:13.322421257Z"
},
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -392,13 +409,12 @@
}
],
"source": [
"\"\"\"A dynamic workflow that calculates the Fibonacci sequence.\"\"\"\n",
"from jobflow import Response, job, run_locally\n",
"from jobflow import job, run_locally\n",
"\n",
"\n",
"@job\n",
"def fibonacci(smaller, larger, stop_point=1000):\n",
" \"\"\"Calculate the next number in the Fibonacci sequence.\n",
" \"\"\"A dynamic workflow that calculates the Fibonacci sequence.\n",
"\n",
" If the number is larger than stop_point, the job will stop the workflow\n",
" execution, otherwise, a new job will be submitted to calculate the next number.\n",
Expand All @@ -415,15 +431,8 @@
"fibonacci_job = fibonacci(1, 1)\n",
"\n",
"# run the job; responses will contain the output from all jobs\n",
"responses = run_locally(fibonacci_job)\n"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-23T22:55:13.426518952Z",
"start_time": "2023-11-23T22:55:13.322421257Z"
}
}
"responses = run_locally(fibonacci_job)"
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -472,11 +481,14 @@
"def add(a, b):\n",
" return a + b\n",
"\n",
"\n",
"@job\n",
"def add_with_logic(a, b):\n",
" if a < 10:\n",
" return Response(detour=add(a, b))\n",
" \n",
" return None\n",
"\n",
"\n",
"job1 = add(1, 2)\n",
"job2 = add_with_logic(job1.output, 2)\n",
"flow = Flow([job1, job2])\n",
Expand All @@ -497,7 +509,12 @@
"outputs": [
{
"data": {
"text/plain": "{'301d75f0-7042-494a-9f24-cab0428c2fd1': {1: Response(output=3, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False)},\n '97be61a8-eec4-4e64-bf53-ba37621575e7': {1: Response(output=None, detour=Flow(name='Flow', uuid='0de995a5-1110-4200-b010-276cb2017474')\n 1. Job(name='add', uuid='d4c31f68-09ad-418a-ac52-89b303fc2a00'), addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False)},\n 'd4c31f68-09ad-418a-ac52-89b303fc2a00': {1: Response(output=5, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False)}}"
"text/plain": [
"{'301d75f0-7042-494a-9f24-cab0428c2fd1': {1: Response(output=3, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False)},\n",
" '97be61a8-eec4-4e64-bf53-ba37621575e7': {1: Response(output=None, detour=Flow(name='Flow', uuid='0de995a5-1110-4200-b010-276cb2017474')\n",
" 1. Job(name='add', uuid='d4c31f68-09ad-418a-ac52-89b303fc2a00'), addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False)},\n",
" 'd4c31f68-09ad-418a-ac52-89b303fc2a00': {1: Response(output=5, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False)}}"
]
},
"execution_count": 10,
"metadata": {},
Expand All @@ -519,9 +536,9 @@
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"display_name": "Python 3 (ipykernel)"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down
20 changes: 12 additions & 8 deletions docs/tutorials/6-makers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@
],
"source": [
"from dataclasses import dataclass\n",
"from jobflow import job, Flow, Maker\n",
"\n",
"from jobflow import Flow, Maker, job\n",
"from jobflow.managers.local import run_locally\n",
"\n",
"\n",
"@dataclass\n",
"class AddMaker(Maker):\n",
" name: str = \"Add Maker\"\n",
Expand All @@ -73,10 +75,9 @@
" def make(self, a, b):\n",
" if self.operation == \"add\":\n",
" return a + b\n",
" elif self.operation == \"mult\":\n",
" if self.operation == \"mult\":\n",
" return a * b\n",
" else:\n",
" raise ValueError(f\"Unknown operation: {self.operation}\")\n",
" raise ValueError(f\"Unknown operation: {self.operation}\")\n",
"\n",
"\n",
"job1 = AddMaker().make(a=2, b=3)\n",
Expand Down Expand Up @@ -122,9 +123,11 @@
"outputs": [],
"source": [
"from dataclasses import dataclass\n",
"from jobflow import job, Flow, Maker\n",
"\n",
"from jobflow import Flow, Maker, job\n",
"from jobflow.managers.local import run_locally\n",
"\n",
"\n",
"@dataclass\n",
"class AddMaker(Maker):\n",
" name: str = \"Add Maker\"\n",
Expand All @@ -134,10 +137,10 @@
" def make(self, a, b):\n",
" if self.operation == \"add\":\n",
" return a + b\n",
" elif self.operation == \"mult\":\n",
" if self.operation == \"mult\":\n",
" return a * b\n",
" else:\n",
" raise ValueError(f\"Unknown operation: {self.operation}\")\n",
" raise ValueError(f\"Unknown operation: {self.operation}\")\n",
"\n",
"\n",
"@dataclass\n",
"class SubtractMaker(Maker):\n",
Expand All @@ -147,6 +150,7 @@
" def make(self, a, b):\n",
" return b - a\n",
"\n",
"\n",
"job1 = AddMaker().make(a=2, b=3)\n",
"job2 = SubtractMaker().make(a=job1.output, b=4)\n",
"flow = Flow([job1, job2])"
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/7-generalized-makers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"metadata": {},
"outputs": [],
"source": [
"from jobflow import Maker, job, Flow\n",
"from jobflow import Flow, Maker, job\n",
"from jobflow.managers.local import run_locally"
]
},
Expand All @@ -59,7 +59,7 @@
"source": [
"class BaseMaker(Maker):\n",
" def code_specific_func(self, arg1):\n",
" raise NotImplementedError()\n",
" raise NotImplementedError\n",
"\n",
" def make(self):\n",
" return Flow([job1(self.code_specific_func, \"ARG1\")])\n",
Expand Down
Loading
Loading