Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit bae0201

Browse files
authored
Merge pull request #7 from hypoport/dev
- fix bug, when field is missing - add pyproject.toml & flit support for publishing
2 parents 334417f + d070dee commit bae0201

File tree

11 files changed

+205
-90
lines changed

11 files changed

+205
-90
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,4 @@ venv.bak/
122122
/.pytest_cache/
123123
/coverage_html_report/
124124
report.xml
125+
.vscode/

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ coverage:
2525
pipenv run pytest --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=aws_dataclasses tests
2626

2727
publish:
28-
pip install 'twine>=1.5.0'
29-
python setup.py sdist bdist_wheel
30-
twine upload dist/*
31-
rm -fr build dist .egg requests.egg-info
28+
flit --repository testpypi publish
3229

3330
docs:
3431
cd docs && make html

Pipfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ bumpversion = "*"
1515
pytest-cov = "*"
1616
pytest-xdist = "*"
1717
codecov = "*"
18+
mypy = "*"
19+
flit = "*"
1820

1921
[requires]
2022
python_version = "3.6"

Pipfile.lock

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

aws_dataclasses/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""
2+
python-aws-dataclasses
3+
"""
4+
5+
__version__="0.4.1"
6+
17
from aws_dataclasses.sns_event import SnsEvent
28
from aws_dataclasses.alexa_skill_event import AlexaSkillEvent
39
from aws_dataclasses.s3_event import S3Event

aws_dataclasses/cloudwatch_alarm.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ class CloudWatchAlarmTrigger(GenericDataClass):
1313
Namespace: InitVar[str] = field(repr=False)
1414
StatisticType: InitVar[str] = field(repr=False)
1515
Statistic: InitVar[str] = field(repr=False)
16-
Unit: InitVar[str] = field(repr=False)
1716
Dimensions: InitVar[List[Dict]] = field(repr=False)
1817
Period: InitVar[int] = field(repr=False)
1918
EvaluationPeriods: InitVar[int] = field(repr=False)
2019
ComparisonOperator: InitVar[str] = field(repr=False)
2120
Threshold: InitVar[float] = field(repr=False)
2221
TreatMissingData: InitVar[str] = field(repr=False)
23-
EvaluateLowSampleCountPercentile: InitVar[str] = field(repr=False)
22+
EvaluateLowSampleCountPercentile: InitVar[str] = field(repr=False, default=None)
23+
Unit: InitVar[str] = field(repr=False, default=None)
2424
metric_name: str = field(init=False)
2525
namespace: str = field(init=False)
2626
statistic_type: str = field(init=False)
@@ -34,9 +34,10 @@ class CloudWatchAlarmTrigger(GenericDataClass):
3434
treat_missing_data: str = field(init=False)
3535
evaluate_low_samplecount_percentile: str = field(init=False)
3636

37-
def __post_init__(self, MetricName: str, Namespace: str, StatisticType: str, Statistic: str, Unit: str,
38-
Dimensions: List[Dict], Period: int, EvaluationPeriods: int, ComparisonOperator: str,
39-
Threshold: float, TreatMissingData: str, EvaluateLowSampleCountPercentile: str):
37+
38+
def __post_init__(self, MetricName: str, Namespace: str, StatisticType: str, Statistic: str, Dimensions: List[Dict],
39+
Period: int, EvaluationPeriods: int, ComparisonOperator: str, Threshold: float,
40+
TreatMissingData: str, EvaluateLowSampleCountPercentile: str, Unit: str):
4041
self.metric_name = MetricName
4142
self.namespace = Namespace
4243
self.statistic_type = StatisticType

aws_dataclasses/sns_event.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import datetime
12
from collections import namedtuple
23
from datetime import datetime
34
from typing import Dict, List

pyproject.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[build-system]
2+
requires = ["flit"]
3+
build-backend = "flit.buildapi"
4+
5+
[tool.flit.metadata]
6+
module = "aws_dataclasses"
7+
dist-name = "python-aws-dataclasses"
8+
author = "Benjamin Weigel"
9+
author-email = "[email protected]"
10+
home-page = "https://github.com/hypoport/python-aws-dataclasses"
11+
classifiers = [
12+
"License :: OSI Approved :: MIT License",
13+
'Development Status :: 4 - Beta',
14+
'Programming Language :: Python'
15+
]
16+
17+
keywords="aws lambda events"
18+
19+
requires=[ 'docutils>=0.3',
20+
'dataclasses>=0.6',
21+
'arrow>=0.11.0'
22+
]
23+
requires-python='>=3.6'
24+
25+
description-file='README.md'
26+
27+
[tool.flit.metadata.requires-extra]
28+
test = [
29+
"pytest >=2.7.3",
30+
"pytest-runner",
31+
]
32+
doc = ["sphinx"]

setup.cfg

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# Remove setup.cfg eventually, when every tool supports providing options in pyproject.toml
2+
13
[bumpversion]
2-
current_version = 0.4.0
4+
current_version = 0.4.1
35
commit = true
46
tag = true
57
tag_name = {new_version}
@@ -24,7 +26,7 @@ log_cli_level = DEBUG
2426
junit_suite_name = python-aws-dataclasses
2527
collect_ignore = ['setup.py']
2628

27-
[bumpversion:file:setup.py]
28-
search = version="{current_version}"
29-
replace = version="{new_version}"
29+
[bumpversion:file:aws_dataclasses/__init__.py]
30+
search = __version__="{current_version}"
31+
replace = __version__="{new_version}"
3032

tests/resources/sns-event.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"EventSource": "aws:sns",
77
"Sns": {
88
"SignatureVersion": "1",
9-
"Timestamp": "1970-01-01T00:00:00.000Z",
9+
"Timestamp": "1970-01-01T00:00:12.000Z",
1010
"Signature": "EXAMPLE",
1111
"SigningCertUrl": "EXAMPLE",
1212
"MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e",

0 commit comments

Comments
 (0)