Skip to content

Commit dc63db4

Browse files
vegugablooge
andauthored
Modernize 202305 (#57)
* remove codecov and poetry relock * Update dependencies to support Django 4.2 (#56) * Remove deprecated import * fix: list to tuple * remove py3.7 add py3.11 * fix test workflow add codeql workflow * fix tox.ini * changelog * changelog * README * linting * inlines to tuple always * router.urls * Update tox.ini --------- Co-authored-by: Samsul Hadi <samsulhadikediri@gmail.com>
1 parent 91f3f61 commit dc63db4

28 files changed

+1006
-844
lines changed

.github/workflows/codeql.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '40 8 * * 6'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript', 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2
73+
with:
74+
category: "/language:${{matrix.language}}"

.github/workflows/tests.yml

+11-12
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,16 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- name: Install virtualenv from poetry
1212
uses: 20c/workflows/poetry@v1
13-
# poetry run pre-commit run --all-files
1413
- name: Run linters
1514
run: |
16-
poetry run pre-commit run --all-files
15+
poetry run pre-commit run --all-files
1716
1817
test:
19-
needs: linting
2018
strategy:
21-
fail-fast: false
19+
fail-fast: true
2220
matrix:
2321
os: [ "ubuntu-latest", "macos-latest" ]
24-
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
22+
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
2523
runs-on: ${{ matrix.os }}
2624
steps:
2725
- name: Check out repository
@@ -30,13 +28,14 @@ jobs:
3028
uses: 20c/workflows/poetry@v1
3129
with:
3230
python-version: ${{ matrix.python-version }}
33-
- name: Run tests
31+
- name: Install dependencies
3432
run: |
35-
poetry run tox
36-
poetry run coverage report
37-
# upload coverage stats
33+
python -m pip install --upgrade pip
34+
pip install tox tox-gh-actions
35+
- name: Run tests
36+
run: tox
3837
- name: Upload coverage
39-
uses: codecov/codecov-action@v1
38+
uses: codecov/codecov-action@v3
4039
with:
41-
file: ./coverage.xml
42-
fail_ci_if_error: true
40+
fail_ci_if_error: true
41+
token: ${{ secrets.CODECOV_TOKEN }}

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33

44
## Unreleased
55
### Added
6+
- python3.11 support
67
- python3.10 support
78
- django4 support
9+
- django4.2 support
810
- django3.2 support
911
### Removed
1012
- python3.6 support
13+
- python3.7 support
1114
- django2.2 support
1215
- django3.0 support
1316
- django3.1 support

CHANGELOG.yaml

+106-107
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,130 @@
1-
1.0.0:
1+
Unreleased:
22
added:
3-
- grainy authentication backend
4-
- django admin integration
5-
- str_flags function
6-
- PermissioManager.add_permission
7-
- Default permissions for AnonymousUser
8-
- decorators.grainy_view
9-
- decorators.grainy_rest_viewset
10-
- helpers.dict_get_namespace
11-
- helpers.request_method_to_flag
12-
- helpers.request_to_flag
13-
- util.Permissions.grant_all property
14-
- conf.REQUEST_METHOD_TO_FLAG
15-
changed:
16-
- renamed `convert_flags` to `int_flags`
17-
- moved `str_flags` and `int_flags` functions from util.py to helpers.py
18-
- moved `namespace` function from util.py to models.py
19-
- removed `clear` argument from `PermissionManager.add_permission_set`
3+
- python3.11 support
4+
- python3.10 support
5+
- django4 support
6+
- django4.2 support
7+
- django3.2 support
8+
removed:
9+
- python3.6 support
10+
- python3.7 support
11+
- django2.2 support
12+
- django3.0 support
13+
- django3.1 support
14+
1.9.1:
2015
fixed:
21-
- util.Permissions now accepts AnonynmousUser as object
22-
1.1.0:
23-
added:
24-
- Passing a `tuple` or `list` to `helpers.namespace` will now return a joint namespace
25-
of all contained elements
26-
- Implemented `util.Permissions.instances` method to retrieve all instances of a
27-
model according to permissions
28-
- '`decorators.grainy_view` decorator can now use url parameters to format it s
29-
namespace'
30-
1.2.0:
16+
- bug where group permissions overwrote direct permissions
17+
1.9.0:
3118
added:
32-
- 'Permissions.instances(): add `explicit` keyword argument'
33-
- 'Permissions.instances(): add `ignore_grant_all` keyword argument'
34-
- 'Permissions.check(): add `ignore_grant_all` keyword argument'
35-
1.2.1:
19+
- python3.9 support
20+
- django3.1 support
21+
- added rest.ModelViewSetPermission django-rest-framework permission class
22+
- added grainy_namespace property to decorated models
23+
- added util.check_permissions helper function
24+
- added util.get_permissions helper function
25+
- added GRAINY_ANONYMOUS_GROUP setting
3626
fixed:
37-
- Template files not being installed
38-
1.3.0:
27+
- fix django-admin user and group admin view unregister
28+
- fix instance namespacing on decorated models that have a grainy parent defined
29+
changed:
30+
- grainy handler classes moved to handlers.py to prevent circular depdendency issue
31+
1.8.0:
3932
added:
40-
- 'grainy_model: allow specifying of custom instance namespace formatting'
41-
- 'grainy_view: impl explicit namespace handling during request gating'
42-
1.4.0:
33+
- remote grainy permissions
34+
- field level permission checks when POST/PUT/PATCHing to REST api (#14)
35+
- python3.8 support
36+
changed:
37+
- 'fix #36: Grainy decorators should allow setting of Permissions class to use for
38+
permission checks'
39+
removed:
40+
- python2.7 support
41+
- python3.4 support
42+
- python3.5 support
43+
- django1.11 support
44+
1.7.0:
4345
added:
44-
- implemented `decorators.grainy_view_response`
45-
- implemented `decorators.grainy_json_view_response`
46-
- implemented `decorators.grainy_rest_viewset_response`
46+
- tests for django 2.1
47+
- 'fix #33: easy namespace inheritance through related models'
48+
- 'fix #31: add delete_permission function to grainy manager'
49+
- 'fix #35: Custom permission holder implementation'
50+
fixed:
51+
- 'admin inlines: sort by namespace alphabetically (#24)'
4752
changed:
48-
- '`decorators.grainy_view` now simply decorates all response handlers'
49-
- '`decorators.grainy_json_view` now simply decorates all response handlers'
50-
- '`decorators.grainy_rest_viewset` now simply decorates all response handlers'
53+
- move from facsimile to Ctl (#32)
54+
1.6.2:
55+
fixed:
56+
- when applying perms to a grainy view response, make sure to return the proper
57+
container when it is empty
58+
1.6.1:
59+
fixed:
60+
- Fixed issue with namespace formatting for grainy views that was introduced in
61+
1.6.0 where trying to format using url parameters would raise a KeyError
62+
1.6.0:
63+
added:
64+
- grainy view decorators can now access the request object when formatting namespaces
65+
- you can now use extra keyword arguments passed to `Grainy.namespace` and `helpers.namespace`
66+
to further format the namespace string
67+
changed:
68+
- 'grainy view decorators: renamed `explicit_object` to `explicit_instance`'
5169
1.5.0:
5270
added:
5371
- '`util.Permissions.get` now accepts the `explicit` keyword argument'
5472
- '`decorators.grainy_view` now accepts the `explicit_object` keyword argument'
73+
fixed:
74+
- '`util.Permissions.get` now works correctly'
5575
changed:
5676
- '`decorators.grainy_view` request GET parameters now available for namespace formatting'
5777
- '`decorators.grainy_view` get_object() now available as `instance` for base namespace
5878
formatting if it exists'
5979
- '`decorators.grainy_decorator` decorator namespaces can now be passed as lists
6080
in which case the resulting namespace is a joint namespace of all the elements'
61-
fixed:
62-
- '`util.Permissions.get` now works correctly'
63-
1.6.0:
81+
1.4.0:
6482
added:
65-
- grainy view decorators can now access the request object when formatting namespaces
66-
- you can now use extra keyword arguments passed to `Grainy.namespace` and `helpers.namespace`
67-
to further format the namespace string
83+
- implemented `decorators.grainy_view_response`
84+
- implemented `decorators.grainy_json_view_response`
85+
- implemented `decorators.grainy_rest_viewset_response`
6886
changed:
69-
- 'grainy view decorators: renamed `explicit_object` to `explicit_instance`'
70-
1.6.1:
71-
fixed:
72-
- Fixed issue with namespace formatting for grainy views that was introduced in
73-
1.6.0 where trying to format using url parameters would raise a KeyError
74-
1.6.2:
75-
fixed:
76-
- when applying perms to a grainy view response, make sure to return the proper
77-
container when it is empty
78-
1.7.0:
87+
- '`decorators.grainy_view` now simply decorates all response handlers'
88+
- '`decorators.grainy_json_view` now simply decorates all response handlers'
89+
- '`decorators.grainy_rest_viewset` now simply decorates all response handlers'
90+
1.3.0:
7991
added:
80-
- tests for django 2.1
81-
- 'fix #33: easy namespace inheritance through related models'
82-
- 'fix #31: add delete_permission function to grainy manager'
83-
- 'fix #35: Custom permission holder implementation'
84-
changed:
85-
- move from facsimile to Ctl (#32)
92+
- 'grainy_model: allow specifying of custom instance namespace formatting'
93+
- 'grainy_view: impl explicit namespace handling during request gating'
94+
1.2.1:
8695
fixed:
87-
- 'admin inlines: sort by namespace alphabetically (#24)'
88-
1.8.0:
96+
- Template files not being installed
97+
1.2.0:
8998
added:
90-
- remote grainy permissions
91-
- field level permission checks when POST/PUT/PATCHing to REST api (#14)
92-
- python3.8 support
93-
changed:
94-
- 'fix #36: Grainy decorators should allow setting of Permissions class to use for
95-
permission checks'
96-
removed:
97-
- python2.7 support
98-
- python3.4 support
99-
- python3.5 support
100-
- django1.11 support
101-
1.9.0:
99+
- 'Permissions.instances(): add `explicit` keyword argument'
100+
- 'Permissions.instances(): add `ignore_grant_all` keyword argument'
101+
- 'Permissions.check(): add `ignore_grant_all` keyword argument'
102+
1.1.0:
102103
added:
103-
- python3.9 support
104-
- django3.1 support
105-
- added rest.ModelViewSetPermission django-rest-framework permission class
106-
- added grainy_namespace property to decorated models
107-
- added util.check_permissions helper function
108-
- added util.get_permissions helper function
109-
- added GRAINY_ANONYMOUS_GROUP setting
110-
changed:
111-
- grainy handler classes moved to handlers.py to prevent circular depdendency issue
112-
fixed:
113-
- fix django-admin user and group admin view unregister
114-
- fix instance namespacing on decorated models that have a grainy parent defined
115-
1.9.1:
116-
fixed:
117-
- bug where group permissions overwrote direct permissions
118-
Unreleased:
104+
- Passing a `tuple` or `list` to `helpers.namespace` will now return a joint namespace
105+
of all contained elements
106+
- Implemented `util.Permissions.instances` method to retrieve all instances of a
107+
model according to permissions
108+
- '`decorators.grainy_view` decorator can now use url parameters to format it s
109+
namespace'
110+
1.0.0:
119111
added:
120-
- python3.10 support
121-
- django4 support
122-
- django3.2 support
123-
changed: []
124-
deprecated: []
125-
fixed: []
126-
removed:
127-
- python3.6 support
128-
- django2.2 support
129-
- django3.0 support
130-
- django3.1 support
131-
security: []
112+
- grainy authentication backend
113+
- django admin integration
114+
- str_flags function
115+
- PermissioManager.add_permission
116+
- Default permissions for AnonymousUser
117+
- decorators.grainy_view
118+
- decorators.grainy_rest_viewset
119+
- helpers.dict_get_namespace
120+
- helpers.request_method_to_flag
121+
- helpers.request_to_flag
122+
- util.Permissions.grant_all property
123+
- conf.REQUEST_METHOD_TO_FLAG
124+
fixed:
125+
- util.Permissions now accepts AnonynmousUser as object
126+
changed:
127+
- renamed `convert_flags` to `int_flags`
128+
- moved `str_flags` and `int_flags` functions from util.py to helpers.py
129+
- moved `namespace` function from util.py to models.py
130+
- removed `clear` argument from `PermissionManager.add_permission_set`

0 commit comments

Comments
 (0)