Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dependencies and modernize #66

Merged
merged 12 commits into from
Oct 5, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: deploy mkdocs gh-pages site
run: |
poetry run mkdocs gh-deploy --force
uv run mkdocs gh-deploy --force
31 changes: 14 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,32 @@ jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: install project
run: uv sync --all-extras --dev
- name: Run linters
run: |
poetry run pre-commit run --all-files
uv run pre-commit run --all-files

test:
needs: linting
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
uses: actions/checkout@v4
- name: Install python, uv, and this project
uses: 20c/workflows/uv@v1
- name: Run tests
run: tox
run: uv run tox
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
dist
coverage.xml
release.sh
.venv
30 changes: 15 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

fail_fast: true
fail_fast: false
exclude: |
(?x)^(
tests/data/.*
)$
repos:
- repo: local
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: system
name: isort
entry: poetry run isort .
language: system
pass_filenames: false
- id: check-yaml
- id: trailing-whitespace
- repo: local
hooks:
- id: pyupgrade
name: pyupgrade
entry: poetry run pyupgrade --py37-plus
entry: uv run pyupgrade --py36-plus
language: python
types: [python]
pass_filenames: true
- repo: local
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
hooks:
- id: system
name: Black
entry: poetry run black .
language: system
pass_filenames: false
- id: ruff
args: [--fix]
- id: ruff-format
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
## Unreleased


## 2.0.1
### Fixed
- unpin max django version
### Changed
- convert to uv


## 2.0.0
### Added
- python3.11 support
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Unreleased:
deprecated: []
removed: []
security: []
2.0.1:
fixed:
- unpin max django version
changed:
- convert to uv
2.0.0:
added:
- python3.11 support
Expand Down
8 changes: 8 additions & 0 deletions dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
2 changes: 1 addition & 1 deletion docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A user gets his permissions directly or from one of the auth Groups he is a memb

## Custom permission holders

Sometimes you want something else than a user or group model to hold
Sometimes you want something else than a user or group model to hold
permissions - an APIkey implementation for example

```py
Expand Down
1 change: 0 additions & 1 deletion examples/check_permissions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import grainy.const

from django_grainy.util import Permissions

user.grainy_permissions.add_permission_set({"a.b.c": "r"})
Expand Down
4 changes: 1 addition & 3 deletions examples/custom_permission_holder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db import models

from django_grainy.models import Permission, PermissionManager
from django_grainy.util import Permissions


class APIKey(models.Model):
Expand All @@ -19,8 +19,6 @@ class APIKeyPermission(Permission):
objects = PermissionManager()


from django_grainy.util import Permissions

api_key = APIKey.objects.create(key="test")
api_key.grainy_permissions.add_permission("a.b.c", "r")

Expand Down
3 changes: 1 addition & 2 deletions examples/grainy_rest_viewset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from rest_framework import serializers

from django_grainy.decorators import grainy_rest_viewset
from rest_framework import serializers

from .models import TestModelA

Expand Down
3 changes: 1 addition & 2 deletions examples/grainy_view.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.views import View as BaseView

from django_grainy.decorators import grainy_view


Expand Down Expand Up @@ -47,5 +46,5 @@ def detail_view(request, id):
# ignore the user's superuser priviledges
ignore_grant_all=True,
)
def detail_view(request, id):
def detail_view(request, id): # noqa: F811
return HttpResponse()
1 change: 0 additions & 1 deletion examples/grainy_view_manual_a.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.views import BaseView

from django_grainy.decorators import grainy_view


Expand Down
1 change: 0 additions & 1 deletion examples/grainy_view_manual_b.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.views import BaseView

from django_grainy.decorators import grainy_view_response


Expand Down
1 change: 0 additions & 1 deletion examples/grainy_view_manual_c.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.views import BaseView

from django_grainy.decorators import grainy_view, grainy_view_response


Expand Down
2 changes: 0 additions & 2 deletions examples/remote/receiver/permissions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from django.conf import settings

import django_grainy.remote


Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site_name: django-grainy
site_name: django-grainy
site_url: https://github.com/20c/grainy-perms

theme: readthedocs
Expand Down
Loading
Loading