From 432f8c941a7999dcf27246fb1488f1093b77d05e Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:11:30 +0000 Subject: [PATCH 01/12] support python 3.12 --- .flexci/config.pbtxt | 12 ++--- .flexci/linux/script.sh | 1 + .github/workflows/ci.yml | 96 +++++++++++++++++++--------------------- pyproject.toml | 2 +- 4 files changed, 53 insertions(+), 58 deletions(-) diff --git a/.flexci/config.pbtxt b/.flexci/config.pbtxt index b2b706ca..8bced9cd 100644 --- a/.flexci/config.pbtxt +++ b/.flexci/config.pbtxt @@ -1,5 +1,5 @@ configs { - key: "pfhedge.python38-linux" + key: "pfhedge.python39-linux" value { requirement { cpu: 2 @@ -10,12 +10,12 @@ configs { time_limit: { seconds: 1200 } - command: "bash .flexci/linux/script.sh python38" + command: "bash .flexci/linux/script.sh python39" } } configs { - key: "pfhedge.python39-linux" + key: "pfhedge.python310-linux" value { requirement { cpu: 2 @@ -26,12 +26,12 @@ configs { time_limit: { seconds: 1200 } - command: "bash .flexci/linux/script.sh python39" + command: "bash .flexci/linux/script.sh python310" } } configs { - key: "pfhedge.python310-linux" + key: "pfhedge.python311-linux" value { requirement { cpu: 2 @@ -42,6 +42,6 @@ configs { time_limit: { seconds: 1200 } - command: "bash .flexci/linux/script.sh python310" + command: "bash .flexci/linux/script.sh python311" } } diff --git a/.flexci/linux/script.sh b/.flexci/linux/script.sh index 38dc3993..f98c167e 100644 --- a/.flexci/linux/script.sh +++ b/.flexci/linux/script.sh @@ -16,6 +16,7 @@ declare -A python_versions=( ["python38"]="3.8.12" ["python39"]="3.9.7" ["python310"]="3.10.4" + ["python311"]="3.11.5" ) ################################################################################ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52866900..a79d2eb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,17 +2,17 @@ name: CI env: PROJECT_NAME: pfhedge - PYTHON_VERSION: '3.9' + PYTHON_VERSION: "3.9" on: push: - branches: + branches: - main - develop - release/* - hotfix/* pull_request: - branches: + branches: - main - develop - release/* @@ -20,48 +20,45 @@ on: workflow_dispatch: jobs: - test: - name: Test runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] - torch-version: ['1.9.0', '1.13.1', '2.0.0'] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + torch-version: ["1.9.0", "1.13.1", "2.0.0", "2.4.0"] # pytorch 1.9.0 does not support python 3.10, 3.11 exclude: - - python-version: '3.10' + - python-version: "3.10" torch-version: "1.9.0" - - python-version: '3.11' + - python-version: "3.11" torch-version: "1.9.0" steps: + - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} - - name: Install - run: | - pip install poetry - poetry install - poetry run pip uninstall -y torch - poetry run pip install torch==${{ matrix.torch-version }} + - name: Install + run: | + pip install poetry + poetry install + poetry run pip uninstall -y torch + poetry run pip install torch==${{ matrix.torch-version }} - - name: Run doctest - run: make doctest + - name: Run doctest + run: make doctest - - name: Run pytest - run: make test-cov + - name: Run pytest + run: make test-cov - - name: Upload codecov report - uses: codecov/codecov-action@v1 - if: ${{ matrix.python-version == '3.9' && matrix.torch-version == '1.13.1' }} + - name: Upload codecov report + uses: codecov/codecov-action@v1 + if: ${{ matrix.python-version == '3.9' && matrix.torch-version == '1.13.1' }} lint: name: Lint (pysen) @@ -71,19 +68,17 @@ jobs: status: ${{ job.status }} steps: + - uses: actions/checkout@v2 - - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ env.PYTHON_VERSION }} - - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHON_VERSION }} + - run: pip install poetry && poetry install - - run: pip install poetry && poetry install - - - run: make lint + - run: make lint format: - name: Format runs-on: ubuntu-latest @@ -93,23 +88,22 @@ jobs: if: ${{ always() && needs.lint.outputs.status == 'failure' }} steps: + - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHON_VERSION }} + - uses: actions/setup-python@v2 + with: + python-version: ${{ env.PYTHON_VERSION }} - - run: pip install poetry && poetry install + - run: pip install poetry && poetry install - - run: make format + - run: make format - - name: Create pull request - uses: peter-evans/create-pull-request@v3 - with: - author: GitHub Actions - base: ${{ github.event.pull_request.head.ref }} - commit-message: Automated Format - delete-branch: true - branch-suffix: short-commit-hash - title: Automated Format + - name: Create pull request + uses: peter-evans/create-pull-request@v3 + with: + author: GitHub Actions + base: ${{ github.event.pull_request.head.ref }} + commit-message: Automated Format + delete-branch: true + branch-suffix: short-commit-hash + title: Automated Format diff --git a/pyproject.toml b/pyproject.toml index 20e17934..3e55a464 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ license = "MIT" repository = "https://github.com/pfnet-research/pfhedge" [tool.poetry.dependencies] -python = "^3.8.1,<3.12" +python = "^3.8.1" torch = ">=1.9.0,<3.0.0" tqdm = "^4.62.3" From 41ae6797b0739b3bcdb2ef4c7b4996b3adacdce0 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:19:23 +0000 Subject: [PATCH 02/12] test --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3e55a464..584ea075 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,10 @@ furo = "^2021.9.22" codecov = "^2.1.12" click = "8.0.4" flake8 = "4.0.1" -scipy = "^1.10.1" +scipy = [ + { version = ""^1.10.1"", markers = "python_version < '3.9'" }, + { version = ""^1.12.0"", markers = "python_version >= '3.9'" }, +] mypy = "^1.11.1" pyproject-flake8 = "4.0.1" From 7b28f8c29b1122bb278c4e14a3b408ac73cd1d21 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:25:13 +0000 Subject: [PATCH 03/12] update --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 584ea075..b332aa30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ click = "8.0.4" flake8 = "4.0.1" scipy = [ { version = ""^1.10.1"", markers = "python_version < '3.9'" }, - { version = ""^1.12.0"", markers = "python_version >= '3.9'" }, + { version = ""^1.12.0"", markers = "python_version >= '3.9'" } ] mypy = "^1.11.1" pyproject-flake8 = "4.0.1" From ab075b056d83d561febfcc008ddb3405494f13c7 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:27:18 +0000 Subject: [PATCH 04/12] fix --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b332aa30..d6c26d2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,8 @@ codecov = "^2.1.12" click = "8.0.4" flake8 = "4.0.1" scipy = [ - { version = ""^1.10.1"", markers = "python_version < '3.9'" }, - { version = ""^1.12.0"", markers = "python_version >= '3.9'" } + { version = "^1.10.1", markers = "python_version < '3.9'" }, + { version = "^1.12.0", markers = "python_version >= '3.9'" } ] mypy = "^1.11.1" pyproject-flake8 = "4.0.1" From 31f4cc5b02a51edbd002f7e8cbdca1a92934a189 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:32:32 +0000 Subject: [PATCH 05/12] test --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d6c26d2a..76c870e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ scipy = [ { version = "^1.10.1", markers = "python_version < '3.9'" }, { version = "^1.12.0", markers = "python_version >= '3.9'" } ] + mypy = "^1.11.1" pyproject-flake8 = "4.0.1" From ea7ce4805fdb2a5eeccfbea003c970e3aa9e6e72 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:38:45 +0000 Subject: [PATCH 06/12] fix --- .github/workflows/ci.yml | 6 ++++++ pyproject.toml | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a79d2eb6..d77d5b88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,12 @@ jobs: torch-version: "1.9.0" - python-version: "3.11" torch-version: "1.9.0" + - python-version: "3.12" + torch-version: "1.9.0" + - python-version: "3.12" + torch-version: "1.13.0" + - python-version: "3.12" + torch-version: "2.0.0" steps: - uses: actions/checkout@v2 diff --git a/pyproject.toml b/pyproject.toml index 76c870e7..d6c26d2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,6 @@ scipy = [ { version = "^1.10.1", markers = "python_version < '3.9'" }, { version = "^1.12.0", markers = "python_version >= '3.9'" } ] - mypy = "^1.11.1" pyproject-flake8 = "4.0.1" From 9850862ffc225b932e2f407a8d49cfff19c6321a Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:39:10 +0000 Subject: [PATCH 07/12] fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d77d5b88..ba6e62db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: - python-version: "3.12" torch-version: "1.9.0" - python-version: "3.12" - torch-version: "1.13.0" + torch-version: "1.13.1" - python-version: "3.12" torch-version: "2.0.0" From abdb23ce5c4d130be2326922791e778b20447b8d Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:49:09 +0000 Subject: [PATCH 08/12] test --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d6c26d2a..ad236589 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,10 +23,7 @@ furo = "^2021.9.22" codecov = "^2.1.12" click = "8.0.4" flake8 = "4.0.1" -scipy = [ - { version = "^1.10.1", markers = "python_version < '3.9'" }, - { version = "^1.12.0", markers = "python_version >= '3.9'" } -] +scipy = [{ version = "^1.10.1", markers = "python_version < '3.9'" }, { version = "^1.12.0", markers = "python_version >= '3.9'" }] mypy = "^1.11.1" pyproject-flake8 = "4.0.1" From e0bbe0a88c6ab9c24adfb9e3e8bdd5d5a1909864 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 03:24:35 +0000 Subject: [PATCH 09/12] add restriction to numpy --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index ad236589..c4d78056 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ flake8 = "4.0.1" scipy = [{ version = "^1.10.1", markers = "python_version < '3.9'" }, { version = "^1.12.0", markers = "python_version >= '3.9'" }] mypy = "^1.11.1" pyproject-flake8 = "4.0.1" +numpy = "<2.0.0" [build-system] requires = ["poetry-core>=1.0.0"] From 16a5c25a85c8cdb524e292007b11cf9113bf3c77 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 03:25:15 +0000 Subject: [PATCH 10/12] test --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c4d78056..d2db8a79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ repository = "https://github.com/pfnet-research/pfhedge" python = "^3.8.1" torch = ">=1.9.0,<3.0.0" tqdm = "^4.62.3" +numpy = "<2.0.0" [tool.poetry.dev-dependencies] pytest = "^6.2.5" @@ -26,7 +27,6 @@ flake8 = "4.0.1" scipy = [{ version = "^1.10.1", markers = "python_version < '3.9'" }, { version = "^1.12.0", markers = "python_version >= '3.9'" }] mypy = "^1.11.1" pyproject-flake8 = "4.0.1" -numpy = "<2.0.0" [build-system] requires = ["poetry-core>=1.0.0"] From c45cbc00266b8690ae9b64ae7b212667194aa967 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 04:09:50 +0000 Subject: [PATCH 11/12] test --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d2db8a79..39c4986d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ repository = "https://github.com/pfnet-research/pfhedge" python = "^3.8.1" torch = ">=1.9.0,<3.0.0" tqdm = "^4.62.3" -numpy = "<2.0.0" +numpy = [{version = ">=1.26", python = ">=3.9"}, {version = "<1.25", python = "=3.8"}] [tool.poetry.dev-dependencies] pytest = "^6.2.5" From c135af927d7f28ec1b8aa9e14a9ba8d1e1b93919 Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 04:43:45 +0000 Subject: [PATCH 12/12] test --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 39c4986d..07d07ac1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ repository = "https://github.com/pfnet-research/pfhedge" python = "^3.8.1" torch = ">=1.9.0,<3.0.0" tqdm = "^4.62.3" -numpy = [{version = ">=1.26", python = ">=3.9"}, {version = "<1.25", python = "=3.8"}] +numpy = [{version = "^1.26", python = ">=3.9"}, {version = "<1.25", python = "=3.8"}] [tool.poetry.dev-dependencies] pytest = "^6.2.5"