From 4f2a97672950821eadb71a84e759350c04254d15 Mon Sep 17 00:00:00 2001 From: Pascal F Date: Mon, 1 Apr 2024 10:33:12 +0200 Subject: [PATCH 1/2] update django supported version --- .github/workflows/test.yml | 18 +++++++------ .pre-commit-config.yaml | 8 ++---- .../locales/en/LC_MESSAGES/django.po | 3 ++- .../locales/kl/LC_MESSAGES/django.po | 2 +- sample_project/settings.py | 1 - tox.ini | 27 +++++++++++++++++++ 6 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 tox.ini diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2cd112..7dd453c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,20 +13,17 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - django-version: ["3.2", "4.1", "4.2"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - name: Install gettext run: | sudo apt-get update && sudo apt-get install -y gettext - - name: Check out the repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - uses: snok/install-poetry@v1 with: - # version: 1.3.2 virtualenvs-create: true virtualenvs-in-project: true @@ -44,13 +41,18 @@ jobs: - name: Install requirements run: poetry install - - name: Install django ${{ matrix.django-version }} - run: poetry add "django@~=${{ matrix.django-version }}" + # - name: Install django ${{ matrix.django-version }} + # run: poetry add "django@~=${{ matrix.django-version }}" - name: Django check run: poetry run python manage.py check + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + - name: Run tests - run: poetry run pytest --verbose + run: tox env: FORCE_COLOR: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3d2c776..5c91e2e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,17 +25,13 @@ repos: rev: 1.16.0 hooks: - id: django-upgrade - args: [--target-version, "3.2"] - - - repo: https://github.com/psf/black - rev: 24.3.0 - hooks: - - id: black + args: [--target-version, "4.2"] - repo: https://github.com/charliermarsh/ruff-pre-commit rev: "v0.3.4" hooks: - id: ruff + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.9.0 diff --git a/sample_project/locales/en/LC_MESSAGES/django.po b/sample_project/locales/en/LC_MESSAGES/django.po index e90feca..0f985a6 100644 --- a/sample_project/locales/en/LC_MESSAGES/django.po +++ b/sample_project/locales/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-12 06:37+0000\n" +"POT-Creation-Date: 2024-04-29 07:02+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,6 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" + #: sample_project/templates/default_urlconf.html:7 #: sample_project/templates/default_urlconf.html:221 msgid "The install worked successfully! Congratulations!" diff --git a/sample_project/locales/kl/LC_MESSAGES/django.po b/sample_project/locales/kl/LC_MESSAGES/django.po index e1eae1e..cf1b02c 100644 --- a/sample_project/locales/kl/LC_MESSAGES/django.po +++ b/sample_project/locales/kl/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-12 06:37+0000\n" +"POT-Creation-Date: 2024-04-29 07:02+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/sample_project/settings.py b/sample_project/settings.py index 9964116..c640a88 100644 --- a/sample_project/settings.py +++ b/sample_project/settings.py @@ -114,7 +114,6 @@ TIME_ZONE = "UTC" USE_I18N = True -USE_L10N = True LOCALE_PATHS = (BASE_DIR / "locales",) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..0afe161 --- /dev/null +++ b/tox.ini @@ -0,0 +1,27 @@ +[tox] +envlist = + py{38,39,310,311}-dj42 + py{310,311,312}-dj50 +skipsdist = True + +[testenv] +deps = + dj42: Django==4.2 + dj50: Django==5.0 + translate-toolkit + pytest + pytest-django + pytest-cov + +commands = {posargs:python -m pytest} + +[flake8] +max-line-length = 130 + +[gh-actions] +python = + 3.8: py38 + 3.9: py39 + 3.10: py310 + 3.11: py311 + 3.12: py312 From 54487f68c4ac78ee634d8e3bd05ba4cdbdc4cfb8 Mon Sep 17 00:00:00 2001 From: Pascal F Date: Mon, 29 Apr 2024 10:04:55 +0200 Subject: [PATCH 2/2] wip --- .github/workflows/test.yml | 16 +++++------ poetry.lock | 58 +++++--------------------------------- pyproject.toml | 8 ++---- tox.ini | 3 -- 4 files changed, 16 insertions(+), 69 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7dd453c..ad7e0d6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,8 +17,14 @@ jobs: steps: - name: Install gettext + # https://github.com/translate/translate/blob/master/.github/workflows/test.yml#L52C33-L52C76 run: | - sudo apt-get update && sudo apt-get install -y gettext + sudo apt-get update && sudo apt-get install -y libgettextpo-dev libxml2-dev libxmlsec1-dev gettext + + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + python -m pip install tox tox-gh-actions - uses: actions/checkout@v4 @@ -41,17 +47,9 @@ jobs: - name: Install requirements run: poetry install - # - name: Install django ${{ matrix.django-version }} - # run: poetry add "django@~=${{ matrix.django-version }}" - - name: Django check run: poetry run python manage.py check - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install tox tox-gh-actions - - name: Run tests run: tox env: diff --git a/poetry.lock b/poetry.lock index 981e1a4..a9b1009 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,10 +1,9 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "asgiref" version = "3.6.0" description = "ASGI specs, helper code, and adapters" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -19,7 +18,6 @@ tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"] name = "attrs" version = "22.2.0" description = "Classes Without Boilerplate" -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -38,7 +36,6 @@ tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", "mypy name = "backports-zoneinfo" version = "0.2.1" description = "Backport of the standard library zoneinfo module" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -67,7 +64,6 @@ tzdata = ["tzdata"] name = "black" version = "23.1.0" description = "The uncompromising code formatter." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -117,7 +113,6 @@ uvloop = ["uvloop (>=0.15.2)"] name = "cfgv" version = "3.3.1" description = "Validate configuration and produce human readable error messages." -category = "dev" optional = false python-versions = ">=3.6.1" files = [ @@ -129,7 +124,6 @@ files = [ name = "click" version = "8.1.3" description = "Composable command line interface toolkit" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -144,7 +138,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." -category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -156,7 +149,6 @@ files = [ name = "coverage" version = "7.2.1" description = "Code coverage measurement for Python" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -223,7 +215,6 @@ toml = ["tomli"] name = "distlib" version = "0.3.6" description = "Distribution utilities" -category = "dev" optional = false python-versions = "*" files = [ @@ -233,20 +224,19 @@ files = [ [[package]] name = "django" -version = "4.1.7" +version = "4.2.11" description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." -category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "Django-4.1.7-py3-none-any.whl", hash = "sha256:f2f431e75adc40039ace496ad3b9f17227022e8b11566f4b363da44c7e44761e"}, - {file = "Django-4.1.7.tar.gz", hash = "sha256:44f714b81c5f190d9d2ddad01a532fe502fa01c4cb8faf1d081f4264ed15dcd8"}, + {file = "Django-4.2.11-py3-none-any.whl", hash = "sha256:ddc24a0a8280a0430baa37aff11f28574720af05888c62b7cfe71d219f4599d3"}, + {file = "Django-4.2.11.tar.gz", hash = "sha256:6e6ff3db2d8dd0c986b4eec8554c8e4f919b5c1ff62a5b4390c17aff2ed6e5c4"}, ] [package.dependencies] -asgiref = ">=3.5.2,<4" +asgiref = ">=3.6.0,<4" "backports.zoneinfo" = {version = "*", markers = "python_version < \"3.9\""} -sqlparse = ">=0.2.2" +sqlparse = ">=0.3.1" tzdata = {version = "*", markers = "sys_platform == \"win32\""} [package.extras] @@ -257,7 +247,6 @@ bcrypt = ["bcrypt"] name = "django-stubs" version = "1.15.0" description = "Mypy stubs for Django" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -284,7 +273,6 @@ compatible-mypy = ["mypy (>=1.0,<1.1)"] name = "django-stubs-ext" version = "0.7.0" description = "Monkey-patching and extensions for django-stubs" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -300,7 +288,6 @@ typing-extensions = "*" name = "exceptiongroup" version = "1.1.0" description = "Backport of PEP 654 (exception groups)" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -315,7 +302,6 @@ test = ["pytest (>=6)"] name = "execnet" version = "1.9.0" description = "execnet: rapid multi-Python deployment" -category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -330,7 +316,6 @@ testing = ["pre-commit"] name = "filelock" version = "3.9.0" description = "A platform independent file lock." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -346,7 +331,6 @@ testing = ["covdefaults (>=2.2.2)", "coverage (>=7.0.1)", "pytest (>=7.2)", "pyt name = "identify" version = "2.5.20" description = "File identification library for Python" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -361,7 +345,6 @@ license = ["ukkonen"] name = "importlib-metadata" version = "6.0.0" description = "Read metadata from Python packages" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -381,7 +364,6 @@ testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packag name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -393,7 +375,6 @@ files = [ name = "lxml" version = "4.9.2" description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API." -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, != 3.4.*" files = [ @@ -486,7 +467,6 @@ source = ["Cython (>=0.29.7)"] name = "mypy" version = "1.0.1" description = "Optional static typing for Python" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -533,7 +513,6 @@ reports = ["lxml"] name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." -category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -545,7 +524,6 @@ files = [ name = "nodeenv" version = "1.7.0" description = "Node.js virtual environment builder" -category = "dev" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" files = [ @@ -560,7 +538,6 @@ setuptools = "*" name = "packaging" version = "23.0" description = "Core utilities for Python packages" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -572,7 +549,6 @@ files = [ name = "pathspec" version = "0.11.0" description = "Utility library for gitignore style pattern matching of file paths." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -584,7 +560,6 @@ files = [ name = "platformdirs" version = "3.1.1" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -600,7 +575,6 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2.1)", "pytes name = "pluggy" version = "1.0.0" description = "plugin and hook calling mechanisms for python" -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -616,7 +590,6 @@ testing = ["pytest", "pytest-benchmark"] name = "pre-commit" version = "3.1.1" description = "A framework for managing and maintaining multi-language pre-commit hooks." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -635,7 +608,6 @@ virtualenv = ">=20.10.0" name = "pytest" version = "7.2.2" description = "pytest: simple powerful testing with Python" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -659,7 +631,6 @@ testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2. name = "pytest-cov" version = "4.0.0" description = "Pytest plugin for measuring coverage." -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -678,7 +649,6 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtuale name = "pytest-django" version = "4.5.2" description = "A Django plugin for pytest." -category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -697,7 +667,6 @@ testing = ["Django", "django-configurations (>=2.0)"] name = "pytest-randomly" version = "3.12.0" description = "Pytest plugin to randomly order tests and control random.seed." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -713,7 +682,6 @@ pytest = "*" name = "pytest-xdist" version = "3.2.0" description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -734,7 +702,6 @@ testing = ["filelock"] name = "pyyaml" version = "6.0" description = "YAML parser and emitter for Python" -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -784,7 +751,6 @@ files = [ name = "ruff" version = "0.0.254" description = "An extremely fast Python linter, written in Rust." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -811,7 +777,6 @@ files = [ name = "setuptools" version = "67.6.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -828,7 +793,6 @@ testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs ( name = "sqlparse" version = "0.4.3" description = "A non-validating SQL parser." -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -840,7 +804,6 @@ files = [ name = "tomli" version = "2.0.1" description = "A lil' TOML parser" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -852,7 +815,6 @@ files = [ name = "translate-toolkit" version = "3.8.6" description = "Tools and API for translation and localization engineering." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -883,7 +845,6 @@ yaml = ["ruamel.yaml (==0.17.21)"] name = "types-pytz" version = "2022.7.1.2" description = "Typing stubs for pytz" -category = "dev" optional = false python-versions = "*" files = [ @@ -895,7 +856,6 @@ files = [ name = "types-pyyaml" version = "6.0.12.8" description = "Typing stubs for PyYAML" -category = "dev" optional = false python-versions = "*" files = [ @@ -907,7 +867,6 @@ files = [ name = "typing-extensions" version = "4.5.0" description = "Backported and Experimental Type Hints for Python 3.7+" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -919,7 +878,6 @@ files = [ name = "tzdata" version = "2022.7" description = "Provider of IANA time zone data" -category = "main" optional = false python-versions = ">=2" files = [ @@ -931,7 +889,6 @@ files = [ name = "virtualenv" version = "20.20.0" description = "Virtual Python Environment builder" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -952,7 +909,6 @@ test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess name = "zipp" version = "3.15.0" description = "Backport of pathlib-compatible object wrapper for zip files" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -967,4 +923,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "9ab451f06b185dae7aa6cb6ef1f7dec288ed1593a76551cb868a4dc45447b642" +content-hash = "ef2f76f520704af2222655ab12da579b479c741010a83fa0cf48d0e5617c18ce" diff --git a/pyproject.toml b/pyproject.toml index bb77022..4d822d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "django-fakemessages" version = "0.0.1" -description = "Generate fake language files" +description = "Generate fake PO language files" license = "MIT" authors = [ "Pascal Fouque ", @@ -33,7 +33,7 @@ packages = [{ include = "fakemessages" }] [tool.poetry.dependencies] python = "^3.8" -django = "^3.2 || ^4.0 || ^4.1 || ^4.2" +django = "^4.2 || ^5.0" translate-toolkit = "^3.8.5" [tool.poetry.group.dev.dependencies] @@ -49,10 +49,6 @@ pytest-randomly = "*" pytest-xdist = "*" ruff = "*" -[tool.black] -line-length = 90 -target-version = ['py38'] - [tool.ruff] line-length = 90 target-version = "py38" diff --git a/tox.ini b/tox.ini index 0afe161..bca9257 100644 --- a/tox.ini +++ b/tox.ini @@ -15,9 +15,6 @@ deps = commands = {posargs:python -m pytest} -[flake8] -max-line-length = 130 - [gh-actions] python = 3.8: py38