Skip to content
This repository was archived by the owner on May 20, 2022. It is now read-only.

Commit d7d6a44

Browse files
authored
Merge pull request #10 from fyndata/develop
Release
2 parents 3a8357c + 8b7f105 commit d7d6a44

18 files changed

Lines changed: 167 additions & 91 deletions

.bumpversion.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[bumpversion]
2+
current_version = 0.1.1
3+
commit = True
4+
tag = True
5+
6+
[bumpversion:file:fd_gcp/__init__.py]
7+

.circleci/config.yml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#
1212
version: 2
1313
jobs:
14-
build:
14+
test-py37:
1515
docker:
16-
- image: python:3.7.1
16+
- image: python:3.7.2
1717

1818
working_directory: ~/repo
1919

@@ -28,19 +28,52 @@ jobs:
2828
pip install --upgrade pip
2929
pip install --upgrade setuptools wheel
3030
pip install -r requirements/test.txt
31-
# pip install -r requirements/extras.txt
3231
33-
# run tests!
3432
- run:
3533
name: run tests
3634
command: |
3735
. venv/bin/activate
3836
make lint
39-
make test-coverage
37+
tox -e py37
38+
codecov
4039
make test-coverage-report-console
4140
make test-coverage-report-html
42-
make dist
4341
4442
- store_artifacts:
4543
path: test-reports
4644
destination: test-reports
45+
46+
dist:
47+
docker:
48+
- image: python:3.7.2
49+
50+
working_directory: ~/repo
51+
52+
steps:
53+
- checkout
54+
55+
- run:
56+
name: install dependencies
57+
command: |
58+
python3 -m venv venv
59+
. venv/bin/activate
60+
pip install --upgrade pip
61+
pip install --upgrade setuptools wheel
62+
pip install -r requirements/release.txt
63+
64+
- run:
65+
name: make dist
66+
command: |
67+
. venv/bin/activate
68+
make dist
69+
70+
- store_artifacts:
71+
path: dist
72+
destination: dist
73+
74+
workflows:
75+
version: 2
76+
ci:
77+
jobs:
78+
- test-py37
79+
- dist

.coveragerc

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

HISTORY.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
History
2+
-------
3+
4+
unreleased (YYYY-MM-DD)
5+
+++++++++++++++++++++++
6+
7+
0.1.1 (2019-03-07)
8+
++++++++++++++++++
9+
10+
* (PR #9, 2019-03-07) Misc fixes and improvements to config and test setup
11+
* (PR #8, 2019-03-07) Update requirements
12+
13+
0.1.0 (2019-01-24)
14+
++++++++++++++++++
15+
16+
* First implementation.
17+
* First release on PyPI.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Fyndata
3+
Copyright (c) 2019, Fyndata (Fynpal SpA)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1+
include HISTORY.rst
12
include LICENSE
23
include README.md
3-
4-
recursive-include tests *
5-
recursive-exclude * __pycache__
6-
recursive-exclude * *.py[co]
7-
8-
recursive-include docs *.md
4+
recursive-include fd_gcp *py
5+
include fd_gcp/py.typed

Makefile

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,10 @@ SHELL = /usr/bin/env bash
44
.PHONY: help
55
.PHONY: clean clean-build clean-pyc clean-test
66
.PHONY: lint test test-all test-coverage test-coverage-report-console test-coverage-report-html
7-
.PHONY: dist install
8-
9-
define PRINT_HELP_PYSCRIPT
10-
import re, sys
11-
12-
for line in sys.stdin:
13-
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
14-
if match:
15-
target, help = match.groups()
16-
print("%-20s %s" % (target, help))
17-
endef
18-
export PRINT_HELP_PYSCRIPT
19-
7+
.PHONY: dist upload-release
208

219
help:
22-
@echo "Read README.md"
23-
@echo ""
24-
@echo "Makefile tasks:"
25-
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
10+
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | sort | awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'
2611

2712
clean: clean-build clean-pyc clean-test ## remove all build, test, lint, coverage and Python artifacts
2813

@@ -51,25 +36,26 @@ lint: ## run tools for code style analysis, static type check, etc
5136
flake8 --config=setup.cfg fd_gcp tests
5237
mypy --config-file setup.cfg fd_gcp
5338

54-
test: ## run tests
39+
test: ## run tests quickly with the default Python
5540
python setup.py test
5641

5742
test-all: ## run tests on every Python version with tox
58-
@echo "TODO: configure tox"
43+
tox
5944

6045
test-coverage: ## run tests and record test coverage
61-
coverage run setup.py test
46+
coverage run --rcfile=setup.cfg setup.py test
6247

6348
test-coverage-report-console: ## print test coverage summary
64-
coverage report -m
49+
coverage report --rcfile=setup.cfg -m
6550

6651
test-coverage-report-html: ## generate test coverage HTML report
67-
coverage html
52+
coverage html --rcfile=setup.cfg
6853

6954
dist: clean ## builds source and wheel package
7055
python setup.py sdist
7156
python setup.py bdist_wheel
57+
twine check dist/*
7258
ls -l dist
7359

74-
install: clean ## install the package to the active Python's site-packages
75-
python setup.py install
60+
upload-release: ## upload dist packages
61+
python -m twine upload 'dist/*'

fd_gcp/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@
2828
``kms_crypto_key_resource_name`` (unlike ``kms_crypto_key_id``).
2929
3030
"""
31+
32+
33+
__version__ = '0.1.1'

fd_gcp/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_env_project_id() -> str:
5757
return project_id
5858

5959

60-
def get_gce_credentials(service_account_email: str =None) -> GcpCredentials:
60+
def get_gce_credentials(service_account_email: str = None) -> GcpCredentials:
6161
"""
6262
Return credentials provided by Compute Engine service account.
6363

fd_gcp/exceptions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ResourcePermissionDenied(Error):
4242
4343
"""
4444

45-
def __init__(self, resource: str =None, permission: str =None) -> None:
45+
def __init__(self, resource: str = None, permission: str = None) -> None:
4646
"""Constructor.
4747
4848
:param resource: a resource's ID, GRN or some other identifier
@@ -76,7 +76,7 @@ class ResourceNotFound(Error):
7676
7777
"""
7878

79-
def __init__(self, resource: str =None) -> None:
79+
def __init__(self, resource: str = None) -> None:
8080
"""Constructor.
8181
8282
:param resource: a resource's ID, GRN or some other identifier
@@ -192,7 +192,7 @@ def _detect_resource_not_found(
192192

193193
try:
194194
exc_reason = exc._get_reason().strip()
195-
re_pattern = re.compile("^(?P<resource_type>[a-zA-Z0-9_]+) (?P<resource>.+) not found\.")
195+
re_pattern = re.compile(r"^(?P<resource_type>[a-zA-Z0-9_]+) (?P<resource>.+) not found\.")
196196
re_match = re_pattern.match(exc_reason)
197197

198198
if re_match:

0 commit comments

Comments
 (0)