Skip to content

Commit 3a515ad

Browse files
committed
Allow reading data from stdin
1 parent 352d5d2 commit 3a515ad

File tree

4 files changed

+33
-34
lines changed

4 files changed

+33
-34
lines changed

.pre-commit-config.yaml

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: ".yarn/|yarn.lock|\\.min\\.(css|js)$"
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
4+
rev: v4.6.0
55
hooks:
66
- id: check-added-large-files
77
- id: check-builtin-literals
@@ -14,33 +14,30 @@ repos:
1414
- id: mixed-line-ending
1515
- id: trailing-whitespace
1616
- repo: https://github.com/adamchainz/django-upgrade
17-
rev: 1.13.0
17+
rev: 1.17.0
1818
hooks:
1919
- id: django-upgrade
2020
args: [--target-version, "3.2"]
2121
- repo: https://github.com/MarcoGorelli/absolufy-imports
2222
rev: v0.3.1
2323
hooks:
2424
- id: absolufy-imports
25-
- repo: https://github.com/charliermarsh/ruff-pre-commit
26-
rev: "v0.0.272"
25+
- repo: https://github.com/astral-sh/ruff-pre-commit
26+
rev: "v0.4.4"
2727
hooks:
2828
- id: ruff
29-
- repo: https://github.com/psf/black
30-
rev: 23.3.0
31-
hooks:
32-
- id: black
29+
- id: ruff-format
3330
- repo: https://github.com/pre-commit/mirrors-prettier
34-
rev: v3.0.0-alpha.9-for-vscode
31+
rev: v3.1.0
3532
hooks:
3633
- id: prettier
3734
args: [--list-different, --no-semi]
3835
exclude: "^conf/|.*\\.html$"
3936
- repo: https://github.com/tox-dev/pyproject-fmt
40-
rev: 0.11.2
37+
rev: 2.1.3
4138
hooks:
4239
- id: pyproject-fmt
4340
- repo: https://github.com/abravalheri/validate-pyproject
44-
rev: v0.13
41+
rev: v0.18
4542
hooks:
4643
- id: validate-pyproject

CHANGELOG.rst

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Change log
55
`Next version`_
66
~~~~~~~~~~~~~~~
77

8+
- Added ``./manage.py f3dumpdata -`` which allows reading JSON data from stdin.
9+
810

911
0.6 (2023-06-12)
1012
~~~~~~~~~~~~~~~~

feincms3_data/management/commands/f3loaddata.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import sys
23

34
from django.core.management.base import BaseCommand
45

@@ -22,8 +23,11 @@ def add_arguments(self, parser):
2223

2324
def handle(self, *dumps, **options):
2425
for dump in dumps:
25-
with open(dump, encoding="utf-8") as f:
26-
data = json.load(f)
26+
if dump == "-":
27+
data = json.loads(sys.stdin.read())
28+
else:
29+
with open(dump, encoding="utf-8") as f:
30+
data = json.load(f)
2731
load_dump(
2832
data,
2933
progress=self.stderr.write if options["verbosity"] >= 2 else silence,

pyproject.toml

+17-21
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ requires = [
77
[project]
88
name = "feincms3-data"
99
readme = "README.rst"
10-
license = {text = "BSD-3-Clause"}
10+
license = { text = "BSD-3-Clause" }
1111
authors = [
12-
{ name = "Matthias Kestenholz", email = "[email protected]" },
12+
{ name = "Matthias Kestenholz", email = "[email protected]" },
1313
]
1414
requires-python = ">=3.8"
1515
classifiers = [
@@ -24,6 +24,7 @@ classifiers = [
2424
"Programming Language :: Python :: 3.9",
2525
"Programming Language :: Python :: 3.10",
2626
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
2728
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
2829
"Topic :: Software Development",
2930
"Topic :: Software Development :: Libraries :: Application Frameworks",
@@ -32,22 +33,26 @@ dynamic = [
3233
"version",
3334
]
3435
dependencies = [
35-
"Django>=3.2",
36+
"django>=3.2",
3637
]
37-
[project.optional-dependencies]
38-
tests = [
38+
optional-dependencies.tests = [
3939
"coverage",
4040
]
41-
[project.urls]
42-
Homepage = "https://github.com/matthiask/feincms3-data/"
41+
urls.Homepage = "https://github.com/matthiask/feincms3-data/"
4342

4443
[tool.hatch.version]
4544
path = "feincms3_data/__init__.py"
4645

4746
[tool.ruff]
47+
target-version = "py38"
48+
49+
fix = true
50+
show-fixes = true
4851
extend-select = [
4952
# pyflakes, pycodestyle
50-
"F", "E", "W",
53+
"F",
54+
"E",
55+
"W",
5156
# mmcabe
5257
"C90",
5358
# isort
@@ -89,21 +94,12 @@ extend-ignore = [
8994
# No line length errors
9095
"E501",
9196
]
92-
fix = true
93-
show-fixes = true
94-
target-version = "py38"
95-
96-
[tool.ruff.isort]
97-
combine-as-imports = true
98-
lines-after-imports = 2
99-
100-
[tool.ruff.mccabe]
101-
max-complexity = 15
102-
103-
[tool.ruff.per-file-ignores]
104-
"*/migrat*/*" = [
97+
mccabe.max-complexity = 15
98+
per-file-ignores."*/migrat*/*" = [
10599
# Allow using PascalCase model names in migrations
106100
"N806",
107101
# Ignore the fact that migration files are invalid module names
108102
"N999",
109103
]
104+
isort.combine-as-imports = true
105+
isort.lines-after-imports = 2

0 commit comments

Comments
 (0)