Skip to content

Commit aebda49

Browse files
authored
Merge pull request #29 from financica/master
Modernize / Recent Python+Django compat
2 parents 121ecd0 + f56fe24 commit aebda49

30 files changed

+1043
-975
lines changed

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
exclude = .git,__pycache__,migrations
3+
max-complexity = 10
4+
max-line-length = 88

.github/workflows/linting.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [master]
9+
10+
jobs:
11+
linting:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.10"
18+
19+
- name: Install poetry
20+
run: curl -sSL https://install.python-poetry.org | python3 -
21+
22+
- name: Install package
23+
run: poetry install --with dev
24+
25+
- name: Run pre-commit
26+
run: poetry run pre-commit run --all-files --show-diff-on-failure

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/build/
1+
/poetry.lock
22
/dist/
3-
/django_postgres_composite_types.egg-info/
4-
/.eggs/
5-
/requirements.txt
6-
/test_requirements.txt
73
__pycache__
84
/.tox

.pre-commit-config.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
exclude: ".git|.tox|.pytest_cache"
2+
default_stages: [commit]
3+
fail_fast: true
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: "v4.3.0"
8+
hooks:
9+
- id: check-builtin-literals
10+
- id: check-case-conflict
11+
- id: check-merge-conflict
12+
- id: check-toml
13+
- id: check-yaml
14+
- id: end-of-file-fixer
15+
- id: fix-byte-order-marker
16+
- id: mixed-line-ending
17+
- id: trailing-whitespace
18+
19+
- repo: https://github.com/psf/black
20+
rev: "22.8.0"
21+
hooks:
22+
- id: black
23+
24+
- repo: https://github.com/asottile/pyupgrade
25+
rev: v3.2.2
26+
hooks:
27+
- id: pyupgrade
28+
29+
- repo: https://github.com/dosisod/refurb
30+
rev: "v1.8.0"
31+
hooks:
32+
- id: refurb
33+
34+
- repo: https://github.com/adamchainz/django-upgrade
35+
rev: "1.12.0"
36+
hooks:
37+
- id: django-upgrade
38+
args: [--target-version, "3.2"]
39+
40+
- repo: https://github.com/timothycrosley/isort
41+
rev: "5.10.1"
42+
hooks:
43+
- id: isort
44+
45+
- repo: https://github.com/pycqa/flake8
46+
rev: "5.0.4"
47+
hooks:
48+
- id: flake8
49+
50+
- repo: local
51+
hooks:
52+
- id: pylint
53+
name: pylint
54+
entry: env DJANGO_SETTINGS_MODULE="tests.settings" pylint
55+
language: system
56+
types: [python]
57+
args: ["--ignore-paths=tests/"]

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
(c) 2016, Danielle Madeley <danielle@madeley.id.au>
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
3. Neither the name of the copyright holder nor the names of its contributors
15+
may be used to endorse or promote products derived from this software
16+
without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 13 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
Django Postgres composite types
2-
===============================
1+
# Django Postgres composite types
32

43
An implementation of Postgres' [composite types](http://www.postgresql.org/docs/current/static/rowtypes.html)
54
for [Django](https://docs.djangoproject.com/en/1.9/).
65

7-
Usage
8-
-----
6+
## Usage
97

108
Install with:
119

@@ -66,8 +64,7 @@ class Migration(migrations.Migration):
6664
]
6765
```
6866

69-
Examples
70-
--------
67+
## Examples
7168

7269
Array fields:
7370

@@ -93,7 +90,6 @@ Nested types:
9390
class Point(CompositeType):
9491
"""A point on the cartesian plane."""
9592

96-
# pylint:disable=invalid-name
9793
x = models.IntegerField()
9894
y = models.IntegerField()
9995

@@ -110,10 +106,9 @@ class Box(CompositeType):
110106
bottom_right = Point.Field()
111107
```
112108

113-
Gotchas and Caveats
114-
-------------------
109+
## Gotchas and Caveats
115110

116-
The migration operation currently loads the *current* state of the type, not
111+
The migration operation currently loads the _current_ state of the type, not
117112
the state when the migration was written. A generic `CreateType` operation
118113
which takes the fields of the type would be possible, but it would still
119114
require manual handling still as Django's `makemigrations` is not currently
@@ -144,8 +139,8 @@ Lookups and indexes are not implemented yet
144139
([bug #9](https://github.com/danni/django-postgres-composite-types/issues/9),
145140
[bug #10](https://github.com/danni/django-postgres-composite-types/issues/10)).
146141

147-
Running Tests
148-
-------------------
142+
## Running Tests
143+
149144
Clone the repository, go to it's base directory and run the following commands.
150145

151146
pip install tox
@@ -155,40 +150,12 @@ Or if you want a specific environment
155150

156151
tox -e py35-dj2.0
157152

158-
Authors
159-
-------
160-
161-
* Danielle Madeley <danielle@madeley.id.au>
162-
* Tim Heap <hello@timheap.me>
163-
164-
License
165-
-------
166-
167-
(c) 2016, Danielle Madeley <danielle@madeley.id.au>
168-
169-
All rights reserved.
170-
171-
Redistribution and use in source and binary forms, with or without
172-
modification, are permitted provided that the following conditions are met:
173-
174-
1. Redistributions of source code must retain the above copyright notice, this
175-
list of conditions and the following disclaimer.
153+
## Authors
176154

177-
2. Redistributions in binary form must reproduce the above copyright notice,
178-
this list of conditions and the following disclaimer in the documentation
179-
and/or other materials provided with the distribution.
155+
- Danielle Madeley <danielle@madeley.id.au>
156+
- Tim Heap <hello@timheap.me>
180157

181-
3. Neither the name of the copyright holder nor the names of its contributors
182-
may be used to endorse or promote products derived from this software
183-
without specific prior written permission.
158+
## License
184159

185-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
186-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
187-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
188-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
189-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
190-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
191-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
192-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
193-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
194-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
160+
This project is licensed under the BSD license.
161+
See the LICENSE file for the full text of the license.

0 commit comments

Comments
 (0)