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

Commit 88fe785

Browse files
authored
Merge pull request #9 from fyndata/feature/misc-config-test
Misc fixes and improvements to config and test setup
2 parents 85a4d90 + 6f594fd commit 88fe785

9 files changed

Lines changed: 91 additions & 60 deletions

File tree

.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.

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: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
include LICENSE
22
include README.md
3-
4-
recursive-include tests *
5-
recursive-exclude * __pycache__
6-
recursive-exclude * *.py[co]
7-
8-
recursive-include docs *.md
3+
recursive-include fd_gcp *py
4+
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/*'

requirements/test.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
-r base.txt
33

44
# Required packages:
5+
codecov==2.0.15
56
coverage==4.5.2
67
flake8==3.7.6
78
mypy==0.670
89
#requests-mock==1.5.2
9-
#tox==3.2.1
10+
tox==3.7.0
1011

1112
# Packages dependencies:
13+
# - codecov:
14+
# - coverage
15+
# - requests
1216
# - flake8:
1317
# - mccabe
1418
# - pycodestyle
@@ -17,14 +21,18 @@ mypy==0.670
1721
# - mypy-extensions
1822
# - typed-ast
1923
# - tox:
24+
# - filelock
2025
# - pluggy
2126
# - py
27+
# - toml
2228
# - virtualenv
29+
filelock==3.0.10
2330
mccabe==0.6.1
2431
mypy-extensions==0.4.1
25-
#pluggy==0.7.1
26-
#py==1.5.4
32+
pluggy==0.9.0
33+
py==1.8.0
2734
pycodestyle==2.5.0
2835
pyflakes==2.1.0
36+
toml==0.10.0
2937
typed-ast==1.3.1
30-
#virtualenv==16.0.0
38+
virtualenv==16.4.3

setup.cfg

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
[bdist_wheel]
22
universal = 0
33

4+
[coverage:run]
5+
source = fd_gcp/
6+
omit =
7+
tests/*
8+
branch = True
9+
10+
[coverage:report]
11+
exclude_lines =
12+
pragma: no cover
13+
if __name__ == .__main__.
14+
show_missing = True
15+
16+
[coverage:html]
17+
directory = test-reports/coverage/html
18+
419
[mypy]
520
python_version = 3.7
621
platform = linux

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def get_version(*file_paths: Sequence[str]) -> str:
4848
# - https://www.python.org/dev/peps/pep-0561/#packaging-type-information
4949
# - https://github.com/python/typing/issues/84
5050
# - https://github.com/python/mypy/issues/3930
51+
# warning: remember to replicate this in the manifest file for source distribution ('MANIFEST.in').
5152
_package_data = {
5253
'fd_gcp': [
5354
# Indicates that the "typing information" of the package should be distributed.
@@ -56,16 +57,18 @@ def get_version(*file_paths: Sequence[str]) -> str:
5657
}
5758

5859
setup(
59-
author="Fyndata",
60+
author='Fyndata (Fynpal SpA)',
6061
author_email='no-reply@fyndata.com',
6162
classifiers=[
6263
'Intended Audience :: Developers',
64+
'License :: OSI Approved :: MIT License',
6365
'Natural Language :: English',
6466
'Programming Language :: Python :: 3.7',
6567
],
6668
description="Fyndata's Python library of Google Cloud Platform (GCP) utils.",
6769
# extras_require=extras_requirements,
6870
install_requires=requirements,
71+
license="MIT",
6972
long_description=readme,
7073
long_description_content_type='text/markdown',
7174
include_package_data=True,

tox.ini

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
[tox]
2-
envlist = py37
2+
envlist =
3+
py37
34

45
[testenv]
56
setenv =
6-
PYTHONPATH = {toxinidir}
7-
8-
commands = python setup.py test
7+
PYTHONPATH = {toxinidir}:{toxinidir}/fd_gcp
8+
commands = coverage run --rcfile=setup.cfg setup.py test
9+
deps =
10+
-r{toxinidir}/requirements/test.txt
11+
basepython =
12+
py37: python3.7

0 commit comments

Comments
 (0)