From 3db3475326606d14a9301da5e579df1fe1fb6731 Mon Sep 17 00:00:00 2001 From: Oliver Andrich Date: Sun, 15 Sep 2024 11:33:54 +0200 Subject: [PATCH] Project cleanup - Set the minimum supported version of Python to 3.9. - Set the minimum supported version of Django to 4.2. - Switched the tooling completely to [uv](https://docs.astral.sh/uv/). - Bumped the default version of Tailwind CSS to 3.4.11. --- .github/workflows/publish.yml | 22 +++++++++++++--------- CHANGELOG.md | 7 +++++++ README.md | 24 ++++++++---------------- docs/settings.md | 2 +- pyproject.toml | 7 +++++-- src/django_tailwind_cli/__init__.py | 4 +++- src/django_tailwind_cli/utils.py | 2 +- tests/test_utils.py | 14 +++++++------- 8 files changed, 45 insertions(+), 37 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 987f475..ba14683 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,20 +16,24 @@ jobs: with: python-version: "3.12" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flit mkdocs-material + - name: Install and setup uv + uses: hynek/setup-cached-uv@v2 + + - name: Build + run: uv build + + - name: Check + run: uvx twine check dist/* - name: Publish run: | - flit publish + uvx twine upload dist/* env: - FLIT_USERNAME: __token__ - FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }} + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - name: Build documentation - run: mkdocs build + run: uvx --with mkdocs-material mkdocs build - name: Publish documentation - run: mkdocs gh-deploy --force + run: uvx --with mkdocs-material mkdocs gh-deploy --force diff --git a/CHANGELOG.md b/CHANGELOG.md index 1866e2d..83285bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2.16.0 + +- Set the minimum supported version of Python to 3.9. +- Set the minimum supported version of Django to 4.2. +- Switched the tooling completely to [uv](https://docs.astral.sh/uv/). +- Bumped the default version of Tailwind CSS to 3.4.11. + ## 2.15.0 - [#130](https://github.com/oliverandrich/django-tailwind-cli/pull/130) by [@Tobi-De](https://github.com/Tobi-De) extended the support for custom tailwind cli builds. See `TAILWIND_CLI_SRC_REPO` and `TAILWIND_CLI_ASSET_NAME` in the documentation. diff --git a/README.md b/README.md index ab3d83d..b416fe3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/oliverandrich/django-tailwind-cli/test.yml?style=flat-square) [![PyPI](https://img.shields.io/pypi/v/django-tailwind-cli.svg?style=flat-square)](https://pypi.org/project/django-tailwind-cli/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black) +[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv) ![GitHub](https://img.shields.io/github/license/oliverandrich/django-tailwind-cli?style=flat-square) ![Django Versions](https://img.shields.io/pypi/frameworkversions/django/django-tailwind-cli) ![Python Versions](https://img.shields.io/pypi/pyversions/django-tailwind-cli) @@ -72,7 +73,7 @@ Checkout the detailed [installation guide](https://django-tailwind-cli.andrich.m ## Requirements -Python 3.8 or newer with Django >= 3.2. +Python 3.9 or newer with Django >= 4.2. ## Documentation @@ -80,9 +81,7 @@ The documentation can be found at [https://django-tailwind-cli.andrich.me/](http ## Contributing -In order to contribute, this package has no required tool dependencies besides an installed version -of Python and pip. But you can use uv to speed up your workflow a bit. The following commands assume -that you have already setup a virtual environment and activated it. +This package requires [uv](https://docs.astral.sh/uv/) for dependency management and tooling. So you have to [install it](https://docs.astral.sh/uv/getting-started/installation/) first. [just](https://github.com/casey/just) is used as a handy command runner to save some typing on the command line. Do yourself a favor and install it too. ```shell # Setup development environment @@ -98,24 +97,17 @@ just lint just test ``` -### Without just, but using pip - -```bash -# Install dependencies -pip3 install -e ".[django-extensions,dev,docs]" - -# Run tox testrunner -tox -``` - ### Without just, but using uv ```bash +# Create venv +uv venv + # Install dependencies -uv pip install -r pyproject.toml --all-extras -e . +uv sync --all-extras # Run tox testrunner -tox +uvx --with tox-uv tox ``` ## License diff --git a/docs/settings.md b/docs/settings.md index baeb9e5..1a9c2dc 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -11,7 +11,7 @@ The package can be configured by a few settings, which can be overwritten in the your project. `TAILWIND_CLI_VERSION` -: **Default**: `"3.4.10"` +: **Default**: `"3.4.11"` This defines the version of the CLI and of Tailwind CSS you want to use in your project. diff --git a/pyproject.toml b/pyproject.toml index 55bf20e..7257c6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ "Framework :: Django :: 5.0", "Framework :: Django :: 5.1", ] -version = "2.15.0" +dynamic = ["version"] requires-python = ">=3.9" dependencies = [ "django>=4.2", @@ -48,9 +48,12 @@ dev-dependencies = [ ] [build-system] -requires = ["hatchling"] +requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" +[tool.hatch.version] +source = "vcs" + # Black [tool.black] target-version = ["py38"] diff --git a/src/django_tailwind_cli/__init__.py b/src/django_tailwind_cli/__init__.py index 90c1ae3..89b6dbb 100644 --- a/src/django_tailwind_cli/__init__.py +++ b/src/django_tailwind_cli/__init__.py @@ -1 +1,3 @@ -__version__ = "2.15.0" +from importlib.metadata import version + +__version__ = version("django-tailwind-cli") diff --git a/src/django_tailwind_cli/utils.py b/src/django_tailwind_cli/utils.py index 9aeee3c..c91c3c1 100644 --- a/src/django_tailwind_cli/utils.py +++ b/src/django_tailwind_cli/utils.py @@ -20,7 +20,7 @@ class Config: @property def tailwind_version(self) -> str: - return getattr(settings, "TAILWIND_CLI_VERSION", "3.4.10") + return getattr(settings, "TAILWIND_CLI_VERSION", "3.4.11") @property def cli_path(self) -> Union[Path, None]: diff --git a/tests/test_utils.py b/tests/test_utils.py index b0aba43..24e15b2 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -9,13 +9,13 @@ def configure_settings(settings): def test_default_config(config): - assert "3.4.10" == config.tailwind_version + assert "3.4.11" == config.tailwind_version assert Path("~/.local/bin/").expanduser() == config.cli_path assert config.src_css is None assert "css/tailwind.css" == config.dist_css assert "tailwind.config.js" == config.config_file - assert "3.4.10" in config.get_download_url() - assert "3.4.10" in str(config.get_full_cli_path()) + assert "3.4.11" in config.get_download_url() + assert "3.4.11" in str(config.get_full_cli_path()) def test_validate_settigns(config, settings): @@ -99,10 +99,10 @@ def test_get_download_url(config, mocker, platform, machine, result): @pytest.mark.parametrize( "platform,machine,result", [ - ("Windows", "x86_64", "tailwindcss-windows-x64-3.4.10.exe"), - ("Windows", "amd64", "tailwindcss-windows-x64-3.4.10.exe"), - ("Darwin", "aarch64", "tailwindcss-macos-arm64-3.4.10"), - ("Darwin", "arm64", "tailwindcss-macos-arm64-3.4.10"), + ("Windows", "x86_64", "tailwindcss-windows-x64-3.4.11.exe"), + ("Windows", "amd64", "tailwindcss-windows-x64-3.4.11.exe"), + ("Darwin", "aarch64", "tailwindcss-macos-arm64-3.4.11"), + ("Darwin", "arm64", "tailwindcss-macos-arm64-3.4.11"), ], ) def test_get_full_cli_path(config, mocker, platform, machine, result):