Skip to content

Commit 3502b5c

Browse files
committed
Added Makefile and fixed linting issues.
1 parent 11309ca commit 3502b5c

File tree

8 files changed

+1203
-9
lines changed

8 files changed

+1203
-9
lines changed

Makefile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
.EXPORT_ALL_VARIABLES:
2+
3+
POETRY_VERSION = 1.6.1
4+
POETRY ?= poetry
5+
6+
POETRY_INSTALLER_URL ?= https://install.python-poetry.org
7+
8+
-include $(DOTENV_BASE_FILE)
9+
-include $(DOTENV_LOCAL_FILE)
10+
11+
.PHONY: install-poetry
12+
install-poetry:
13+
curl -sSL $(POETRY_INSTALLER_URL) | python3
14+
$(POETRY) --version
15+
16+
.PHONY: install-packages
17+
install-packages:
18+
$(POETRY) install -vv $(opts)
19+
20+
.PHONY: lock-packages
21+
lock-packages:
22+
$(POETRY) lock -vv --no-update
23+
24+
.PHONY: update-packages
25+
update-packages:
26+
$(POETRY) update -vv
27+
28+
.PHONY: lint-black
29+
lint-black:
30+
$(POETRY) run black --check --diff .
31+
32+
.PHONY: lint-flake8
33+
lint-flake8:
34+
$(POETRY) run flake8
35+
36+
.PHONY: lint-isort
37+
lint-isort:
38+
$(POETRY) run isort --check-only --diff .
39+
40+
.PHONY: lint-mypy
41+
lint-mypy:
42+
$(POETRY) run mypy
43+
44+
.PHONY: lint-python
45+
lint-python: lint-black lint-flake8 lint-isort lint-mypy
46+
47+
.PHONY: lint
48+
lint: lint-python
49+
50+
.PHONY: fmt-black
51+
fmt-black:
52+
$(POETRY) run black .
53+
54+
.PHONY: fmt-isort
55+
fmt-isort:
56+
$(POETRY) run isort .
57+
58+
.PHONY: fmt
59+
fmt: fmt-black fmt-isort
60+
61+
.PHONY: test
62+
test:
63+
$(POETRY) run python -m pytest $(opts) $(call tests,.)
64+
65+
.PHONY: build
66+
build:
67+
$(POETRY) build
68+
69+
.PHONY: publish
70+
publish:
71+
$(POETRY) publish

eventsourcing_dynamodb/factory.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import boto3
23
from eventsourcing.persistence import (
34
AggregateRecorder,

eventsourcing_dynamodb/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import time
23
from dataclasses import dataclass
34

eventsourcing_dynamodb/recorders.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import logging
23
import time
34
from typing import Any, List, Sequence
@@ -108,7 +109,9 @@ def _get_events_from_dynamo(
108109
"Unable to access table %s in dynamo. %s"
109110
% (self.dynamo_table_name, e.response.get("Error", {}).get("Message"))
110111
)
111-
raise ValueError("Unable to access table %s" % (self.dynamo_table_name,))
112+
raise ValueError(
113+
"Unable to access table %s" % (self.dynamo_table_name,)
114+
) from e
112115

113116

114117
class DynamoApplicationRecorder(DynamoAggregateRecorder, ApplicationRecorder):

poetry.lock

Lines changed: 1120 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
[project]
1+
[tool.poetry]
22
name = "eventsourcing-dynamodb"
33
version = "0.1.0"
44
description = "Python package for eventsourcing with DynamoDB"
55
authors = [
6-
{name = "John Bywater",email = "john.bywater@appropriatesoftware.net"}
6+
"John Bywater <john.bywater@appropriatesoftware.net>",
77
]
8-
license = {text = "BSD 3-Clause"}
8+
license = "BSD 3-Clause"
99
classifiers = [
1010
# "Development Status :: 3 - Alpha",
1111
"Development Status :: 4 - Beta",

tests/test_application.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
# -*- coding: utf-8 -*-
12
import os
23
from decimal import Decimal
3-
from itertools import chain
44
from uuid import uuid4
55

66
from eventsourcing.application import Application, EventSourcedLog
77
from eventsourcing.domain import Aggregate, DomainEvent
8-
from eventsourcing.system import NotificationLogReader
98
from eventsourcing.tests.application import (
109
TIMEIT_FACTOR,
1110
BankAccounts,
@@ -52,8 +51,7 @@ def test_example_application(self) -> None:
5251
app = BankAccounts()
5352

5453
# Check the factory topic.
55-
self.assertEqual(get_topic(type(app.factory)),
56-
self.expected_factory_topic)
54+
self.assertEqual(get_topic(type(app.factory)), self.expected_factory_topic)
5755

5856
# Check AccountNotFound exception.
5957
with self.assertRaises(BankAccounts.AccountNotFoundError):

tests/test_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from eventsourcing_dynamodb.recorders import (
1616
DynamoAggregateRecorder,
1717
DynamoApplicationRecorder,
18-
DynamoProcessRecorder
18+
DynamoProcessRecorder,
1919
)
2020

2121

0 commit comments

Comments
 (0)