From 1754e6872fdddd27664d5a9ea0ced90fac93e26c Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Sun, 3 Jul 2022 15:09:10 +0530 Subject: [PATCH] add python 3.10 (#837) * fix: use py 3.10 for v14 closes #836 * docs: update development readme for py versions * ci: update github actions py version to 3.10 * Quote Python version in yaml files * fix: typo in environment variable Co-authored-by: Lev Vereshchagin --- .github/workflows/build_stable.yml | 2 +- .github/workflows/docker-build-push.yml | 2 +- .github/workflows/lint.yml | 2 +- development/README.md | 16 ++++++++++++++-- docker-bake.hcl | 4 ++-- images/bench/Dockerfile | 6 ++++-- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_stable.yml b/.github/workflows/build_stable.yml index 4188ac5c..3f62bfc0 100644 --- a/.github/workflows/build_stable.yml +++ b/.github/workflows/build_stable.yml @@ -77,7 +77,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: "3.10" - name: Get latest versions run: python3 ./.github/scripts/get_latest_tags.py --repo erpnext --version 13 diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index 22da458b..358e1df7 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -52,7 +52,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: "3.10" - name: Install Docker Compose v2 uses: ndeloof/install-compose-action@4a33bc31f327b8231c4f343f6fba704fedc0fa23 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ddae51d2..97b1b04a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: "3.10" # For shfmt pre-commit hook - name: Setup Go diff --git a/development/README.md b/development/README.md index d13a32c7..7e787782 100644 --- a/development/README.md +++ b/development/README.md @@ -64,11 +64,23 @@ Notes: Run the following commands in the terminal inside the container. You might need to create a new terminal in VSCode. ```shell -bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench +bench init --skip-redis-config-generation frappe-bench cd frappe-bench ``` -Note: For version 12 use Python 3.7 by passing option to `bench init` command, e.g. `bench init --skip-redis-config-generation --frappe-branch version-12 --python python3.7 frappe-bench` +For version 13 use Python 3.9 by passing option to `bench init` command, + +```shell +bench init --skip-redis-config-generation --frappe-branch version-13 --python python3.9 frappe-bench +cd frappe-bench +``` + +For version 12 use Python 3.7 by passing option to `bench init` command, + +```shell +bench init --skip-redis-config-generation --frappe-branch version-12 --python python3.7 frappe-bench +cd frappe-bench +``` ### Setup hosts diff --git a/docker-bake.hcl b/docker-bake.hcl index cd47b824..bf8eeca7 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -73,8 +73,8 @@ target "default-args" { BENCH_REPO = "${BENCH_REPO}" FRAPPE_VERSION = "${FRAPPE_VERSION}" ERPNEXT_VERSION = "${ERPNEXT_VERSION}" - # If `ERPNEXT_VERSION` variable contains "v12" use Python 3.7. Else — 3.9. - PYTHON_VERSION = can(regex("v12", "${ERPNEXT_VERSION}")) ? "3.7" : "3.9" + # If `ERPNEXT_VERSION` variable contains "v12" use Python 3.7. If "v13" — 3.9. Else 3.10. + PYTHON_VERSION = can(regex("v12", "${ERPNEXT_VERSION}")) ? "3.7" : can(regex("v13", "${ERPNEXT_VERSION}")) ? "3.9" : "3.10" } } diff --git a/images/bench/Dockerfile b/images/bench/Dockerfile index a963425e..5c63a72d 100644 --- a/images/bench/Dockerfile +++ b/images/bench/Dockerfile @@ -79,15 +79,17 @@ WORKDIR /home/frappe # Python 3.7 sits here for ERPNext version-12 # TODO: Remove Python 3.7 when version-12 will not be supported ENV PYTHON_VERSION_V12=3.7.12 -ENV PYTHON_VERSION=3.9.9 +ENV PYTHON_VERSION_V13=3.9.9 +ENV PYTHON_VERSION=3.10.5 ENV PYENV_ROOT /home/frappe/.pyenv ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH # From https://github.com/pyenv/pyenv#basic-github-checkout RUN git clone --depth 1 https://github.com/pyenv/pyenv.git .pyenv \ && pyenv install $PYTHON_VERSION_V12 \ + && pyenv install $PYTHON_VERSION_V13 \ && pyenv install $PYTHON_VERSION \ - && pyenv global $PYTHON_VERSION $PYTHON_VERSION_V12 \ + && pyenv global $PYTHON_VERSION $PYTHON_VERSION_V12 $PYTHON_VERSION_v13 \ && sed -Ei -e '/^([^#]|$)/ {a export PYENV_ROOT="/home/frappe/.pyenv" a export PATH="$PYENV_ROOT/bin:$PATH" a ' -e ':a' -e '$!{n;ba};}' ~/.profile \ && echo 'eval "$(pyenv init --path)"' >>~/.profile \ && echo 'eval "$(pyenv init -)"' >>~/.bashrc