diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ec83448..a0fa3c9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: [master] pull_request: branches: - - '**' + - "**" workflow_dispatch: defaults: @@ -20,26 +20,26 @@ jobs: matrix: os: [ubuntu-latest] python-version: - - '3.12' + - "3.12" toxenv: [py, quality] steps: - - uses: actions/checkout@v4 - - name: setup python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v4 + - name: setup python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: Install pip - run: pip install -r requirements/pip.txt + - name: Install pip + run: pip install -r requirements/pip.txt - - name: Install Dependencies - run: pip install -r requirements/ci.txt + - name: Install Dependencies + run: pip install -r requirements/ci.txt - - name: Run Tests - env: - TOXENV: ${{ matrix.toxenv }} - run: tox + - name: Run Tests + env: + TOXENV: ${{ matrix.toxenv }} + run: tox # Tests that used to be in the cookiecutter-django-ida Makefile but # that have not yet been moved into the regular unit tests (which @@ -50,50 +50,50 @@ jobs: matrix: os: [ubuntu-latest] python-version: - - '3.12' + - "3.12" steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Generate demo project - run: | - make requirements - cookiecutter cookiecutter-django-ida --no-input - - - name: "Post-gen: Virtualenv, and set up requirements" - working-directory: repo_name - run: | - virtualenv .venv - source .venv/bin/activate - - make upgrade # TODO should be part of initial cookiecutter setup - make requirements - - - name: "Post-gen: Migrations" - working-directory: repo_name - run: | - source .venv/bin/activate - python manage.py makemigrations - make migrate - - - name: "Quality checks" - working-directory: repo_name - run: | - source .venv/bin/activate - make validate - - - name: "Ensure translations can be compiled" - working-directory: repo_name - run: | - source .venv/bin/activate - sudo apt install gettext # required for msguniq, called by makemessages management command - make fake_translations - - - name: "Ensure docker can build a container" - working-directory: repo_name - run: | - source .venv/bin/activate - docker build . --target app + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Generate demo project + run: | + make requirements + cookiecutter cookiecutter-django-ida --no-input + + - name: "Post-gen: Virtualenv, and set up requirements" + working-directory: repo_name + run: | + virtualenv .venv + source .venv/bin/activate + + make upgrade # TODO should be part of initial cookiecutter setup + make requirements + + - name: "Post-gen: Migrations" + working-directory: repo_name + run: | + source .venv/bin/activate + python manage.py makemigrations + make migrate + + - name: "Quality checks" + working-directory: repo_name + run: | + source .venv/bin/activate + make validate + + - name: "Ensure translations can be compiled" + working-directory: repo_name + run: | + source .venv/bin/activate + sudo apt install gettext # required for msguniq, called by makemessages management command + make fake_translations + + - name: "Ensure docker can build a container" + working-directory: repo_name + run: | + source .venv/bin/activate + docker build . --target app diff --git a/cookiecutter-django-app/README.rst b/cookiecutter-django-app/README.rst index 72328c89..22b5ad60 100644 --- a/cookiecutter-django-app/README.rst +++ b/cookiecutter-django-app/README.rst @@ -54,7 +54,7 @@ Enter the project and take a look around: ls Generate a virtualenv and generate requirements files with dependencies -pinned to current versions (make sure you're using pip 9.0.2+ and Python 3.8): +pinned to current versions (make sure you're using pip 9.0.2+ and Python 3.12): .. code-block:: bash diff --git a/cookiecutter-django-app/{{cookiecutter.repo_name}}/.github/workflows/ci.yml b/cookiecutter-django-app/{{cookiecutter.repo_name}}/.github/workflows/ci.yml index 0b0f4d05..a48f3567 100644 --- a/cookiecutter-django-app/{{cookiecutter.repo_name}}/.github/workflows/ci.yml +++ b/cookiecutter-django-app/{{cookiecutter.repo_name}}/.github/workflows/ci.yml @@ -5,8 +5,7 @@ on: branches: [main] pull_request: branches: - - '**' - + - "**" jobs: run_tests: @@ -15,31 +14,30 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.8'] - toxenv: [quality, docs, pii_check, django32, django40] - + python-version: ["3.12"] + toxenv: [quality, docs, pii_check, django42] steps: - - uses: actions/checkout@v3 - - name: setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install pip - run: pip install -r requirements/pip.txt - - - name: Install Dependencies - run: pip install -r requirements/ci.txt - - - name: Run Tests - env: - TOXENV: ${{ matrix.toxenv }} - run: tox - - - name: Run coverage - if: matrix.python-version == '3.8' && matrix.toxenv == 'django32' - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: unittests - fail_ci_if_error: true + - uses: actions/checkout@v4 + - name: setup python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install pip + run: pip install -r requirements/pip.txt + + - name: Install Dependencies + run: pip install -r requirements/ci.txt + + - name: Run Tests + env: + TOXENV: ${{ matrix.toxenv }} + run: tox + + - name: Run coverage + if: matrix.python-version == '3.12' && matrix.toxenv == 'django42' + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests + fail_ci_if_error: true diff --git a/cookiecutter-django-ida/README.rst b/cookiecutter-django-ida/README.rst index f59f422d..2e854c49 100644 --- a/cookiecutter-django-ida/README.rst +++ b/cookiecutter-django-ida/README.rst @@ -5,7 +5,7 @@ A cookiecutter_ template for Open edX Django projects. .. _cookiecutter: https://cookiecutter.readthedocs.org/en/latest/index.html -**This template produces a Python 3.8 project.** +**This template produces a Python 3.12 project.** This cookiecutter template is intended for new edX independently deployable apps (IDAs). It includes the following packages: diff --git a/cookiecutter-django-ida/{{cookiecutter.repo_name}}/.github/workflows/check-reserved-keywords.yml b/cookiecutter-django-ida/{{cookiecutter.repo_name}}/.github/workflows/check-reserved-keywords.yml index ee6440a2..5978ec79 100644 --- a/cookiecutter-django-ida/{{cookiecutter.repo_name}}/.github/workflows/check-reserved-keywords.yml +++ b/cookiecutter-django-ida/{{cookiecutter.repo_name}}/.github/workflows/check-reserved-keywords.yml @@ -10,12 +10,12 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.12 - name: Install pip run: pip install -r requirements/pip.txt diff --git a/cookiecutter-django-ida/{{cookiecutter.repo_name}}/Dockerfile b/cookiecutter-django-ida/{{cookiecutter.repo_name}}/Dockerfile index dffdcbe4..05cd8c60 100644 --- a/cookiecutter-django-ida/{{cookiecutter.repo_name}}/Dockerfile +++ b/cookiecutter-django-ida/{{cookiecutter.repo_name}}/Dockerfile @@ -21,7 +21,7 @@ FROM ubuntu:focal as app # If you add a package here please include a comment above describing what it is used for RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends \ language-pack-en locales \ - python3.8 python3-dev python3-pip \ + python3.12 python3-dev python3-pip \ # The mysqlclient Python package has install-time dependencies libmysqlclient-dev libssl-dev pkg-config \ gcc diff --git a/cookiecutter-python-library/README.rst b/cookiecutter-python-library/README.rst index f707d231..78c9c41a 100644 --- a/cookiecutter-python-library/README.rst +++ b/cookiecutter-python-library/README.rst @@ -5,7 +5,7 @@ A cookiecutter_ template for edX python projects. For django-related cookiecutte .. _cookiecutter: https://cookiecutter.readthedocs.org/en/latest/index.html -**This template produces a Python 3.8 project.** +**This template produces a Python 3.12 project.** This cookiecutter template is intended for new edX python libraries. diff --git a/cookiecutter-xblock/{{cookiecutter.repo_name}}/.github/workflows/ci.yml b/cookiecutter-xblock/{{cookiecutter.repo_name}}/.github/workflows/ci.yml index 2bb499af..432f3798 100644 --- a/cookiecutter-xblock/{{cookiecutter.repo_name}}/.github/workflows/ci.yml +++ b/cookiecutter-xblock/{{cookiecutter.repo_name}}/.github/workflows/ci.yml @@ -5,8 +5,7 @@ on: branches: [main] pull_request: branches: - - '**' - + - "**" jobs: run_tests: @@ -15,31 +14,30 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.8'] - toxenv: [quality, docs, django32, django40] - + python-version: ["3.12"] + toxenv: [quality, docs, django42] steps: - - uses: actions/checkout@v3 - - name: setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install pip - run: pip install -r requirements/pip.txt - - - name: Install Dependencies - run: pip install -r requirements/ci.txt - - - name: Run Tests - env: - TOXENV: ${{ matrix.toxenv }} - run: tox - - - name: Run coverage - if: matrix.python-version == '3.8' && matrix.toxenv == 'django32' - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: unittests - fail_ci_if_error: true + - uses: actions/checkout@v4 + - name: setup python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install pip + run: pip install -r requirements/pip.txt + + - name: Install Dependencies + run: pip install -r requirements/ci.txt + + - name: Run Tests + env: + TOXENV: ${{ matrix.toxenv }} + run: tox + + - name: Run coverage + if: matrix.python-version == '3.12' && matrix.toxenv == 'django42' + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests + fail_ci_if_error: true diff --git a/cookiecutter-xblock/{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/{{cookiecutter.package_name}}.py b/cookiecutter-xblock/{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/{{cookiecutter.package_name}}.py index 67519560..6e2d0a7a 100644 --- a/cookiecutter-xblock/{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/{{cookiecutter.package_name}}.py +++ b/cookiecutter-xblock/{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/{{cookiecutter.package_name}}.py @@ -1,10 +1,13 @@ """TO-DO: Write a description of what this XBlock is.""" +import importlib.resources as resources import os + from django.utils import translation from web_fragments.fragment import Fragment from xblock.core import XBlock from xblock.fields import Integer, Scope + try: from xblock.utils.resources import ResourceLoader except ModuleNotFoundError: @@ -27,7 +30,7 @@ class {{cookiecutter.class_name}}(XBlock): help="A simple counter, to show something happening", ) - def get_resource_string(self, path): + def resource_string(self, path): """ Retrieve string contents for the file path """ @@ -100,8 +103,6 @@ def _get_statici18n_js_url(): text_js = 'static/js/translations/{locale_code}/text.js' lang_code = locale_code.split('-')[0] for code in (locale_code, lang_code, 'en'): - import importlib.resources as resources - text_js_path = text_js.format(locale_code=code) if resources.is_resource(resource_loader.module_name, text_js_path): return text_js_path diff --git a/python-template/{{cookiecutter.placeholder_repo_name}}/.github/workflows/ci.yml b/python-template/{{cookiecutter.placeholder_repo_name}}/.github/workflows/ci.yml index 02269f1a..1930b842 100644 --- a/python-template/{{cookiecutter.placeholder_repo_name}}/.github/workflows/ci.yml +++ b/python-template/{{cookiecutter.placeholder_repo_name}}/.github/workflows/ci.yml @@ -2,11 +2,10 @@ name: Python CI on: push: - branches: [ main ] + branches: [main] pull_request: branches: - - '**' - + - "**" jobs: run_tests: @@ -15,13 +14,12 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.8'] - toxenv: ["py38", "quality", "docs", "pii_check"] - + python-version: ["3.12"] + toxenv: ["py311", "quality", "docs", "pii_check"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -37,7 +35,7 @@ jobs: run: tox - name: Run coverage - if: matrix.python-version == '3.8' && matrix.toxenv == 'py38' + if: matrix.python-version == '3.11' && matrix.toxenv == 'py311' uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/python-template/{{cookiecutter.placeholder_repo_name}}/.github/workflows/pypi-publish.yml b/python-template/{{cookiecutter.placeholder_repo_name}}/.github/workflows/pypi-publish.yml index da353d45..95743edc 100644 --- a/python-template/{{cookiecutter.placeholder_repo_name}}/.github/workflows/pypi-publish.yml +++ b/python-template/{{cookiecutter.placeholder_repo_name}}/.github/workflows/pypi-publish.yml @@ -5,17 +5,16 @@ on: types: [published] jobs: - push: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.11 - name: Install pip run: pip install -r requirements/pip.txt diff --git a/python-template/{{cookiecutter.placeholder_repo_name}}/.readthedocs.yaml b/python-template/{{cookiecutter.placeholder_repo_name}}/.readthedocs.yaml index ce8bde28..c9226adc 100644 --- a/python-template/{{cookiecutter.placeholder_repo_name}}/.readthedocs.yaml +++ b/python-template/{{cookiecutter.placeholder_repo_name}}/.readthedocs.yaml @@ -14,7 +14,7 @@ sphinx: build: os: "ubuntu-22.04" tools: - python: "3.8" + python: "3.11" python: install: diff --git a/python-template/{{cookiecutter.placeholder_repo_name}}/setup.py b/python-template/{{cookiecutter.placeholder_repo_name}}/setup.py index 8a43be9f..f8aaf1df 100755 --- a/python-template/{{cookiecutter.placeholder_repo_name}}/setup.py +++ b/python-template/{{cookiecutter.placeholder_repo_name}}/setup.py @@ -162,7 +162,7 @@ def package_data(pkg, roots): include_package_data=True, install_requires=load_requirements('requirements/base.in'), - python_requires=">=3.8", + python_requires=">=3.12", {%- if cookiecutter.open_source_license in license_classifiers %} license="{{ cookiecutter.open_source_license }}", {%- endif %} @@ -172,7 +172,7 @@ def package_data(pkg, roots): 'Development Status :: 3 - Alpha', {%- if cookiecutter.requires_django == "yes" %} 'Framework :: Django', - 'Framework :: Django :: 3.2', + 'Framework :: Django :: 4.2', {%- endif %} 'Intended Audience :: Developers', {%- if cookiecutter.open_source_license == "AGPL 3.0" %} @@ -184,7 +184,8 @@ def package_data(pkg, roots): {%- endif %} 'Natural Language :: English', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], {%- if cookiecutter.setup_py_keyword_args != "None" %} {{ cookiecutter.setup_py_keyword_args }}