From 432f8c941a7999dcf27246fb1488f1093b77d05e Mon Sep 17 00:00:00 2001 From: Masanori HIRANO Date: Mon, 26 Aug 2024 02:11:30 +0000 Subject: [PATCH] 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"