diff --git a/.circleci/config.yml b/.circleci/config.yml index dd8fdde..73aff1b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,41 +2,73 @@ version: 2 jobs: build: docker: - - image: circleci/python:3.6.1 + - image: circleci/python:3.7.1 environment: CC_TEST_REPORTER_ID: 9f8a5da723397006023534dc6c5e32fc95d38bf7a92ae0e43530dba2a726722e steps: - checkout - run: - command: | - sudo apt install python-pip - sudo pip install -U pip pipenv + name: Install OS dependencies + command: make setup-os - run: + name: Install Code Climate Test Reporter Tool command: | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter chmod +x ./cc-test-reporter - run: - command: | - pipenv --python python3.6 - pipenv install --dev - - run: - command: | - pipenv run pytest - ./cc-test-reporter format-coverage coverage/coverage.xml -t coverage.py - ./cc-test-reporter upload-coverage + name: Install package dependencies + command: make setup - run: command: | ./cc-test-reporter before-build - run: - command: | - pipenv run pytest + name: Run unit tests + command: make test - run: + name: Upload test coverage to Code Climate command: | - pipenv run flake8 + ./cc-test-reporter format-coverage coverage.xml -t coverage.py + ./cc-test-reporter upload-coverage - run: - command: | - pipenv run safety check + command: | + ./cc-test-reporter after-build -t coverage.py + - run: + command: make check - store_artifacts: - path: htmlcov destination: htmlcov - \ No newline at end of file + path: htmlcov + deploy: + docker: + - image: circleci/python:3.7.1 + steps: + - checkout + - run: + name: Install OS dependencies + command: make setup-os + - run: + name: Install package dependencies + command: make setup + - run: + name: init .pypirc + command: | + echo -e "[pypi]" >> ~/.pypirc + echo -e "repository = https://upload.pypi.org/legacy/" + - run: + name: Publish Package on Pypi + command: make release +workflows: + version: 2 + build_and_deploy: + jobs: + - build: + filters: + tags: + only: /.*/ + - deploy: + requires: + - build + filters: + tags: + only: /[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b675747 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +.PHONY: setup-os +setup-os: + sudo apt install python-pip + sudo pip install -U pip pipenv + +.PHONY: setup +setup: + pipenv --rm || true + pipenv --python python3.7 + pipenv install --dev + +.PHONY: test +test: + pipenv run pytest + +.PHONY: check +check: + pipenv run flake8 + pipenv run safety check + +.PHONY: build +build: + rm -rf dist + pipenv run python setup.py sdist bdist_wheel + +.PHONY: release +release: build + pipenv run twine upload dist/* || true \ No newline at end of file diff --git a/Pipfile b/Pipfile index b67b04e..a23e4fb 100644 --- a/Pipfile +++ b/Pipfile @@ -14,5 +14,7 @@ flake8 = "~=3.6.0" yapf = "~=0.24.0" ipdb = "~=0.11" safety = "~=1.8.4" +twine = "~=1.12.1" + [requires] -python_version = "3.6" +python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock index 7553740..dedc8ce 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,11 +1,11 @@ { "_meta": { "hash": { - "sha256": "43731ddec78b51583beba4dcf2764505be0d067b93a98afd496632b6ccc00597" + "sha256": "e28d21e464346b7f442ac638ff610bdbaa35e12c0066ad2654853ee076e88c9e" }, "pipfile-spec": 6, "requires": { - "python_version": "3.6" + "python_version": "3.7" }, "sources": [ { @@ -22,10 +22,10 @@ }, "python-json-logger": { "hashes": [ - "sha256:a292e22c5e03105a05a746ade6209d43db1c4c763b91c75c8486e81d10904d85", - "sha256:e3636824d35ba6a15fc39f573588cba63cf46322a5dc86fb2f280229077e9fbe" + "sha256:3e000053837500f9eb28d6228d7cb99fabfc1874d34b40c08289207292abaf2e", + "sha256:cf2caaf34bd2eff394915b6242de4d0245de79971712439380ece6f149748cde" ], - "version": "==0.1.9" + "version": "==0.1.10" } }, "develop": { @@ -50,6 +50,13 @@ ], "version": "==0.1.0" }, + "bleach": { + "hashes": [ + "sha256:48d39675b80a75f6d1c3bdbffec791cf0bbbab665cf01e20da701c77de278718", + "sha256:73d26f018af5d5adcdabf5c1c974add4361a9c76af215fe32fdec8a6fc5fb9b9" + ], + "version": "==3.0.2" + }, "certifi": { "hashes": [ "sha256:339dc09518b07e2fa7eda5450740925974815557727d6bd35d319c1524a04a4c", @@ -73,41 +80,39 @@ }, "coverage": { "hashes": [ - "sha256:03481e81d558d30d230bc12999e3edffe392d244349a90f4ef9b88425fac74ba", - "sha256:0b136648de27201056c1869a6c0d4e23f464750fd9a9ba9750b8336a244429ed", - "sha256:0bf8cbbd71adfff0ef1f3a1531e6402d13b7b01ac50a79c97ca15f030dba6306", - "sha256:10a46017fef60e16694a30627319f38a2b9b52e90182dddb6e37dcdab0f4bf95", - "sha256:198626739a79b09fa0a2f06e083ffd12eb55449b5f8bfdbeed1df4910b2ca640", - "sha256:23d341cdd4a0371820eb2b0bd6b88f5003a7438bbedb33688cd33b8eae59affd", - "sha256:28b2191e7283f4f3568962e373b47ef7f0392993bb6660d079c62bd50fe9d162", - "sha256:2a5b73210bad5279ddb558d9a2bfedc7f4bf6ad7f3c988641d83c40293deaec1", - "sha256:2eb564bbf7816a9d68dd3369a510be3327f1c618d2357fa6b1216994c2e3d508", - "sha256:337ded681dd2ef9ca04ef5d93cfc87e52e09db2594c296b4a0a3662cb1b41249", - "sha256:3a2184c6d797a125dca8367878d3b9a178b6fdd05fdc2d35d758c3006a1cd694", - "sha256:3c79a6f7b95751cdebcd9037e4d06f8d5a9b60e4ed0cd231342aa8ad7124882a", - "sha256:3d72c20bd105022d29b14a7d628462ebdc61de2f303322c0212a054352f3b287", - "sha256:3eb42bf89a6be7deb64116dd1cc4b08171734d721e7a7e57ad64cc4ef29ed2f1", - "sha256:4635a184d0bbe537aa185a34193898eee409332a8ccb27eea36f262566585000", - "sha256:56e448f051a201c5ebbaa86a5efd0ca90d327204d8b059ab25ad0f35fbfd79f1", - "sha256:5a13ea7911ff5e1796b6d5e4fbbf6952381a611209b736d48e675c2756f3f74e", - "sha256:69bf008a06b76619d3c3f3b1983f5145c75a305a0fea513aca094cae5c40a8f5", - "sha256:6bc583dc18d5979dc0f6cec26a8603129de0304d5ae1f17e57a12834e7235062", - "sha256:701cd6093d63e6b8ad7009d8a92425428bc4d6e7ab8d75efbb665c806c1d79ba", - "sha256:7608a3dd5d73cb06c531b8925e0ef8d3de31fed2544a7de6c63960a1e73ea4bc", - "sha256:76ecd006d1d8f739430ec50cc872889af1f9c1b6b8f48e29941814b09b0fd3cc", - "sha256:7aa36d2b844a3e4a4b356708d79fd2c260281a7390d678a10b91ca595ddc9e99", - "sha256:7d3f553904b0c5c016d1dad058a7554c7ac4c91a789fca496e7d8347ad040653", - "sha256:7e1fe19bd6dce69d9fd159d8e4a80a8f52101380d5d3a4d374b6d3eae0e5de9c", - "sha256:8c3cb8c35ec4d9506979b4cf90ee9918bc2e49f84189d9bf5c36c0c1119c6558", - "sha256:9d6dd10d49e01571bf6e147d3b505141ffc093a06756c60b053a859cb2128b1f", - "sha256:be6cfcd8053d13f5f5eeb284aa8a814220c3da1b0078fa859011c7fffd86dab9", - "sha256:c1bb572fab8208c400adaf06a8133ac0712179a334c09224fb11393e920abcdd", - "sha256:de4418dadaa1c01d497e539210cb6baa015965526ff5afc078c57ca69160108d", - "sha256:e05cb4d9aad6233d67e0541caa7e511fa4047ed7750ec2510d466e806e0255d6", - "sha256:f05a636b4564104120111800021a92e43397bc12a5c72fed7036be8556e0029e", - "sha256:f3f501f345f24383c0000395b26b726e46758b71393267aeae0bd36f8b3ade80" - ], - "version": "==4.5.1" + "sha256:09e47c529ff77bf042ecfe858fb55c3e3eb97aac2c87f0349ab5a7efd6b3939f", + "sha256:0a1f9b0eb3aa15c990c328535655847b3420231af299386cfe5efc98f9c250fe", + "sha256:0cc941b37b8c2ececfed341444a456912e740ecf515d560de58b9a76562d966d", + "sha256:10e8af18d1315de936d67775d3a814cc81d0747a1a0312d84e27ae5610e313b0", + "sha256:1b4276550b86caa60606bd3572b52769860a81a70754a54acc8ba789ce74d607", + "sha256:1e8a2627c48266c7b813975335cfdea58c706fe36f607c97d9392e61502dc79d", + "sha256:2b224052bfd801beb7478b03e8a66f3f25ea56ea488922e98903914ac9ac930b", + "sha256:447c450a093766744ab53bf1e7063ec82866f27bcb4f4c907da25ad293bba7e3", + "sha256:46101fc20c6f6568561cdd15a54018bb42980954b79aa46da8ae6f008066a30e", + "sha256:4710dc676bb4b779c4361b54eb308bc84d64a2fa3d78e5f7228921eccce5d815", + "sha256:510986f9a280cd05189b42eee2b69fecdf5bf9651d4cd315ea21d24a964a3c36", + "sha256:5535dda5739257effef56e49a1c51c71f1d37a6e5607bb25a5eee507c59580d1", + "sha256:5a7524042014642b39b1fcae85fb37556c200e64ec90824ae9ecf7b667ccfc14", + "sha256:5f55028169ef85e1fa8e4b8b1b91c0b3b0fa3297c4fb22990d46ff01d22c2d6c", + "sha256:6694d5573e7790a0e8d3d177d7a416ca5f5c150742ee703f3c18df76260de794", + "sha256:6831e1ac20ac52634da606b658b0b2712d26984999c9d93f0c6e59fe62ca741b", + "sha256:77f0d9fa5e10d03aa4528436e33423bfa3718b86c646615f04616294c935f840", + "sha256:828ad813c7cdc2e71dcf141912c685bfe4b548c0e6d9540db6418b807c345ddd", + "sha256:85a06c61598b14b015d4df233d249cd5abfa61084ef5b9f64a48e997fd829a82", + "sha256:8cb4febad0f0b26c6f62e1628f2053954ad2c555d67660f28dfb1b0496711952", + "sha256:a5c58664b23b248b16b96253880b2868fb34358911400a7ba39d7f6399935389", + "sha256:aaa0f296e503cda4bc07566f592cd7a28779d433f3a23c48082af425d6d5a78f", + "sha256:ab235d9fe64833f12d1334d29b558aacedfbca2356dfb9691f2d0d38a8a7bfb4", + "sha256:b3b0c8f660fae65eac74fbf003f3103769b90012ae7a460863010539bb7a80da", + "sha256:bab8e6d510d2ea0f1d14f12642e3f35cefa47a9b2e4c7cea1852b52bc9c49647", + "sha256:c45297bbdbc8bb79b02cf41417d63352b70bcb76f1bbb1ee7d47b3e89e42f95d", + "sha256:d19bca47c8a01b92640c614a9147b081a1974f69168ecd494687c827109e8f42", + "sha256:d64b4340a0c488a9e79b66ec9f9d77d02b99b772c8b8afd46c1294c1d39ca478", + "sha256:da969da069a82bbb5300b59161d8d7c8d423bc4ccd3b410a9b4d8932aeefc14b", + "sha256:ed02c7539705696ecb7dc9d476d861f3904a8d2b7e894bd418994920935d36bb", + "sha256:ee5b8abc35b549012e03a7b1e86c09491457dba6c94112a2482b18589cc2bdb9" + ], + "version": "==4.5.2" }, "decorator": { "hashes": [ @@ -116,6 +121,14 @@ ], "version": "==4.3.0" }, + "docutils": { + "hashes": [ + "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6", + "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274", + "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6" + ], + "version": "==0.14" + }, "dparse": { "hashes": [ "sha256:00a5fdfa900629e5159bf3600d44905b333f4059a3366f28e0dbd13eeab17b19", @@ -150,7 +163,6 @@ "sha256:a5781d6934a3341a1f9acb4ea5acdc7ea0a0855e689dbe755d070ca51e995435", "sha256:b10a7ddd03657c761fc503495bc36471c8158e3fc948573fb9fe82a7029d8efd" ], - "markers": "python_version >= '3.3'", "version": "==7.1.1" }, "ipython-genutils": { @@ -211,6 +223,13 @@ ], "version": "==0.7.5" }, + "pkginfo": { + "hashes": [ + "sha256:5878d542a4b3f237e359926384f1dde4e099c9f5525d236b1840cf704fa8d474", + "sha256:a39076cb3eb34c333a0dd390b568e9e1e881c7bf2cc0aee12120636816f55aee" + ], + "version": "==1.4.2" + }, "pluggy": { "hashes": [ "sha256:447ba94990e8014ee25ec853339faf7b0fc8050cdc3289d4d71f7f410fb90095", @@ -308,12 +327,26 @@ ], "version": "==3.13" }, + "readme-renderer": { + "hashes": [ + "sha256:bb16f55b259f27f75f640acf5e00cf897845a8b3e4731b5c1a436e4b8529202f", + "sha256:c8532b79afc0375a85f10433eca157d6b50f7d6990f337fa498c96cd4bfc203d" + ], + "version": "==24.0" + }, "requests": { "hashes": [ - "sha256:99dcfdaaeb17caf6e526f32b6a7b780461512ab3f1d992187801694cba42770c", - "sha256:a84b8c9ab6239b578f22d1c21d51b696dcfe004032bb80ea832398d6909d7279" + "sha256:65b3a120e4329e33c9889db89c80976c5272f56ea92d3e74da8a463992e3ff54", + "sha256:ea881206e59f41dbd0bd445437d792e43906703fff75ca8ff43ccdb11f33f263" + ], + "version": "==2.20.1" + }, + "requests-toolbelt": { + "hashes": [ + "sha256:42c9c170abc2cacb78b8ab23ac957945c7716249206f90874651971a4acff237", + "sha256:f6a531936c6fa4c6cfce1b9c10d5c4f498d16528d2a54a22ca00011205a187b5" ], - "version": "==2.20.0" + "version": "==0.8.0" }, "safety": { "hashes": [ @@ -330,6 +363,13 @@ ], "version": "==1.11.0" }, + "tqdm": { + "hashes": [ + "sha256:3c4d4a5a41ef162dd61f1edb86b0e1c7859054ab656b2e7c7b77e7fbf6d9f392", + "sha256:5b4d5549984503050883bc126280b386f5f4ca87e6c023c5d015655ad75bdebb" + ], + "version": "==4.28.1" + }, "traitlets": { "hashes": [ "sha256:9c4bd2d267b7153df9152698efb1050a5d84982d3384a37b2c1f7723ba3e7835", @@ -337,6 +377,14 @@ ], "version": "==4.3.2" }, + "twine": { + "hashes": [ + "sha256:7d89bc6acafb31d124e6e5b295ef26ac77030bf098960c2a4c4e058335827c5c", + "sha256:fad6f1251195f7ddd1460cb76d6ea106c93adb4e56c41e0da79658e56e547d2c" + ], + "index": "pypi", + "version": "==1.12.1" + }, "urllib3": { "hashes": [ "sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39", @@ -351,6 +399,13 @@ ], "version": "==0.1.7" }, + "webencodings": { + "hashes": [ + "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78", + "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923" + ], + "version": "==0.5.1" + }, "yapf": { "hashes": [ "sha256:b96815bd0bbd2ab290f2ae9e610756940b17a0523ef2f6b2d31da749fc395137", diff --git a/pytest.ini b/pytest.ini index bffdd81..40afa0a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -addopts = -v -s --cov=google_cloud_logger --cov-report html:coverage --cov-report term --cov-report=xml:coverage/coverage.xml \ No newline at end of file +addopts = -v -s --cov=google_cloud_logger --cov-report html --cov-report term --cov-report=xml \ No newline at end of file diff --git a/setup.py b/setup.py index b98f987..17a1a8e 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,32 @@ -from setuptools import setup +from setuptools import setup, find_packages -__VERSION__ = "0.1.0" +with open("README.md", "r") as output: + long_description = output.read() + + +__VERSION__ = "0.1.1" setup( name="google_cloud_logger", version=__VERSION__, description="Google Cloud Logger Formatter", + long_description=long_description, + long_description_content_type="text/markdown", url="http://github.com/rai200890/python_google_cloud_logger", author="Raissa Ferreira", author_email="rai200890@gmail.com", license="MIT", - packages=["google_cloud_logger"], + packages=find_packages(), python_requires=">=3.4.*", install_requires=[ - "python-json-logger>=v0.1.5", + "python-json-logger>=0.1.10", ], classifiers=[ - "Environment :: Web Environment", "Intended Audience :: Developers", + "Environment :: Web Environment", + "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", - "Natural Language :: English", "Operating System :: OS Independent", + "Natural Language :: English", + "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", "Topic :: System :: Logging" ],