Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
types:
- published

env:
PYTHON_VERSION: "3.12"
UV_SYSTEM_PYTHON: 1

jobs:
publish:
name: Upload release to PyPI
Expand All @@ -16,34 +20,31 @@ jobs:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install latest version of Poetry
run: |
pipx install poetry
echo "/root/.local/bin" >> $GITHUB_PATH
echo "GITHUB_PATH:"
cat $GITHUB_PATH
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
cache: poetry
cache-dependency-path: pyproject.toml
- name: Get Poetry version
# Install the latest version of uv
# version:
python-version: ${{ env.PYTHON_VERSION }}
enable-cache: false
- name: Add version to environment vars
run: |
echo "GITHUB_PATH:"
cat $GITHUB_PATH
poetry --version
- name: Check pyproject.toml validity
run: poetry check --no-interaction
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install --no-interaction
- name: Build package
PROJECT_VERSION=$(uv version --short)
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
- name: Restore distribution files cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
dist/django_bigredbutton-${{ env.PROJECT_VERSION }}-py3-none-any.whl
dist/django_bigredbutton-${{ env.PROJECT_VERSION }}.tar.gz
key: build-distributions-${{ env.PROJECT_VERSION }}
- name: List distribution files
run: |
poetry build
ls -l dist/*.whl dist/*.tar.gz
- name: Publish package to PyPI
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
Expand Down
47 changes: 25 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,29 @@ on:
tags:
- "v*"

env:
PYTHON_VERSION: "3.12"
UV_SYSTEM_PYTHON: 1

jobs:
autorelease:
release:
name: Create release
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install latest version of Poetry
run: |
pipx install poetry
echo "/root/.local/bin" >> $GITHUB_PATH
echo "GITHUB_PATH:"
cat $GITHUB_PATH
- name: Set up Python
uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
cache: poetry
cache-dependency-path: pyproject.toml
- name: Get Poetry version
run: |
echo "GITHUB_PATH:"
cat $GITHUB_PATH
poetry --version
# Install the latest version of uv
# version:
python-version: ${{ env.PYTHON_VERSION }}
enable-cache: false
- name: Add version to environment vars
run: |
PROJECT_VERSION=$(poetry version --short)
PROJECT_VERSION=$(uv version --short)
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
- name: Check if tag version matches project version
run: |
Expand All @@ -42,10 +36,11 @@ jobs:
echo $PROJECT_VERSION
if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi
- name: Check pyproject.toml validity
run: poetry check --no-interaction
# https://github.com/astral-sh/uv/issues/9653#issuecomment-3591888192
run: uvx --from "validate-pyproject[all]" validate-pyproject ./pyproject.toml
- name: Build
run: |
poetry build
uv build
- name: Release Notes
run: |
if (git describe HEAD~ --tags --abbrev=0); then
Expand All @@ -60,5 +55,13 @@ jobs:
draft: true
fail_on_unmatched_files: true
files: |
dist/django_bigredbutton-${{env.PROJECT_VERSION}}-py3-none-any.whl
dist/django_bigredbutton-${{env.PROJECT_VERSION}}.tar.gz
dist/django_bigredbutton-${{ env.PROJECT_VERSION }}-py3-none-any.whl
dist/django_bigredbutton-${{ env.PROJECT_VERSION }}.tar.gz
# Save build artifacts so the publish workflow doesn't need to rebuild them
- name: Save distribution files
uses: actions/cache/save@v4
with:
path: |
dist/django_bigredbutton-${{ env.PROJECT_VERSION }}-py3-none-any.whl
dist/django_bigredbutton-${{ env.PROJECT_VERSION }}.tar.gz
key: build-distributions-${{ env.PROJECT_VERSION }}
56 changes: 41 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,58 @@
name: tests

on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

env:
UV_SYSTEM_PYTHON: 1
UV_LINK_MODE: copy

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12"]
django-version: ["4.2", "5.0", "5.1", "5.2"]

steps:
- uses: actions/checkout@v4
- name: Install latest version of Poetry
run: |
pipx install poetry
echo "/root/.local/bin" >> $GITHUB_PATH
echo "GITHUB_PATH:"
cat $GITHUB_PATH
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
# https://szeyusim.medium.com/optimizing-uv-in-github-actions-one-global-cache-to-rule-them-all-9c64b42aee7f
- name: Restore global uv cache
id: cache-restore
uses: actions/cache/restore@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: pyproject.toml
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-python${{ matrix.python-version }}-django${{ matrix.django-version }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-main-python${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
# Install the latest version of uv
# version:
python-version: "${{ matrix.python-version }}"
enable-cache: false
- run: |
poetry install --no-interaction --no-root
uv sync --all-extras --dev --python python${{ matrix.python-version }} --locked --inexact
uv add "Django~=${{ matrix.django-version }}"
- name: Run tests
run: |
poetry run pytest --cov
uv run pytest --cov
- name: Save uv caches
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,28 @@ repos:
- id: trailing-whitespace
- id: check-merge-conflict # check for files that contain merge conflict strings

- repo: https://github.com/python-poetry/poetry
rev: "2.2.1"
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.9.3
hooks:
- id: poetry-check
# - id: poetry-install
# Update the uv lockfile
- id: uv-lock

- repo: https://github.com/adamchainz/django-upgrade
rev: "1.28.0"
rev: "1.29.1"
hooks:
- id: django-upgrade
args: [--target-version, "4.2"]

- repo: https://github.com/asottile/pyupgrade
rev: "v3.20.0"
rev: "v3.21.2"
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.13.2
rev: v0.14.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ It can work with multiple session backends, and includes built-in templates for
poetry add django-bigredbutton
```

```sh
uv add django-bigredbutton
```

2. Add a session backend, like django-qsessions or django-user-sessions. You can
use the optional packaging shortcuts:

Expand All @@ -46,6 +50,10 @@ It can work with multiple session backends, and includes built-in templates for
poetry add 'django-bigredbutton[qsessions]'
```

```sh
uv add 'django-bigredbutton[qsessions]'
```

```sh
pip install 'django-bigredbutton[user-sessions]'
```
Expand All @@ -54,6 +62,10 @@ It can work with multiple session backends, and includes built-in templates for
poetry add 'django-bigredbutton[user-sessions]'
```

```sh
uv add 'django-bigredbutton[user-sessions]'
```

But there may be additional steps required for each session backend. Refer
to the documentation for your session backend package for their installation
instructions.
Expand Down
61 changes: 36 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry]
[tool.hatch.build.targets.sdist]
include = ["bigredbutton"]

[tool.hatch.build.targets.wheel]
include = ["bigredbutton"]

[project]
name = "django-bigredbutton"
version = "0.3.2"
version = "0.3.3"
description = "Django app that offers a big red button to sign out of all other user sessions"
authors = ["blag <blag@users.noreply.github.com>"]
authors = [{ name = "blag", email = "blag@users.noreply.github.com" }]
requires-python = ">=3.11"
readme = "README.md"
license = "MIT"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
Expand All @@ -16,37 +24,40 @@ classifiers = [
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP :: Session",
"Topic :: Security",
]
packages = [
{include = "bigredbutton"},
dependencies = [
"django>=4.0",
# Also required by django-qsessions, but we use types provided from it, so we require it as well
"user-agents>=2.2.0",
]

[tool.poetry.dependencies]
python = ">=3.11"
django = ">=4.0"
# Also required by django-qsessions, but we use types provided from it, so we require it as well
user-agents = ">=2.2.0"

[tool.poetry.group.qsessions.dependencies]
django-qsessions = ">=1.1.4"
[project.optional-dependencies]
qsessions = ["django-qsessions>=1.1.4"]
user-sessions = ["django-user-sessions>=2.0.0"]

[tool.poetry.group.user-sessions.dependencies]
django-user-sessions = ">=2.0.0"
[dependency-groups]
qsessions = ["django-qsessions>=1.1.4"]
user-sessions = ["django-user-sessions>=2.0.0"]
test = [
"coverage[toml]>=7.3.2,<8",
"geoip2>=4.7.0",
"pytest>=7.4.3",
"pytest-cov>=4.1.0",
"pytest-django>=4.6.0",
]

[tool.poetry.group.test.dependencies]
aiohttp = ">=3.9.0b0" # transitive dependency, previous versions are broken on Python 3.11/3.12
coverage = {extras = ["toml"], version = "^7.3.2"}
geoip2 = ">=4.7.0"
pytest = ">=7.4.3"
pytest-cov = ">=4.1.0"
pytest-django = ">=4.6.0"
[tool.uv]
default-groups = [
"qsessions",
"user-sessions",
"test",
]

[tool.coverage.run]
branch = true
Expand Down
Loading