From 7ea7830db164cdbeb26af88c02c2d63fe841fcdf Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Wed, 4 Nov 2020 10:14:03 +0200 Subject: [PATCH 01/10] test poetry --- .env | 2 +- Pipfile | 22 --- Pipfile.lock | 223 ---------------------- README.md | 18 +- poetry.lock | 498 +++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 30 +++ pytest.ini | 1 - src/config.py | 6 + 8 files changed, 544 insertions(+), 256 deletions(-) delete mode 100644 Pipfile delete mode 100644 Pipfile.lock create mode 100644 poetry.lock create mode 100644 pyproject.toml diff --git a/.env b/.env index 978b97b..5839665 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ TODOS_FILENAME=todos.csv -DATABASE_FILENAME=database.sqlite \ No newline at end of file +DATABASE_FILENAME=database.sqlite diff --git a/Pipfile b/Pipfile deleted file mode 100644 index e0a188d..0000000 --- a/Pipfile +++ /dev/null @@ -1,22 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[scripts] -start = "python3 src/index.py" -build = "python3 src/build.py" -lint = "pylint src" -format = "autopep8 --in-place --recursive src" -test = "pytest" -coverage = "coverage run --branch -m pytest" -coverage-report = "coverage html" - -[dev-packages] - -[packages] -pylint = "*" -autopep8 = "*" -pytest = "*" -pytest-dotenv = "*" -coverage = "*" diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index d23fd3a..0000000 --- a/Pipfile.lock +++ /dev/null @@ -1,223 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "24487382b1a19c5eea3c6e7cf47bd2240dc8c9ae2d2cdf52905cacdc0f872bd8" - }, - "pipfile-spec": 6, - "requires": {}, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": { - "astroid": { - "hashes": [ - "sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703", - "sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386" - ], - "markers": "python_version >= '3.5'", - "version": "==2.4.2" - }, - "attrs": { - "hashes": [ - "sha256:26b54ddbbb9ee1d34d5d3668dd37d6cf74990ab23c828c2888dccdceee395594", - "sha256:fce7fc47dfc976152e82d53ff92fa0407700c21acd20886a13777a0d20e655dc" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==20.2.0" - }, - "autopep8": { - "hashes": [ - "sha256:d21d3901cb0da6ebd1e83fc9b0dfbde8b46afc2ede4fe32fbda0c7c6118ca094" - ], - "index": "pypi", - "version": "==1.5.4" - }, - "coverage": { - "hashes": [ - "sha256:0203acd33d2298e19b57451ebb0bed0ab0c602e5cf5a818591b4918b1f97d516", - "sha256:0f313707cdecd5cd3e217fc68c78a960b616604b559e9ea60cc16795c4304259", - "sha256:1c6703094c81fa55b816f5ae542c6ffc625fec769f22b053adb42ad712d086c9", - "sha256:1d44bb3a652fed01f1f2c10d5477956116e9b391320c94d36c6bf13b088a1097", - "sha256:280baa8ec489c4f542f8940f9c4c2181f0306a8ee1a54eceba071a449fb870a0", - "sha256:29a6272fec10623fcbe158fdf9abc7a5fa032048ac1d8631f14b50fbfc10d17f", - "sha256:2b31f46bf7b31e6aa690d4c7a3d51bb262438c6dcb0d528adde446531d0d3bb7", - "sha256:2d43af2be93ffbad25dd959899b5b809618a496926146ce98ee0b23683f8c51c", - "sha256:381ead10b9b9af5f64646cd27107fb27b614ee7040bb1226f9c07ba96625cbb5", - "sha256:47a11bdbd8ada9b7ee628596f9d97fbd3851bd9999d398e9436bd67376dbece7", - "sha256:4d6a42744139a7fa5b46a264874a781e8694bb32f1d76d8137b68138686f1729", - "sha256:50691e744714856f03a86df3e2bff847c2acede4c191f9a1da38f088df342978", - "sha256:530cc8aaf11cc2ac7430f3614b04645662ef20c348dce4167c22d99bec3480e9", - "sha256:582ddfbe712025448206a5bc45855d16c2e491c2dd102ee9a2841418ac1c629f", - "sha256:63808c30b41f3bbf65e29f7280bf793c79f54fb807057de7e5238ffc7cc4d7b9", - "sha256:71b69bd716698fa62cd97137d6f2fdf49f534decb23a2c6fc80813e8b7be6822", - "sha256:7858847f2d84bf6e64c7f66498e851c54de8ea06a6f96a32a1d192d846734418", - "sha256:78e93cc3571fd928a39c0b26767c986188a4118edc67bc0695bc7a284da22e82", - "sha256:7f43286f13d91a34fadf61ae252a51a130223c52bfefb50310d5b2deb062cf0f", - "sha256:86e9f8cd4b0cdd57b4ae71a9c186717daa4c5a99f3238a8723f416256e0b064d", - "sha256:8f264ba2701b8c9f815b272ad568d555ef98dfe1576802ab3149c3629a9f2221", - "sha256:9342dd70a1e151684727c9c91ea003b2fb33523bf19385d4554f7897ca0141d4", - "sha256:9361de40701666b034c59ad9e317bae95c973b9ff92513dd0eced11c6adf2e21", - "sha256:9669179786254a2e7e57f0ecf224e978471491d660aaca833f845b72a2df3709", - "sha256:aac1ba0a253e17889550ddb1b60a2063f7474155465577caa2a3b131224cfd54", - "sha256:aef72eae10b5e3116bac6957de1df4d75909fc76d1499a53fb6387434b6bcd8d", - "sha256:bd3166bb3b111e76a4f8e2980fa1addf2920a4ca9b2b8ca36a3bc3dedc618270", - "sha256:c1b78fb9700fc961f53386ad2fd86d87091e06ede5d118b8a50dea285a071c24", - "sha256:c3888a051226e676e383de03bf49eb633cd39fc829516e5334e69b8d81aae751", - "sha256:c5f17ad25d2c1286436761b462e22b5020d83316f8e8fcb5deb2b3151f8f1d3a", - "sha256:c851b35fc078389bc16b915a0a7c1d5923e12e2c5aeec58c52f4aa8085ac8237", - "sha256:cb7df71de0af56000115eafd000b867d1261f786b5eebd88a0ca6360cccfaca7", - "sha256:cedb2f9e1f990918ea061f28a0f0077a07702e3819602d3507e2ff98c8d20636", - "sha256:e8caf961e1b1a945db76f1b5fa9c91498d15f545ac0ababbe575cfab185d3bd8" - ], - "index": "pypi", - "version": "==5.3" - }, - "iniconfig": { - "hashes": [ - "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3", - "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32" - ], - "version": "==1.1.1" - }, - "isort": { - "hashes": [ - "sha256:dcab1d98b469a12a1a624ead220584391648790275560e1a43e54c5dceae65e7", - "sha256:dcaeec1b5f0eca77faea2a35ab790b4f3680ff75590bfcb7145986905aab2f58" - ], - "markers": "python_version >= '3.6' and python_version < '4.0'", - "version": "==5.6.4" - }, - "lazy-object-proxy": { - "hashes": [ - "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d", - "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449", - "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08", - "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a", - "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50", - "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd", - "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239", - "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb", - "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea", - "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e", - "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156", - "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142", - "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442", - "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62", - "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db", - "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531", - "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383", - "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a", - "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357", - "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4", - "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.4.3" - }, - "mccabe": { - "hashes": [ - "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", - "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" - ], - "version": "==0.6.1" - }, - "packaging": { - "hashes": [ - "sha256:4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8", - "sha256:998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==20.4" - }, - "pluggy": { - "hashes": [ - "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", - "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.13.1" - }, - "py": { - "hashes": [ - "sha256:366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2", - "sha256:9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.9.0" - }, - "pycodestyle": { - "hashes": [ - "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367", - "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.6.0" - }, - "pylint": { - "hashes": [ - "sha256:bb4a908c9dadbc3aac18860550e870f58e1a02c9f2c204fdf5693d73be061210", - "sha256:bfe68f020f8a0fece830a22dd4d5dddb4ecc6137db04face4c3420a46a52239f" - ], - "index": "pypi", - "version": "==2.6.0" - }, - "pyparsing": { - "hashes": [ - "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", - "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b" - ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.4.7" - }, - "pytest": { - "hashes": [ - "sha256:7a8190790c17d79a11f847fba0b004ee9a8122582ebff4729a082c109e81a4c9", - "sha256:8f593023c1a0f916110285b6efd7f99db07d59546e3d8c36fc60e2ab05d3be92" - ], - "index": "pypi", - "version": "==6.1.1" - }, - "pytest-dotenv": { - "hashes": [ - "sha256:2dc6c3ac6d8764c71c6d2804e902d0ff810fa19692e95fe138aefc9b1aa73732", - "sha256:40a2cece120a213898afaa5407673f6bd924b1fa7eafce6bda0e8abffe2f710f" - ], - "index": "pypi", - "version": "==0.5.2" - }, - "python-dotenv": { - "hashes": [ - "sha256:8c10c99a1b25d9a68058a1ad6f90381a62ba68230ca93966882a4dbc3bc9c33d", - "sha256:c10863aee750ad720f4f43436565e4c1698798d763b63234fb5021b6c616e423" - ], - "version": "==0.14.0" - }, - "six": { - "hashes": [ - "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", - "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.15.0" - }, - "toml": { - "hashes": [ - "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f", - "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88" - ], - "version": "==0.10.1" - }, - "wrapt": { - "hashes": [ - "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7" - ], - "version": "==1.12.1" - } - }, - "develop": {} -} diff --git a/README.md b/README.md index fa638cd..0c93b81 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Sovellus toimii myös Helsingin yliopiston Tietojenkäsittelytieteen kurssin Ohj ## Huomio Python-versiosta -Sovelluksen toiminta on testattu Python-versiolla `3.9.0`. Etenkin vanhempien Python-versioiden kanssa saattaa ilmentyä ongelmia. +Sovelluksen toiminta on testattu Python-versiolla `3.6.0`. Etenkin vanhempien Python-versioiden kanssa saattaa ilmentyä ongelmia. ## Dokumentaatio @@ -21,19 +21,19 @@ Sovelluksen toiminta on testattu Python-versiolla `3.9.0`. Etenkin vanhempien Py 1. Asenna riippuvuut komennolla: ```bash -python3 -m pipenv install +python3 -m poetry install ``` 2. Suorita vaadittavat alustustoimenpiteet komennolla: ```bash -python3 -m pipenv run build +python3 -m poetry run task build ``` 3. Käynnistä sovellus komennolla: ```bash -python3 -m pipenv run start +python3 -m poetry run task start ``` ## Komentorivitoiminnot @@ -43,7 +43,7 @@ python3 -m pipenv run start Ohjelman pystyy suorittamaan komennolla: ```bash -python3 -m pipenv run start +python3 -m poetry run task start ``` ### Testaus @@ -51,7 +51,7 @@ python3 -m pipenv run start Testit suoritetaan komennolla: ```bash -python3 -m pipenv run test +python3 -m poetry run task test ``` ### Testikattavuus @@ -59,13 +59,13 @@ python3 -m pipenv run test Testikattavuus kerätään kommenolla: ```bash -python3 -m pipenv run coverage +python3 -m poetry run task coverage ``` Tämän jälkeen raportin voi generoida komennolla: ```bash -python3 -m pipenv run coverage-report +python3 -m poetry run task coverage-report ``` Raportti generoituu _htmlcov_-hakemistoon. @@ -75,5 +75,5 @@ Raportti generoituu _htmlcov_-hakemistoon. Tiedoston [.pylintrc](./.pylintrc) määrittelemät tarkistukset voi suorittaa komennolla: ```bash -python3 -m pipenv run lint +python3 -m poetry run task lint ``` diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..8c37404 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,498 @@ +[[package]] +name = "astroid" +version = "2.4.2" +description = "An abstract syntax tree for Python with inference support." +category = "dev" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +lazy-object-proxy = ">=1.4.0,<1.5.0" +six = ">=1.12,<2.0" +typed-ast = {version = ">=1.4.0,<1.5", markers = "implementation_name == \"cpython\" and python_version < \"3.8\""} +wrapt = ">=1.11,<2.0" + +[[package]] +name = "atomicwrites" +version = "1.4.0" +description = "Atomic file writes." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "attrs" +version = "20.2.0" +description = "Classes Without Boilerplate" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.extras] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "sphinx", "sphinx-rtd-theme", "pre-commit"] +docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"] + +[[package]] +name = "autopep8" +version = "1.5.4" +description = "A tool that automatically formats Python code to conform to the PEP 8 style guide" +category = "dev" +optional = false +python-versions = "*" + +[package.dependencies] +pycodestyle = ">=2.6.0" +toml = "*" + +[[package]] +name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "coverage" +version = "5.3" +description = "Code coverage measurement for Python" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" + +[package.extras] +toml = ["toml"] + +[[package]] +name = "importlib-metadata" +version = "2.0.0" +description = "Read metadata from Python packages" +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[package.dependencies] +zipp = ">=0.5" + +[package.extras] +docs = ["sphinx", "rst.linker"] +testing = ["packaging", "pep517", "importlib-resources (>=1.3)"] + +[[package]] +name = "iniconfig" +version = "1.1.1" +description = "iniconfig: brain-dead simple config-ini parsing" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "isort" +version = "4.3.21" +description = "A Python utility / library to sort Python imports." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.extras] +pipfile = ["pipreqs", "requirementslib"] +pyproject = ["toml"] +requirements = ["pipreqs", "pip-api"] +xdg_home = ["appdirs (>=1.4.0)"] + +[[package]] +name = "lazy-object-proxy" +version = "1.4.3" +description = "A fast and thorough lazy object proxy." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "mccabe" +version = "0.6.1" +description = "McCabe checker, plugin for flake8" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "packaging" +version = "20.4" +description = "Core utilities for Python packages" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.dependencies] +pyparsing = ">=2.0.2" +six = "*" + +[[package]] +name = "pluggy" +version = "0.13.1" +description = "plugin and hook calling mechanisms for python" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.dependencies] +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + +[package.extras] +dev = ["pre-commit", "tox"] + +[[package]] +name = "psutil" +version = "5.7.3" +description = "Cross-platform lib for process and system monitoring in Python." +category = "main" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.extras] +test = ["ipaddress", "mock", "unittest2", "enum34", "pywin32", "wmi"] + +[[package]] +name = "py" +version = "1.9.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "pycodestyle" +version = "2.6.0" +description = "Python style guide checker" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "pylint" +version = "2.6.0" +description = "python code static checker" +category = "dev" +optional = false +python-versions = ">=3.5.*" + +[package.dependencies] +astroid = ">=2.4.0,<=2.5" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +isort = ">=4.2.5,<6" +mccabe = ">=0.6,<0.7" +toml = ">=0.7.1" + +[[package]] +name = "pyparsing" +version = "2.4.7" +description = "Python parsing module" +category = "dev" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "pytest" +version = "6.1.2" +description = "pytest: simple powerful testing with Python" +category = "dev" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} +attrs = ">=17.4.0" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<1.0" +py = ">=1.8.2" +toml = "*" + +[package.extras] +checkqa_mypy = ["mypy (==0.780)"] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] + +[[package]] +name = "pytest-dotenv" +version = "0.5.2" +description = "A py.test plugin that parses environment files before running tests" +category = "dev" +optional = false +python-versions = "*" + +[package.dependencies] +pytest = ">=5.0.0" +python-dotenv = ">=0.9.1" + +[[package]] +name = "python-dotenv" +version = "0.15.0" +description = "Add .env support to your django/flask apps in development and deployments" +category = "main" +optional = false +python-versions = "*" + +[package.extras] +cli = ["click (>=5.0)"] + +[[package]] +name = "six" +version = "1.15.0" +description = "Python 2 and 3 compatibility utilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "taskipy" +version = "1.4.0" +description = "tasks runner for python projects" +category = "main" +optional = false +python-versions = ">=3.6,<4.0" + +[package.dependencies] +psutil = ">=5.7.2,<6.0.0" +toml = ">=0.10.0,<0.11.0" + +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "main" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "typed-ast" +version = "1.4.1" +description = "a fork of Python 2 and 3 ast modules with type comment support" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "wrapt" +version = "1.12.1" +description = "Module for decorators, wrappers and monkey patching." +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "zipp" +version = "3.4.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] + +[metadata] +lock-version = "1.1" +python-versions = "^3.6" +content-hash = "1388a315c30f3029ade3d082c3394f753d77d98e8eaf483d7d30d49a6a3bf3d3" + +[metadata.files] +astroid = [ + {file = "astroid-2.4.2-py3-none-any.whl", hash = "sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386"}, + {file = "astroid-2.4.2.tar.gz", hash = "sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703"}, +] +atomicwrites = [ + {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, + {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, +] +attrs = [ + {file = "attrs-20.2.0-py2.py3-none-any.whl", hash = "sha256:fce7fc47dfc976152e82d53ff92fa0407700c21acd20886a13777a0d20e655dc"}, + {file = "attrs-20.2.0.tar.gz", hash = "sha256:26b54ddbbb9ee1d34d5d3668dd37d6cf74990ab23c828c2888dccdceee395594"}, +] +autopep8 = [ + {file = "autopep8-1.5.4.tar.gz", hash = "sha256:d21d3901cb0da6ebd1e83fc9b0dfbde8b46afc2ede4fe32fbda0c7c6118ca094"}, +] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] +coverage = [ + {file = "coverage-5.3-cp27-cp27m-macosx_10_13_intel.whl", hash = "sha256:bd3166bb3b111e76a4f8e2980fa1addf2920a4ca9b2b8ca36a3bc3dedc618270"}, + {file = "coverage-5.3-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:9342dd70a1e151684727c9c91ea003b2fb33523bf19385d4554f7897ca0141d4"}, + {file = "coverage-5.3-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:63808c30b41f3bbf65e29f7280bf793c79f54fb807057de7e5238ffc7cc4d7b9"}, + {file = "coverage-5.3-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:4d6a42744139a7fa5b46a264874a781e8694bb32f1d76d8137b68138686f1729"}, + {file = "coverage-5.3-cp27-cp27m-win32.whl", hash = "sha256:86e9f8cd4b0cdd57b4ae71a9c186717daa4c5a99f3238a8723f416256e0b064d"}, + {file = "coverage-5.3-cp27-cp27m-win_amd64.whl", hash = "sha256:7858847f2d84bf6e64c7f66498e851c54de8ea06a6f96a32a1d192d846734418"}, + {file = "coverage-5.3-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:530cc8aaf11cc2ac7430f3614b04645662ef20c348dce4167c22d99bec3480e9"}, + {file = "coverage-5.3-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:381ead10b9b9af5f64646cd27107fb27b614ee7040bb1226f9c07ba96625cbb5"}, + {file = "coverage-5.3-cp35-cp35m-macosx_10_13_x86_64.whl", hash = "sha256:71b69bd716698fa62cd97137d6f2fdf49f534decb23a2c6fc80813e8b7be6822"}, + {file = "coverage-5.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:1d44bb3a652fed01f1f2c10d5477956116e9b391320c94d36c6bf13b088a1097"}, + {file = "coverage-5.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:1c6703094c81fa55b816f5ae542c6ffc625fec769f22b053adb42ad712d086c9"}, + {file = "coverage-5.3-cp35-cp35m-win32.whl", hash = "sha256:cedb2f9e1f990918ea061f28a0f0077a07702e3819602d3507e2ff98c8d20636"}, + {file = "coverage-5.3-cp35-cp35m-win_amd64.whl", hash = "sha256:7f43286f13d91a34fadf61ae252a51a130223c52bfefb50310d5b2deb062cf0f"}, + {file = "coverage-5.3-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:c851b35fc078389bc16b915a0a7c1d5923e12e2c5aeec58c52f4aa8085ac8237"}, + {file = "coverage-5.3-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:aac1ba0a253e17889550ddb1b60a2063f7474155465577caa2a3b131224cfd54"}, + {file = "coverage-5.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:2b31f46bf7b31e6aa690d4c7a3d51bb262438c6dcb0d528adde446531d0d3bb7"}, + {file = "coverage-5.3-cp36-cp36m-win32.whl", hash = "sha256:c5f17ad25d2c1286436761b462e22b5020d83316f8e8fcb5deb2b3151f8f1d3a"}, + {file = "coverage-5.3-cp36-cp36m-win_amd64.whl", hash = "sha256:aef72eae10b5e3116bac6957de1df4d75909fc76d1499a53fb6387434b6bcd8d"}, + {file = "coverage-5.3-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:e8caf961e1b1a945db76f1b5fa9c91498d15f545ac0ababbe575cfab185d3bd8"}, + {file = "coverage-5.3-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:29a6272fec10623fcbe158fdf9abc7a5fa032048ac1d8631f14b50fbfc10d17f"}, + {file = "coverage-5.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:2d43af2be93ffbad25dd959899b5b809618a496926146ce98ee0b23683f8c51c"}, + {file = "coverage-5.3-cp37-cp37m-win32.whl", hash = "sha256:c3888a051226e676e383de03bf49eb633cd39fc829516e5334e69b8d81aae751"}, + {file = "coverage-5.3-cp37-cp37m-win_amd64.whl", hash = "sha256:9669179786254a2e7e57f0ecf224e978471491d660aaca833f845b72a2df3709"}, + {file = "coverage-5.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0203acd33d2298e19b57451ebb0bed0ab0c602e5cf5a818591b4918b1f97d516"}, + {file = "coverage-5.3-cp38-cp38-manylinux1_i686.whl", hash = "sha256:582ddfbe712025448206a5bc45855d16c2e491c2dd102ee9a2841418ac1c629f"}, + {file = "coverage-5.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:0f313707cdecd5cd3e217fc68c78a960b616604b559e9ea60cc16795c4304259"}, + {file = "coverage-5.3-cp38-cp38-win32.whl", hash = "sha256:78e93cc3571fd928a39c0b26767c986188a4118edc67bc0695bc7a284da22e82"}, + {file = "coverage-5.3-cp38-cp38-win_amd64.whl", hash = "sha256:8f264ba2701b8c9f815b272ad568d555ef98dfe1576802ab3149c3629a9f2221"}, + {file = "coverage-5.3-cp39-cp39-macosx_10_13_x86_64.whl", hash = "sha256:50691e744714856f03a86df3e2bff847c2acede4c191f9a1da38f088df342978"}, + {file = "coverage-5.3-cp39-cp39-manylinux1_i686.whl", hash = "sha256:9361de40701666b034c59ad9e317bae95c973b9ff92513dd0eced11c6adf2e21"}, + {file = "coverage-5.3-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:c1b78fb9700fc961f53386ad2fd86d87091e06ede5d118b8a50dea285a071c24"}, + {file = "coverage-5.3-cp39-cp39-win32.whl", hash = "sha256:cb7df71de0af56000115eafd000b867d1261f786b5eebd88a0ca6360cccfaca7"}, + {file = "coverage-5.3-cp39-cp39-win_amd64.whl", hash = "sha256:47a11bdbd8ada9b7ee628596f9d97fbd3851bd9999d398e9436bd67376dbece7"}, + {file = "coverage-5.3.tar.gz", hash = "sha256:280baa8ec489c4f542f8940f9c4c2181f0306a8ee1a54eceba071a449fb870a0"}, +] +importlib-metadata = [ + {file = "importlib_metadata-2.0.0-py2.py3-none-any.whl", hash = "sha256:cefa1a2f919b866c5beb7c9f7b0ebb4061f30a8a9bf16d609b000e2dfaceb9c3"}, + {file = "importlib_metadata-2.0.0.tar.gz", hash = "sha256:77a540690e24b0305878c37ffd421785a6f7e53c8b5720d211b211de8d0e95da"}, +] +iniconfig = [ + {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, + {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, +] +isort = [ + {file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"}, + {file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"}, +] +lazy-object-proxy = [ + {file = "lazy-object-proxy-1.4.3.tar.gz", hash = "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0"}, + {file = "lazy_object_proxy-1.4.3-cp27-cp27m-macosx_10_13_x86_64.whl", hash = "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442"}, + {file = "lazy_object_proxy-1.4.3-cp27-cp27m-win32.whl", hash = "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4"}, + {file = "lazy_object_proxy-1.4.3-cp27-cp27m-win_amd64.whl", hash = "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a"}, + {file = "lazy_object_proxy-1.4.3-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d"}, + {file = "lazy_object_proxy-1.4.3-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a"}, + {file = "lazy_object_proxy-1.4.3-cp34-cp34m-win32.whl", hash = "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e"}, + {file = "lazy_object_proxy-1.4.3-cp34-cp34m-win_amd64.whl", hash = "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357"}, + {file = "lazy_object_proxy-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50"}, + {file = "lazy_object_proxy-1.4.3-cp35-cp35m-win32.whl", hash = "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db"}, + {file = "lazy_object_proxy-1.4.3-cp35-cp35m-win_amd64.whl", hash = "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449"}, + {file = "lazy_object_proxy-1.4.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156"}, + {file = "lazy_object_proxy-1.4.3-cp36-cp36m-win32.whl", hash = "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531"}, + {file = "lazy_object_proxy-1.4.3-cp36-cp36m-win_amd64.whl", hash = "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb"}, + {file = "lazy_object_proxy-1.4.3-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08"}, + {file = "lazy_object_proxy-1.4.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383"}, + {file = "lazy_object_proxy-1.4.3-cp37-cp37m-win32.whl", hash = "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142"}, + {file = "lazy_object_proxy-1.4.3-cp37-cp37m-win_amd64.whl", hash = "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea"}, + {file = "lazy_object_proxy-1.4.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62"}, + {file = "lazy_object_proxy-1.4.3-cp38-cp38-win32.whl", hash = "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd"}, + {file = "lazy_object_proxy-1.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239"}, +] +mccabe = [ + {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, + {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, +] +packaging = [ + {file = "packaging-20.4-py2.py3-none-any.whl", hash = "sha256:998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"}, + {file = "packaging-20.4.tar.gz", hash = "sha256:4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"}, +] +pluggy = [ + {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, + {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, +] +psutil = [ + {file = "psutil-5.7.3-cp27-none-win32.whl", hash = "sha256:1cd6a0c9fb35ece2ccf2d1dd733c1e165b342604c67454fd56a4c12e0a106787"}, + {file = "psutil-5.7.3-cp27-none-win_amd64.whl", hash = "sha256:e02c31b2990dcd2431f4524b93491941df39f99619b0d312dfe1d4d530b08b4b"}, + {file = "psutil-5.7.3-cp35-cp35m-win32.whl", hash = "sha256:56c85120fa173a5d2ad1d15a0c6e0ae62b388bfb956bb036ac231fbdaf9e4c22"}, + {file = "psutil-5.7.3-cp35-cp35m-win_amd64.whl", hash = "sha256:fa38ac15dbf161ab1e941ff4ce39abd64b53fec5ddf60c23290daed2bc7d1157"}, + {file = "psutil-5.7.3-cp36-cp36m-win32.whl", hash = "sha256:01bc82813fbc3ea304914581954979e637bcc7084e59ac904d870d6eb8bb2bc7"}, + {file = "psutil-5.7.3-cp36-cp36m-win_amd64.whl", hash = "sha256:6a3e1fd2800ca45083d976b5478a2402dd62afdfb719b30ca46cd28bb25a2eb4"}, + {file = "psutil-5.7.3-cp37-cp37m-win32.whl", hash = "sha256:fbcac492cb082fa38d88587d75feb90785d05d7e12d4565cbf1ecc727aff71b7"}, + {file = "psutil-5.7.3-cp37-cp37m-win_amd64.whl", hash = "sha256:5d9106ff5ec2712e2f659ebbd112967f44e7d33f40ba40530c485cc5904360b8"}, + {file = "psutil-5.7.3-cp38-cp38-win32.whl", hash = "sha256:ade6af32eb80a536eff162d799e31b7ef92ddcda707c27bbd077238065018df4"}, + {file = "psutil-5.7.3-cp38-cp38-win_amd64.whl", hash = "sha256:2cb55ef9591b03ef0104bedf67cc4edb38a3edf015cf8cf24007b99cb8497542"}, + {file = "psutil-5.7.3.tar.gz", hash = "sha256:af73f7bcebdc538eda9cc81d19db1db7bf26f103f91081d780bbacfcb620dee2"}, +] +py = [ + {file = "py-1.9.0-py2.py3-none-any.whl", hash = "sha256:366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2"}, + {file = "py-1.9.0.tar.gz", hash = "sha256:9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"}, +] +pycodestyle = [ + {file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"}, + {file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"}, +] +pylint = [ + {file = "pylint-2.6.0-py3-none-any.whl", hash = "sha256:bfe68f020f8a0fece830a22dd4d5dddb4ecc6137db04face4c3420a46a52239f"}, + {file = "pylint-2.6.0.tar.gz", hash = "sha256:bb4a908c9dadbc3aac18860550e870f58e1a02c9f2c204fdf5693d73be061210"}, +] +pyparsing = [ + {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, + {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, +] +pytest = [ + {file = "pytest-6.1.2-py3-none-any.whl", hash = "sha256:4288fed0d9153d9646bfcdf0c0428197dba1ecb27a33bb6e031d002fa88653fe"}, + {file = "pytest-6.1.2.tar.gz", hash = "sha256:c0a7e94a8cdbc5422a51ccdad8e6f1024795939cc89159a0ae7f0b316ad3823e"}, +] +pytest-dotenv = [ + {file = "pytest-dotenv-0.5.2.tar.gz", hash = "sha256:2dc6c3ac6d8764c71c6d2804e902d0ff810fa19692e95fe138aefc9b1aa73732"}, + {file = "pytest_dotenv-0.5.2-py3-none-any.whl", hash = "sha256:40a2cece120a213898afaa5407673f6bd924b1fa7eafce6bda0e8abffe2f710f"}, +] +python-dotenv = [ + {file = "python-dotenv-0.15.0.tar.gz", hash = "sha256:587825ed60b1711daea4832cf37524dfd404325b7db5e25ebe88c495c9f807a0"}, + {file = "python_dotenv-0.15.0-py2.py3-none-any.whl", hash = "sha256:0c8d1b80d1a1e91717ea7d526178e3882732420b03f08afea0406db6402e220e"}, +] +six = [ + {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, + {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, +] +taskipy = [ + {file = "taskipy-1.4.0-py3-none-any.whl", hash = "sha256:2caa3d4897aee1e17eddabf7b92b3a8d8824eb17d3932b69381b8306883c106a"}, + {file = "taskipy-1.4.0.tar.gz", hash = "sha256:9fa86f9d7b5816d7ef789bc1631ee3bf78290554e251dc2dc29cb9ddbf9ebe1e"}, +] +toml = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] +typed-ast = [ + {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"}, + {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb"}, + {file = "typed_ast-1.4.1-cp35-cp35m-win32.whl", hash = "sha256:0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919"}, + {file = "typed_ast-1.4.1-cp35-cp35m-win_amd64.whl", hash = "sha256:4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01"}, + {file = "typed_ast-1.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75"}, + {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652"}, + {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"}, + {file = "typed_ast-1.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:fcf135e17cc74dbfbc05894ebca928ffeb23d9790b3167a674921db19082401f"}, + {file = "typed_ast-1.4.1-cp36-cp36m-win32.whl", hash = "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1"}, + {file = "typed_ast-1.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa"}, + {file = "typed_ast-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614"}, + {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41"}, + {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b"}, + {file = "typed_ast-1.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:f208eb7aff048f6bea9586e61af041ddf7f9ade7caed625742af423f6bae3298"}, + {file = "typed_ast-1.4.1-cp37-cp37m-win32.whl", hash = "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe"}, + {file = "typed_ast-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355"}, + {file = "typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6"}, + {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907"}, + {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d"}, + {file = "typed_ast-1.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:7e4c9d7658aaa1fc80018593abdf8598bf91325af6af5cce4ce7c73bc45ea53d"}, + {file = "typed_ast-1.4.1-cp38-cp38-win32.whl", hash = "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c"}, + {file = "typed_ast-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4"}, + {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"}, + {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:92c325624e304ebf0e025d1224b77dd4e6393f18aab8d829b5b7e04afe9b7a2c"}, + {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:d648b8e3bf2fe648745c8ffcee3db3ff903d0817a01a12dd6a6ea7a8f4889072"}, + {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:fac11badff8313e23717f3dada86a15389d0708275bddf766cca67a84ead3e91"}, + {file = "typed_ast-1.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:0d8110d78a5736e16e26213114a38ca35cb15b6515d535413b090bd50951556d"}, + {file = "typed_ast-1.4.1-cp39-cp39-win32.whl", hash = "sha256:b52ccf7cfe4ce2a1064b18594381bccf4179c2ecf7f513134ec2f993dd4ab395"}, + {file = "typed_ast-1.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:3742b32cf1c6ef124d57f95be609c473d7ec4c14d0090e5a5e05a15269fb4d0c"}, + {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"}, +] +wrapt = [ + {file = "wrapt-1.12.1.tar.gz", hash = "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"}, +] +zipp = [ + {file = "zipp-3.4.0-py3-none-any.whl", hash = "sha256:102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108"}, + {file = "zipp-3.4.0.tar.gz", hash = "sha256:ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e084233 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[tool.poetry] +name = "python-todo-app" +version = "0.1.0" +description = "" +authors = ["Kalle Ilves "] + +[tool.poetry.dependencies] +python = "^3.6" +python-dotenv = "^0.15.0" +taskipy = "^1.4.0" + +[tool.poetry.dev-dependencies] +pylint = "^2.6.0" +autopep8 = "^1.5.4" +pytest = "^6.1.2" +pytest-dotenv = "^0.5.2" +coverage = "^5.3" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.taskipy.tasks] +start = "python3 src/index.py" +build = "python3 src/build.py" +lint = "pylint src" +format = "autopep8 --in-place --recursive src" +test = "pytest" +coverage = "coverage run --branch -m pytest" +coverage-report = "coverage html" diff --git a/pytest.ini b/pytest.ini index 3188796..3921a5e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,3 @@ [pytest] -env_override_existing_values = 1 env_files = .env.test diff --git a/src/config.py b/src/config.py index 10a263e..586821c 100644 --- a/src/config.py +++ b/src/config.py @@ -1,7 +1,13 @@ import os +from dotenv import load_dotenv dirname = os.path.dirname(__file__) +try: + load_dotenv(dotenv_path=os.path.join(dirname, '..', '.env')) +except FileNotFoundError: + pass + TODOS_FILENAME = os.getenv('TODOS_FILENAME') or 'todos.csv' TODOS_FILE_PATH = os.path.join(dirname, '..', 'data', TODOS_FILENAME) From 9ff30ccbc9f9bd74f311ce2b2865640393a11685 Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Wed, 4 Nov 2020 10:19:45 +0200 Subject: [PATCH 02/10] remove taskipy --- poetry.lock | 44 ++------------------------------------------ pyproject.toml | 1 - 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/poetry.lock b/poetry.lock index 8c37404..d622a24 100644 --- a/poetry.lock +++ b/poetry.lock @@ -144,17 +144,6 @@ importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} [package.extras] dev = ["pre-commit", "tox"] -[[package]] -name = "psutil" -version = "5.7.3" -description = "Cross-platform lib for process and system monitoring in Python." -category = "main" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - -[package.extras] -test = ["ipaddress", "mock", "unittest2", "enum34", "pywin32", "wmi"] - [[package]] name = "py" version = "1.9.0" @@ -248,23 +237,11 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" -[[package]] -name = "taskipy" -version = "1.4.0" -description = "tasks runner for python projects" -category = "main" -optional = false -python-versions = ">=3.6,<4.0" - -[package.dependencies] -psutil = ">=5.7.2,<6.0.0" -toml = ">=0.10.0,<0.11.0" - [[package]] name = "toml" version = "0.10.2" description = "Python Library for Tom's Obvious, Minimal Language" -category = "main" +category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" @@ -299,7 +276,7 @@ testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake [metadata] lock-version = "1.1" python-versions = "^3.6" -content-hash = "1388a315c30f3029ade3d082c3394f753d77d98e8eaf483d7d30d49a6a3bf3d3" +content-hash = "4571f6549f8c82bd039af3319030b887e891ef5ff1e90033a1f3478a275f8946" [metadata.files] astroid = [ @@ -404,19 +381,6 @@ pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, ] -psutil = [ - {file = "psutil-5.7.3-cp27-none-win32.whl", hash = "sha256:1cd6a0c9fb35ece2ccf2d1dd733c1e165b342604c67454fd56a4c12e0a106787"}, - {file = "psutil-5.7.3-cp27-none-win_amd64.whl", hash = "sha256:e02c31b2990dcd2431f4524b93491941df39f99619b0d312dfe1d4d530b08b4b"}, - {file = "psutil-5.7.3-cp35-cp35m-win32.whl", hash = "sha256:56c85120fa173a5d2ad1d15a0c6e0ae62b388bfb956bb036ac231fbdaf9e4c22"}, - {file = "psutil-5.7.3-cp35-cp35m-win_amd64.whl", hash = "sha256:fa38ac15dbf161ab1e941ff4ce39abd64b53fec5ddf60c23290daed2bc7d1157"}, - {file = "psutil-5.7.3-cp36-cp36m-win32.whl", hash = "sha256:01bc82813fbc3ea304914581954979e637bcc7084e59ac904d870d6eb8bb2bc7"}, - {file = "psutil-5.7.3-cp36-cp36m-win_amd64.whl", hash = "sha256:6a3e1fd2800ca45083d976b5478a2402dd62afdfb719b30ca46cd28bb25a2eb4"}, - {file = "psutil-5.7.3-cp37-cp37m-win32.whl", hash = "sha256:fbcac492cb082fa38d88587d75feb90785d05d7e12d4565cbf1ecc727aff71b7"}, - {file = "psutil-5.7.3-cp37-cp37m-win_amd64.whl", hash = "sha256:5d9106ff5ec2712e2f659ebbd112967f44e7d33f40ba40530c485cc5904360b8"}, - {file = "psutil-5.7.3-cp38-cp38-win32.whl", hash = "sha256:ade6af32eb80a536eff162d799e31b7ef92ddcda707c27bbd077238065018df4"}, - {file = "psutil-5.7.3-cp38-cp38-win_amd64.whl", hash = "sha256:2cb55ef9591b03ef0104bedf67cc4edb38a3edf015cf8cf24007b99cb8497542"}, - {file = "psutil-5.7.3.tar.gz", hash = "sha256:af73f7bcebdc538eda9cc81d19db1db7bf26f103f91081d780bbacfcb620dee2"}, -] py = [ {file = "py-1.9.0-py2.py3-none-any.whl", hash = "sha256:366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2"}, {file = "py-1.9.0.tar.gz", hash = "sha256:9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"}, @@ -449,10 +413,6 @@ six = [ {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, ] -taskipy = [ - {file = "taskipy-1.4.0-py3-none-any.whl", hash = "sha256:2caa3d4897aee1e17eddabf7b92b3a8d8824eb17d3932b69381b8306883c106a"}, - {file = "taskipy-1.4.0.tar.gz", hash = "sha256:9fa86f9d7b5816d7ef789bc1631ee3bf78290554e251dc2dc29cb9ddbf9ebe1e"}, -] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, diff --git a/pyproject.toml b/pyproject.toml index e084233..3631d83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,6 @@ authors = ["Kalle Ilves "] [tool.poetry.dependencies] python = "^3.6" python-dotenv = "^0.15.0" -taskipy = "^1.4.0" [tool.poetry.dev-dependencies] pylint = "^2.6.0" From 30522a669d6f15d8e729d73f0b5f2d066930b241 Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Wed, 4 Nov 2020 10:42:02 +0200 Subject: [PATCH 03/10] poe --- README.md | 14 +++++++------- poetry.lock | 42 +++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 3 ++- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0c93b81..a830596 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ python3 -m poetry install 2. Suorita vaadittavat alustustoimenpiteet komennolla: ```bash -python3 -m poetry run task build +python3 -m poetry run poe build ``` 3. Käynnistä sovellus komennolla: ```bash -python3 -m poetry run task start +python3 -m poetry run poe start ``` ## Komentorivitoiminnot @@ -43,7 +43,7 @@ python3 -m poetry run task start Ohjelman pystyy suorittamaan komennolla: ```bash -python3 -m poetry run task start +python3 -m poetry run poe start ``` ### Testaus @@ -51,7 +51,7 @@ python3 -m poetry run task start Testit suoritetaan komennolla: ```bash -python3 -m poetry run task test +python3 -m poetry run poe test ``` ### Testikattavuus @@ -59,13 +59,13 @@ python3 -m poetry run task test Testikattavuus kerätään kommenolla: ```bash -python3 -m poetry run task coverage +python3 -m poetry run poe coverage ``` Tämän jälkeen raportin voi generoida komennolla: ```bash -python3 -m poetry run task coverage-report +python3 -m poetry run poe coverage-report ``` Raportti generoituu _htmlcov_-hakemistoon. @@ -75,5 +75,5 @@ Raportti generoituu _htmlcov_-hakemistoon. Tiedoston [.pylintrc](./.pylintrc) määrittelemät tarkistukset voi suorittaa komennolla: ```bash -python3 -m poetry run task lint +python3 -m poetry run poe lint ``` diff --git a/poetry.lock b/poetry.lock index d622a24..d24d391 100644 --- a/poetry.lock +++ b/poetry.lock @@ -130,6 +130,14 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" pyparsing = ">=2.0.2" six = "*" +[[package]] +name = "pastel" +version = "0.2.1" +description = "Bring colors to your terminal." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + [[package]] name = "pluggy" version = "0.13.1" @@ -144,6 +152,18 @@ importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} [package.extras] dev = ["pre-commit", "tox"] +[[package]] +name = "poethepoet" +version = "0.9.0" +description = "A task runner that works well with poetry." +category = "main" +optional = false +python-versions = ">=3.6,<4.0" + +[package.dependencies] +pastel = ">=0.2.0,<0.3.0" +tomlkit = ">=0.6.0,<1.0.0" + [[package]] name = "py" version = "1.9.0" @@ -245,6 +265,14 @@ category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +[[package]] +name = "tomlkit" +version = "0.7.0" +description = "Style preserving TOML library" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + [[package]] name = "typed-ast" version = "1.4.1" @@ -276,7 +304,7 @@ testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake [metadata] lock-version = "1.1" python-versions = "^3.6" -content-hash = "4571f6549f8c82bd039af3319030b887e891ef5ff1e90033a1f3478a275f8946" +content-hash = "512ac287ee17b0f4d259a3c5ae67dfe345ed02164d1c61dde95e3b09ce24549f" [metadata.files] astroid = [ @@ -377,10 +405,18 @@ packaging = [ {file = "packaging-20.4-py2.py3-none-any.whl", hash = "sha256:998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"}, {file = "packaging-20.4.tar.gz", hash = "sha256:4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"}, ] +pastel = [ + {file = "pastel-0.2.1-py2.py3-none-any.whl", hash = "sha256:4349225fcdf6c2bb34d483e523475de5bb04a5c10ef711263452cb37d7dd4364"}, + {file = "pastel-0.2.1.tar.gz", hash = "sha256:e6581ac04e973cac858828c6202c1e1e81fee1dc7de7683f3e1ffe0bfd8a573d"}, +] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, ] +poethepoet = [ + {file = "poethepoet-0.9.0-py3-none-any.whl", hash = "sha256:6b1df9a755c297d5b10749cd4713924055b41edfa62055770c8bd6b5da8e2c69"}, + {file = "poethepoet-0.9.0.tar.gz", hash = "sha256:ab2263fd7be81d16d38a4b4fe42a055d992d04421e61cad36498b1e4bd8ee2a6"}, +] py = [ {file = "py-1.9.0-py2.py3-none-any.whl", hash = "sha256:366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2"}, {file = "py-1.9.0.tar.gz", hash = "sha256:9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"}, @@ -417,6 +453,10 @@ toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] +tomlkit = [ + {file = "tomlkit-0.7.0-py2.py3-none-any.whl", hash = "sha256:6babbd33b17d5c9691896b0e68159215a9387ebfa938aa3ac42f4a4beeb2b831"}, + {file = "tomlkit-0.7.0.tar.gz", hash = "sha256:ac57f29693fab3e309ea789252fcce3061e19110085aa31af5446ca749325618"}, +] typed-ast = [ {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"}, {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb"}, diff --git a/pyproject.toml b/pyproject.toml index 3631d83..dc00762 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ authors = ["Kalle Ilves "] [tool.poetry.dependencies] python = "^3.6" python-dotenv = "^0.15.0" +poethepoet = "^0.9.0" [tool.poetry.dev-dependencies] pylint = "^2.6.0" @@ -19,7 +20,7 @@ coverage = "^5.3" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" -[tool.taskipy.tasks] +[tool.poe.tasks] start = "python3 src/index.py" build = "python3 src/build.py" lint = "pylint src" From feb1e6503062ebd896ac376b1eeee23c4cdeb2a1 Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Wed, 4 Nov 2020 11:30:43 +0200 Subject: [PATCH 04/10] invoke --- README.md | 20 +++++++----------- poetry.lock | 55 +++++++++++++------------------------------------- pyproject.toml | 11 +--------- tasks.py | 36 +++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 64 deletions(-) create mode 100644 tasks.py diff --git a/README.md b/README.md index a830596..890b829 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ python3 -m poetry install 2. Suorita vaadittavat alustustoimenpiteet komennolla: ```bash -python3 -m poetry run poe build +python3 -m poetry run invoke build ``` 3. Käynnistä sovellus komennolla: ```bash -python3 -m poetry run poe start +python3 -m poetry run invoke start ``` ## Komentorivitoiminnot @@ -43,7 +43,7 @@ python3 -m poetry run poe start Ohjelman pystyy suorittamaan komennolla: ```bash -python3 -m poetry run poe start +python3 -m poetry run invoke start ``` ### Testaus @@ -51,21 +51,15 @@ python3 -m poetry run poe start Testit suoritetaan komennolla: ```bash -python3 -m poetry run poe test +python3 -m poetry run invoke test ``` ### Testikattavuus -Testikattavuus kerätään kommenolla: +Testikattavuusraportin voi generoida komennolla: ```bash -python3 -m poetry run poe coverage -``` - -Tämän jälkeen raportin voi generoida komennolla: - -```bash -python3 -m poetry run poe coverage-report +python3 -m poetry run invoke coveragereport ``` Raportti generoituu _htmlcov_-hakemistoon. @@ -75,5 +69,5 @@ Raportti generoituu _htmlcov_-hakemistoon. Tiedoston [.pylintrc](./.pylintrc) määrittelemät tarkistukset voi suorittaa komennolla: ```bash -python3 -m poetry run poe lint +python3 -m poetry run invoke lint ``` diff --git a/poetry.lock b/poetry.lock index d24d391..89915e4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -88,6 +88,14 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "invoke" +version = "1.4.1" +description = "Pythonic task execution" +category = "main" +optional = false +python-versions = "*" + [[package]] name = "isort" version = "4.3.21" @@ -130,14 +138,6 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" pyparsing = ">=2.0.2" six = "*" -[[package]] -name = "pastel" -version = "0.2.1" -description = "Bring colors to your terminal." -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - [[package]] name = "pluggy" version = "0.13.1" @@ -152,18 +152,6 @@ importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} [package.extras] dev = ["pre-commit", "tox"] -[[package]] -name = "poethepoet" -version = "0.9.0" -description = "A task runner that works well with poetry." -category = "main" -optional = false -python-versions = ">=3.6,<4.0" - -[package.dependencies] -pastel = ">=0.2.0,<0.3.0" -tomlkit = ">=0.6.0,<1.0.0" - [[package]] name = "py" version = "1.9.0" @@ -265,14 +253,6 @@ category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -[[package]] -name = "tomlkit" -version = "0.7.0" -description = "Style preserving TOML library" -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" - [[package]] name = "typed-ast" version = "1.4.1" @@ -304,7 +284,7 @@ testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake [metadata] lock-version = "1.1" python-versions = "^3.6" -content-hash = "512ac287ee17b0f4d259a3c5ae67dfe345ed02164d1c61dde95e3b09ce24549f" +content-hash = "a042d6df87d3ac8a77587cf38f15adf6a5b6c584f64aacbec084ca9f4879e347" [metadata.files] astroid = [ @@ -370,6 +350,11 @@ iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] +invoke = [ + {file = "invoke-1.4.1-py2-none-any.whl", hash = "sha256:93e12876d88130c8e0d7fd6618dd5387d6b36da55ad541481dfa5e001656f134"}, + {file = "invoke-1.4.1-py3-none-any.whl", hash = "sha256:87b3ef9d72a1667e104f89b159eaf8a514dbf2f3576885b2bbdefe74c3fb2132"}, + {file = "invoke-1.4.1.tar.gz", hash = "sha256:de3f23bfe669e3db1085789fd859eb8ca8e0c5d9c20811e2407fa042e8a5e15d"}, +] isort = [ {file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"}, {file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"}, @@ -405,18 +390,10 @@ packaging = [ {file = "packaging-20.4-py2.py3-none-any.whl", hash = "sha256:998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"}, {file = "packaging-20.4.tar.gz", hash = "sha256:4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"}, ] -pastel = [ - {file = "pastel-0.2.1-py2.py3-none-any.whl", hash = "sha256:4349225fcdf6c2bb34d483e523475de5bb04a5c10ef711263452cb37d7dd4364"}, - {file = "pastel-0.2.1.tar.gz", hash = "sha256:e6581ac04e973cac858828c6202c1e1e81fee1dc7de7683f3e1ffe0bfd8a573d"}, -] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, ] -poethepoet = [ - {file = "poethepoet-0.9.0-py3-none-any.whl", hash = "sha256:6b1df9a755c297d5b10749cd4713924055b41edfa62055770c8bd6b5da8e2c69"}, - {file = "poethepoet-0.9.0.tar.gz", hash = "sha256:ab2263fd7be81d16d38a4b4fe42a055d992d04421e61cad36498b1e4bd8ee2a6"}, -] py = [ {file = "py-1.9.0-py2.py3-none-any.whl", hash = "sha256:366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2"}, {file = "py-1.9.0.tar.gz", hash = "sha256:9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"}, @@ -453,10 +430,6 @@ toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] -tomlkit = [ - {file = "tomlkit-0.7.0-py2.py3-none-any.whl", hash = "sha256:6babbd33b17d5c9691896b0e68159215a9387ebfa938aa3ac42f4a4beeb2b831"}, - {file = "tomlkit-0.7.0.tar.gz", hash = "sha256:ac57f29693fab3e309ea789252fcce3061e19110085aa31af5446ca749325618"}, -] typed-ast = [ {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"}, {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb"}, diff --git a/pyproject.toml b/pyproject.toml index dc00762..de3eafc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ authors = ["Kalle Ilves "] [tool.poetry.dependencies] python = "^3.6" python-dotenv = "^0.15.0" -poethepoet = "^0.9.0" +invoke = "^1.4.1" [tool.poetry.dev-dependencies] pylint = "^2.6.0" @@ -19,12 +19,3 @@ coverage = "^5.3" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" - -[tool.poe.tasks] -start = "python3 src/index.py" -build = "python3 src/build.py" -lint = "pylint src" -format = "autopep8 --in-place --recursive src" -test = "pytest" -coverage = "coverage run --branch -m pytest" -coverage-report = "coverage html" diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..6939203 --- /dev/null +++ b/tasks.py @@ -0,0 +1,36 @@ +from invoke import task + + +@task +def start(ctx): + ctx.run("python3 src/index.py") + + +@task +def build(ctx): + ctx.run("python3 src/build.py") + + +@task +def test(ctx): + ctx.run("pytest") + + +@task +def lint(ctx): + ctx.run("pylint src") + + +@task +def format(ctx): # pylint: disable=redefined-builtin + ctx.run("autopep8 --in-place --recursive src") + + +@task +def coverage(ctx): + ctx.run("coverage run --branch -m pytest") + + +@task(coverage) +def coveragereport(ctx): + ctx.run("coverage html") From 97fb1a32558b271e46a586758f478acf6529bb80 Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Wed, 4 Nov 2020 17:50:32 +0200 Subject: [PATCH 05/10] poetry stuff --- README.md | 2 +- dokumentaatio/kayttoohje.md | 6 +++--- dokumentaatio/testaus.md | 2 +- tasks.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 890b829..bd0f610 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ python3 -m poetry run invoke test Testikattavuusraportin voi generoida komennolla: ```bash -python3 -m poetry run invoke coveragereport +python3 -m poetry run invoke coverage-report ``` Raportti generoituu _htmlcov_-hakemistoon. diff --git a/dokumentaatio/kayttoohje.md b/dokumentaatio/kayttoohje.md index 1dd5704..e006a4f 100644 --- a/dokumentaatio/kayttoohje.md +++ b/dokumentaatio/kayttoohje.md @@ -16,19 +16,19 @@ DATABASE_FILENAME=database.sqlite Ennen ohjelman käynnistämistä, asenna riippuvuudet komennolla: ```bash -python3 -m pipenv install +python3 -m poetry install ``` Jonka jälkeen suorita alustustoimenpiteet komennolla: ```bash -python3 -m pipenv run build +python3 -m poetry run invoke build ``` Nyt ohjelman voi käynnistää komennolla: ``` -python3 -m pipenv run start +python3 -m poetry run invoke start ``` ## Kirjautuminen diff --git a/dokumentaatio/testaus.md b/dokumentaatio/testaus.md index 99c3403..ccd6280 100644 --- a/dokumentaatio/testaus.md +++ b/dokumentaatio/testaus.md @@ -39,4 +39,4 @@ Kaikki [määrittelydokumentin](./vaatimusmaarittely.md#perusversion-tarjoama-to Sovellus ei anna tällä hetkellä järkeviä virheilmoituksia, seuraavissa tilanteissa: - Konfiguraation määrittelemiin tiedostoihin ei ole luku/kirjoitusoikeuksia -- SQLite tietokantaa ei ole alustettu, eli `python -m pipenv run build`-komentoa ei ole suoritettu +- SQLite tietokantaa ei ole alustettu, eli `python -m poetry run invoke build`-komentoa ei ole suoritettu diff --git a/tasks.py b/tasks.py index 6939203..d5c336b 100644 --- a/tasks.py +++ b/tasks.py @@ -32,5 +32,5 @@ def coverage(ctx): @task(coverage) -def coveragereport(ctx): +def coverage_report(ctx): ctx.run("coverage html") From 8b9721ca4aab2d9976b1c80f8690a0de43dafbbf Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Wed, 4 Nov 2020 18:40:15 +0200 Subject: [PATCH 06/10] authors --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index de3eafc..9cd89e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "python-todo-app" version = "0.1.0" description = "" -authors = ["Kalle Ilves "] +authors = ["Kalle Ilves "] [tool.poetry.dependencies] python = "^3.6" From c419e369bd614e0c18a446a3cd376509f56d9cab Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Wed, 18 Nov 2020 14:24:54 +0200 Subject: [PATCH 07/10] readme --- README.md | 14 +++++++------- dokumentaatio/kayttoohje.md | 6 +++--- src/index.py | 16 +++++++++++----- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index bd0f610..99e0f43 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,19 @@ Sovelluksen toiminta on testattu Python-versiolla `3.6.0`. Etenkin vanhempien Py 1. Asenna riippuvuut komennolla: ```bash -python3 -m poetry install +poetry install ``` 2. Suorita vaadittavat alustustoimenpiteet komennolla: ```bash -python3 -m poetry run invoke build +poetry run invoke build ``` 3. Käynnistä sovellus komennolla: ```bash -python3 -m poetry run invoke start +poetry run invoke start ``` ## Komentorivitoiminnot @@ -43,7 +43,7 @@ python3 -m poetry run invoke start Ohjelman pystyy suorittamaan komennolla: ```bash -python3 -m poetry run invoke start +poetry run invoke start ``` ### Testaus @@ -51,7 +51,7 @@ python3 -m poetry run invoke start Testit suoritetaan komennolla: ```bash -python3 -m poetry run invoke test +poetry run invoke test ``` ### Testikattavuus @@ -59,7 +59,7 @@ python3 -m poetry run invoke test Testikattavuusraportin voi generoida komennolla: ```bash -python3 -m poetry run invoke coverage-report +poetry run invoke coverage-report ``` Raportti generoituu _htmlcov_-hakemistoon. @@ -69,5 +69,5 @@ Raportti generoituu _htmlcov_-hakemistoon. Tiedoston [.pylintrc](./.pylintrc) määrittelemät tarkistukset voi suorittaa komennolla: ```bash -python3 -m poetry run invoke lint +poetry run invoke lint ``` diff --git a/dokumentaatio/kayttoohje.md b/dokumentaatio/kayttoohje.md index e006a4f..9be860e 100644 --- a/dokumentaatio/kayttoohje.md +++ b/dokumentaatio/kayttoohje.md @@ -16,19 +16,19 @@ DATABASE_FILENAME=database.sqlite Ennen ohjelman käynnistämistä, asenna riippuvuudet komennolla: ```bash -python3 -m poetry install +poetry install ``` Jonka jälkeen suorita alustustoimenpiteet komennolla: ```bash -python3 -m poetry run invoke build +poetry run invoke build ``` Nyt ohjelman voi käynnistää komennolla: ``` -python3 -m poetry run invoke start +poetry run invoke start ``` ## Kirjautuminen diff --git a/src/index.py b/src/index.py index 538fdd7..0e24430 100644 --- a/src/index.py +++ b/src/index.py @@ -1,10 +1,16 @@ from tkinter import Tk from ui.ui import UI -window = Tk() -window.title('TodoApp') -ui = UI(window) -ui.start() +def main(): + window = Tk() + window.title('TodoApp') -window.mainloop() + ui = UI(window) + ui.start() + + window.mainloop() + + +if __name__ == '__main__': + main() From 8e57344cec7a3cf0356da1263290358dc856289c Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Wed, 18 Nov 2020 14:29:54 +0200 Subject: [PATCH 08/10] exception naming --- src/services/todo_service.py | 12 ++++++------ src/tests/services/todo_service_test.py | 8 ++++---- src/ui/create_user_view.py | 4 ++-- src/ui/login_view.py | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/services/todo_service.py b/src/services/todo_service.py index cb510bd..8771e26 100644 --- a/src/services/todo_service.py +++ b/src/services/todo_service.py @@ -10,11 +10,11 @@ ) -class InvalidCredentials(Exception): +class InvalidCredentialsError(Exception): pass -class UsernameExists(Exception): +class UsernameExistsError(Exception): pass @@ -93,14 +93,14 @@ def login(self, username, password): Returns: Kirjautunut käyttäjä User-olion muodossa. Raises: - InvalidCredentials: + InvalidCredentialsError: Virhe, joka tapahtuu, kun käyttäjätunnus ja salasana eivät täsmää. """ user = self.user_repository.find_by_username(username) if not user or user.password != password: - raise InvalidCredentials('Invalid username or password') + raise InvalidCredentialsError('Invalid username or password') self.user = user @@ -138,7 +138,7 @@ def create_user(self, username, password, login=True): Boolean-arvo, joka kertoo kirjataanko käyttäjä sisään onnistuneen luonnin jälkeen. Raises: - UsernameExists: Virhe, joka tapahtuu, kun käyttäjätunnus on jo käytössä. + UsernameExistsError: Virhe, joka tapahtuu, kun käyttäjätunnus on jo käytössä. Returns: Luotu käyttäjä User-olion muodossa. @@ -147,7 +147,7 @@ def create_user(self, username, password, login=True): existing_user = self.user_repository.find_by_username(username) if existing_user: - raise UsernameExists(f'Username {username} already exists') + raise UsernameExistsError(f'Username {username} already exists') user = self.user_repository.create(User(username, password)) diff --git a/src/tests/services/todo_service_test.py b/src/tests/services/todo_service_test.py index 768388b..b8f57a0 100644 --- a/src/tests/services/todo_service_test.py +++ b/src/tests/services/todo_service_test.py @@ -3,8 +3,8 @@ from entities.user import User from services.todo_service import ( TodoService, - InvalidCredentials, - UsernameExists + InvalidCredentialsError, + UsernameExistsError ) @@ -137,7 +137,7 @@ def test_login_with_valid_username_and_password(self): def test_login_with_invalid_username_and_password(self): self.assertRaises( - InvalidCredentials, + InvalidCredentialsError, lambda: self.todo_service.login('testing', 'invalid') ) @@ -165,6 +165,6 @@ def test_create_user_with_existing_username(self): self.todo_service.create_user(username, 'something') self.assertRaises( - UsernameExists, + UsernameExistsError, lambda: self.todo_service.create_user(username, 'random') ) diff --git a/src/ui/create_user_view.py b/src/ui/create_user_view.py index 92a2d78..d3902bd 100644 --- a/src/ui/create_user_view.py +++ b/src/ui/create_user_view.py @@ -1,5 +1,5 @@ from tkinter import ttk, StringVar, constants -from services.todo_service import todo_service, UsernameExists +from services.todo_service import todo_service, UsernameExistsError class CreateUserView: @@ -26,7 +26,7 @@ def create_user_handler(self): try: todo_service.create_user(username, password) self.handle_create_user() - except UsernameExists: + except UsernameExistsError: self.show_error(f'Username {username} already exists') def show_error(self, message): diff --git a/src/ui/login_view.py b/src/ui/login_view.py index a4191db..0707699 100644 --- a/src/ui/login_view.py +++ b/src/ui/login_view.py @@ -1,5 +1,5 @@ from tkinter import ttk, StringVar, constants -from services.todo_service import todo_service, InvalidCredentials +from services.todo_service import todo_service, InvalidCredentialsError class LoginView: @@ -22,7 +22,7 @@ def login_handler(self): try: todo_service.login(username, password) self.handle_login() - except InvalidCredentials: + except InvalidCredentialsError: self.show_error('Invalid username or password') def show_error(self, message): From a27888c318b5093ee5bf7f96cef9efe88f4f522e Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Fri, 4 Dec 2020 12:49:19 +0200 Subject: [PATCH 09/10] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 99e0f43..8858be7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +⚠️ **Huom! Referenssisovelluksen, kuten muidenkin sovellusten plagiointi, johtaa projektin hylkäämiseen.** + # TodoApp Sovelluksen avulla käyttäjien on mahdollista pitää kirjaa tekemättömistään töistä eli todoista. Sovellusta on mahdollista käyttää useamman rekisteröityneen käyttäjän, joilla kaikilla on oma yksilöllinen tehtävälistansa. From b0655ce028b7b33b81b3c6abb952230752ebd5c7 Mon Sep 17 00:00:00 2001 From: Kalle Ilves Date: Sat, 12 Dec 2020 15:47:06 +0200 Subject: [PATCH 10/10] privates --- src/repositories/todo_repository.py | 92 +++++++++---------- src/repositories/user_repository.py | 14 +-- src/services/todo_service.py | 40 ++++----- src/ui/create_user_view.py | 98 ++++++++++----------- src/ui/login_view.py | 96 ++++++++++---------- src/ui/todos_view.py | 132 ++++++++++++++-------------- src/ui/ui.py | 54 ++++++------ 7 files changed, 260 insertions(+), 266 deletions(-) diff --git a/src/repositories/todo_repository.py b/src/repositories/todo_repository.py index 4bc88c7..f7e536b 100644 --- a/src/repositories/todo_repository.py +++ b/src/repositories/todo_repository.py @@ -6,50 +6,10 @@ class TodoRepository: def __init__(self, file_path): - self.file_path = file_path - - def ensure_file_exists(self): - # The touch method will create the file if it doesn't exist - Path(self.file_path).touch() - - def read(self): - todos = [] - - self.ensure_file_exists() - - with open(self.file_path) as file: - for row in file: - row = row.replace('\n', '') - parts = row.split(';') - - todo_id = parts[0] - content = parts[1] - done = parts[2] == '1' - username = parts[3] - - user = user_repository.find_by_username( - username) if username else None - - todos.append( - Todo(content, done, user, todo_id) - ) - - return todos - - def write(self, todos): - self.ensure_file_exists() - - with open(self.file_path, 'w') as file: - for todo in todos: - done_string = '1' if todo.done else '0' - username = todo.user.username if todo.user else '' - - row = f'{todo.id};{todo.content};{done_string};{username}' - - file.write(row+'\n') + self._file_path = file_path def find_all(self): - return self.read() + return self._read() def find_by_username(self, username): todos = self.find_all() @@ -64,7 +24,7 @@ def create(self, todo): todos.append(todo) - self.write(todos) + self._write(todos) return todo @@ -76,17 +36,57 @@ def set_done(self, todo_id, done=True): todo.done = done break - self.write(todos) + self._write(todos) def delete(self, todo_id): todos = self.find_all() todos_without_id = filter(lambda todo: todo.id != todo_id, todos) - self.write(todos_without_id) + self._write(todos_without_id) def delete_all(self): - self.write([]) + self._write([]) + + def _ensure_file_exists(self): + # luodaan tiedosto, jos se ei ole vielä olemassa + Path(self._file_path).touch() + + def _read(self): + todos = [] + + self._ensure_file_exists() + + with open(self._file_path) as file: + for row in file: + row = row.replace('\n', '') + parts = row.split(';') + + todo_id = parts[0] + content = parts[1] + done = parts[2] == '1' + username = parts[3] + + user = user_repository.find_by_username( + username) if username else None + + todos.append( + Todo(content, done, user, todo_id) + ) + + return todos + + def _write(self, todos): + self._ensure_file_exists() + + with open(self._file_path, 'w') as file: + for todo in todos: + done_string = '1' if todo.done else '0' + username = todo.user.username if todo.user else '' + + row = f'{todo.id};{todo.content};{done_string};{username}' + + file.write(row+'\n') todo_repository = TodoRepository(TODOS_FILE_PATH) diff --git a/src/repositories/user_repository.py b/src/repositories/user_repository.py index f81d485..01940ad 100644 --- a/src/repositories/user_repository.py +++ b/src/repositories/user_repository.py @@ -8,10 +8,10 @@ def get_user_by_row(row): class UserRepository: def __init__(self, connection): - self.connection = connection + self._connection = connection def find_all(self): - cursor = self.connection.cursor() + cursor = self._connection.cursor() cursor.execute('select * from users') @@ -20,7 +20,7 @@ def find_all(self): return list(map(get_user_by_row, rows)) def find_by_username(self, username): - cursor = self.connection.cursor() + cursor = self._connection.cursor() cursor.execute( 'select * from users where username = ?', @@ -32,23 +32,23 @@ def find_by_username(self, username): return get_user_by_row(row) def create(self, user): - cursor = self.connection.cursor() + cursor = self._connection.cursor() cursor.execute( 'insert into users (username, password) values (?, ?)', (user.username, user.password) ) - self.connection.commit() + self._connection.commit() return user def delete_all(self): - cursor = self.connection.cursor() + cursor = self._connection.cursor() cursor.execute('delete from users') - self.connection.commit() + self._connection.commit() user_repository = UserRepository(get_database_connection()) diff --git a/src/services/todo_service.py b/src/services/todo_service.py index 8771e26..bf23817 100644 --- a/src/services/todo_service.py +++ b/src/services/todo_service.py @@ -19,13 +19,7 @@ class UsernameExistsError(Exception): class TodoService: - """Sovelluslogiikasta vastaa luokka. - - Attributes: - user: User-olio, joka kuvaa soovellukseen kirjautunutta käyttäjää. - todo_repository: Olio, jolla on TodoRepository-luokkaa vastaavat metodit. - user_repository: Olio, jolla on UserRepository-luokkaa vastaavat metodit. - """ + """Sovelluslogiikasta vastaa luokka.""" def __init__( self, @@ -42,9 +36,9 @@ def __init__( Vapaaehtoinen, oletusarvoltaan UserRepository-olio. Olio, jolla on UserRepository-luokkaa vastaavat metodit. """ - self.user = None - self.todo_repository = todo_repository - self.user_repository = user_repository + self._user = None + self._todo_repository = todo_repository + self._user_repository = user_repository def create_todo(self, content): """Luo uuden tehtävän. @@ -55,9 +49,9 @@ def create_todo(self, content): Luotu tehtävä Todo-olion muodossa. """ - todo = Todo(content=content, user=self.user) + todo = Todo(content=content, user=self._user) - return self.todo_repository.create(todo) + return self._todo_repository.create(todo) def get_undone_todos(self): """Palauttaa kirjautuneen käyttäjän tekemättömät tehtävät. @@ -67,10 +61,10 @@ def get_undone_todos(self): Jos kirjautunutta käyttäjää ei ole, palauttaa tyhjän listan. """ - if not self.user: + if not self._user: return [] - todos = self.todo_repository.find_by_username(self.user.username) + todos = self._todo_repository.find_by_username(self._user.username) undone_todos = filter(lambda todo: not todo.done, todos) return list(undone_todos) @@ -82,7 +76,7 @@ def set_todo_done(self, todo_id): todo_id: Merkkijonoarvo, joka kuvaa tehtävän id:tä. """ - self.todo_repository.set_done(todo_id) + self._todo_repository.set_done(todo_id) def login(self, username, password): """Kirjaa käyttäjän sisään. @@ -97,12 +91,12 @@ def login(self, username, password): Virhe, joka tapahtuu, kun käyttäjätunnus ja salasana eivät täsmää. """ - user = self.user_repository.find_by_username(username) + user = self._user_repository.find_by_username(username) if not user or user.password != password: raise InvalidCredentialsError('Invalid username or password') - self.user = user + self._user = user return user @@ -112,7 +106,7 @@ def get_current_user(self): Returns: Kirjautunut käyttäjä User-olion muodossa. """ - return self.user + return self._user def get_users(self): """Palauttaa kaikki käyttäjät. @@ -120,12 +114,12 @@ def get_users(self): Returns: User-oliota sisältä lista kaikista käyttäjistä. """ - return self.user_repository.find_all() + return self._user_repository.find_all() def logout(self): """Kirjaa nykyisen käyttäjän ulos. """ - self.user = None + self._user = None def create_user(self, username, password, login=True): """Luo uuden käyttäjän ja tarvittaessa kirjaa sen sisään. @@ -144,15 +138,15 @@ def create_user(self, username, password, login=True): Luotu käyttäjä User-olion muodossa. """ - existing_user = self.user_repository.find_by_username(username) + existing_user = self._user_repository.find_by_username(username) if existing_user: raise UsernameExistsError(f'Username {username} already exists') - user = self.user_repository.create(User(username, password)) + user = self._user_repository.create(User(username, password)) if login: - self.user = user + self._user = user return user diff --git a/src/ui/create_user_view.py b/src/ui/create_user_view.py index d3902bd..8aaf7dd 100644 --- a/src/ui/create_user_view.py +++ b/src/ui/create_user_view.py @@ -4,91 +4,91 @@ class CreateUserView: def __init__(self, root, handle_create_user, handle_show_login_view): - self.root = root - self.handle_create_user = handle_create_user - self.handle_show_login_view = handle_show_login_view - self.frame = None - self.username_entry = None - self.password_entry = None - self.error_variable = None - self.error_label = None + self._root = root + self._handle_create_user = handle_create_user + self._handle_show_login_view = handle_show_login_view + self._frame = None + self._username_entry = None + self._password_entry = None + self._error_variable = None + self._error_label = None - self.initialize() + self._initialize() - def create_user_handler(self): - username = self.username_entry.get() - password = self.password_entry.get() + def pack(self): + self._frame.pack(fill=constants.X) + + def destroy(self): + self._frame.destroy() + + def _create_user_handler(self): + username = self._username_entry.get() + password = self._password_entry.get() if len(username) == 0 or len(password) == 0: - self.show_error('Username and password is required') + self._show_error('Username and password is required') return try: todo_service.create_user(username, password) - self.handle_create_user() + self._handle_create_user() except UsernameExistsError: - self.show_error(f'Username {username} already exists') + self._show_error(f'Username {username} already exists') - def show_error(self, message): - self.error_variable.set(message) - self.error_label.grid() + def _show_error(self, message): + self._error_variable.set(message) + self._error_label.grid() - def hide_error(self): - self.error_label.grid_remove() + def _hide_error(self): + self._error_label.grid_remove() - def initialize_username_field(self): - username_label = ttk.Label(master=self.frame, text='Username') + def _initialize_username_field(self): + username_label = ttk.Label(master=self._frame, text='Username') - self.username_entry = ttk.Entry(master=self.frame) + self._username_entry = ttk.Entry(master=self._frame) username_label.grid(padx=5, pady=5, sticky=constants.W) - self.username_entry.grid(padx=5, pady=5, sticky=constants.EW) + self._username_entry.grid(padx=5, pady=5, sticky=constants.EW) - def initialize_password_field(self): - password_label = ttk.Label(master=self.frame, text='Password') + def _initialize_password_field(self): + password_label = ttk.Label(master=self._frame, text='Password') - self.password_entry = ttk.Entry(master=self.frame) + self._password_entry = ttk.Entry(master=self._frame) password_label.grid(padx=5, pady=5, sticky=constants.W) - self.password_entry.grid(padx=5, pady=5, sticky=constants.EW) + self._password_entry.grid(padx=5, pady=5, sticky=constants.EW) - def initialize(self): - self.frame = ttk.Frame(master=self.root) + def _initialize(self): + self._frame = ttk.Frame(master=self._root) - self.error_variable = StringVar(self.frame) + self._error_variable = StringVar(self._frame) - self.error_label = ttk.Label( - master=self.frame, - textvariable=self.error_variable, + self._error_label = ttk.Label( + master=self._frame, + textvariable=self._error_variable, foreground='red' ) - self.error_label.grid(padx=5, pady=5) + self._error_label.grid(padx=5, pady=5) - self.initialize_username_field() - self.initialize_password_field() + self._initialize_username_field() + self._initialize_password_field() create_user_button = ttk.Button( - master=self.frame, + master=self._frame, text='Create', - command=self.create_user_handler + command=self._create_user_handler ) login_button = ttk.Button( - master=self.frame, + master=self._frame, text='Login', - command=self.handle_show_login_view + command=self._handle_show_login_view ) - self.frame.grid_columnconfigure(0, weight=1, minsize=400) + self._frame.grid_columnconfigure(0, weight=1, minsize=400) create_user_button.grid(padx=5, pady=5, sticky=constants.EW) login_button.grid(padx=5, pady=5, sticky=constants.EW) - self.hide_error() - - def pack(self): - self.frame.pack(fill=constants.X) - - def destroy(self): - self.frame.destroy() + self._hide_error() diff --git a/src/ui/login_view.py b/src/ui/login_view.py index 0707699..2918a57 100644 --- a/src/ui/login_view.py +++ b/src/ui/login_view.py @@ -4,87 +4,87 @@ class LoginView: def __init__(self, root, handle_login, handle_show_create_user_view): - self.root = root - self.handle_login = handle_login - self.handle_show_create_user_view = handle_show_create_user_view - self.frame = None - self.username_entry = None - self.password_entry = None - self.error_variable = None - self.error_label = None + self._root = root + self._handle_login = handle_login + self._handle_show_create_user_view = handle_show_create_user_view + self._frame = None + self._username_entry = None + self._password_entry = None + self._error_variable = None + self._error_label = None - self.initialize() + self._initialize() - def login_handler(self): - username = self.username_entry.get() - password = self.password_entry.get() + def pack(self): + self._frame.pack(fill=constants.X) + + def destroy(self): + self._frame.destroy() + + def _login_handler(self): + username = self._username_entry.get() + password = self._password_entry.get() try: todo_service.login(username, password) - self.handle_login() + self._handle_login() except InvalidCredentialsError: - self.show_error('Invalid username or password') + self._show_error('Invalid username or password') - def show_error(self, message): - self.error_variable.set(message) - self.error_label.grid() + def _show_error(self, message): + self._error_variable.set(message) + self._error_label.grid() - def hide_error(self): - self.error_label.grid_remove() + def _hide_error(self): + self._error_label.grid_remove() - def initialize_username_field(self): - username_label = ttk.Label(master=self.frame, text='Username') + def _initialize_username_field(self): + username_label = ttk.Label(master=self._frame, text='Username') - self.username_entry = ttk.Entry(master=self.frame) + self._username_entry = ttk.Entry(master=self._frame) username_label.grid(padx=5, pady=5, sticky=constants.W) - self.username_entry.grid(padx=5, pady=5, sticky=constants.EW) + self._username_entry.grid(padx=5, pady=5, sticky=constants.EW) - def initialize_password_field(self): - password_label = ttk.Label(master=self.frame, text='Password') + def _initialize_password_field(self): + password_label = ttk.Label(master=self._frame, text='Password') - self.password_entry = ttk.Entry(master=self.frame) + self._password_entry = ttk.Entry(master=self._frame) password_label.grid(padx=5, pady=5, sticky=constants.W) - self.password_entry.grid(padx=5, pady=5, sticky=constants.EW) + self._password_entry.grid(padx=5, pady=5, sticky=constants.EW) - def initialize(self): - self.frame = ttk.Frame(master=self.root) + def _initialize(self): + self._frame = ttk.Frame(master=self._root) - self.error_variable = StringVar(self.frame) + self._error_variable = StringVar(self._frame) - self.error_label = ttk.Label( - master=self.frame, - textvariable=self.error_variable, + self._error_label = ttk.Label( + master=self._frame, + textvariable=self._error_variable, foreground='red' ) - self.error_label.grid(padx=5, pady=5) + self._error_label.grid(padx=5, pady=5) - self.initialize_username_field() - self.initialize_password_field() + self._initialize_username_field() + self._initialize_password_field() login_button = ttk.Button( - master=self.frame, + master=self._frame, text='Login', - command=self.login_handler + command=self._login_handler ) create_user_button = ttk.Button( - master=self.frame, + master=self._frame, text="Create user", - command=self.handle_show_create_user_view + command=self._handle_show_create_user_view ) - self.frame.grid_columnconfigure(0, weight=1, minsize=400) + self._frame.grid_columnconfigure(0, weight=1, minsize=400) login_button.grid(padx=5, pady=5, sticky=constants.EW) create_user_button.grid(padx=5, pady=5, sticky=constants.EW) - self.hide_error() - - def pack(self): - self.frame.pack(fill=constants.X) - - def destroy(self): - self.frame.destroy() + self._hide_error() diff --git a/src/ui/todos_view.py b/src/ui/todos_view.py index 2dbbece..c26a5aa 100644 --- a/src/ui/todos_view.py +++ b/src/ui/todos_view.py @@ -4,21 +4,27 @@ class TodoListView: def __init__(self, root, todos, handle_set_todo_done): - self.root = root - self.todos = todos - self.handle_set_todo_done = handle_set_todo_done - self.frame = None + self._root = root + self._todos = todos + self._handle_set_dodo_done = handle_set_todo_done + self._frame = None - self.initialize() + self._initialize() - def initialize_todo_item(self, todo): - item_frame = ttk.Frame(master=self.frame) + def pack(self): + self._frame.pack(fill=constants.X) + + def destroy(self): + self._frame.destroy() + + def _initialize_todo_item(self, todo): + item_frame = ttk.Frame(master=self._frame) label = ttk.Label(master=item_frame, text=todo.content) set_done_button = ttk.Button( master=item_frame, text='Done', - command=lambda: self.handle_set_todo_done(todo.id) + command=lambda: self._handle_set_dodo_done(todo.id) ) label.grid(row=0, column=0, padx=5, pady=5, sticky=constants.W) @@ -34,63 +40,63 @@ def initialize_todo_item(self, todo): item_frame.grid_columnconfigure(0, weight=1) item_frame.pack(fill=constants.X) - def initialize(self): - self.frame = ttk.Frame(master=self.root) + def _initialize(self): + self._frame = ttk.Frame(master=self._root) - for todo in self.todos: - self.initialize_todo_item(todo) - - def pack(self): - self.frame.pack(fill=constants.X) - - def destroy(self): - self.frame.destroy() + for todo in self._todos: + self._initialize_todo_item(todo) class TodosView: def __init__(self, root, handle_logout): - self.root = root - self.handle_logout = handle_logout - self.user = todo_service.get_current_user() - self.frame = None - self.create_todo_entry = None - self.todo_list_frame = None - self.todo_list_view = None + self._root = root + self._handle_logout = handle_logout + self._user = todo_service.get_current_user() + self._frame = None + self._create_todo_entry = None + self._todo_list_frame = None + self._todo_list_view = None - self.initialize() + self._initialize() - def logout_handler(self): + def pack(self): + self._frame.pack(fill=constants.X) + + def destroy(self): + self._frame.destroy() + + def _logout_handler(self): todo_service.logout() - self.handle_logout() + self._handle_logout() - def handle_set_todo_done(self, todo_id): + def _handle_set_todo_done(self, todo_id): todo_service.set_todo_done(todo_id) - self.initialize_todo_list() + self._initialize_todo_list() - def initialize_todo_list(self): - if self.todo_list_view: - self.todo_list_view.destroy() + def _initialize_todo_list(self): + if self._todo_list_view: + self._todo_list_view.destroy() todos = todo_service.get_undone_todos() - self.todo_list_view = TodoListView( - self.todo_list_frame, + self._todo_list_view = TodoListView( + self._todo_list_frame, todos, - self.handle_set_todo_done + self._handle_set_todo_done ) - self.todo_list_view.pack() + self._todo_list_view.pack() - def initialize_header(self): + def _initialize_header(self): user_label = ttk.Label( - master=self.frame, - text=f'Logged in as {self.user.username}' + master=self._frame, + text=f'Logged in as {self._user.username}' ) logout_button = ttk.Button( - master=self.frame, + master=self._frame, text='Logout', - command=self.logout_handler + command=self._logout_handler ) user_label.grid(row=0, column=0, padx=5, pady=5, sticky=constants.W) @@ -103,24 +109,24 @@ def initialize_header(self): sticky=constants.EW ) - def handle_create_todo(self): - todo_content = self.create_todo_entry.get() + def _handle_create_todo(self): + todo_content = self._create_todo_entry.get() if todo_content: todo_service.create_todo(todo_content) - self.initialize_todo_list() - self.create_todo_entry.delete(0, constants.END) + self._initialize_todo_list() + self._create_todo_entry.delete(0, constants.END) - def initialize_footer(self): - self.create_todo_entry = ttk.Entry(master=self.frame) + def _initialize_footer(self): + self._create_todo_entry = ttk.Entry(master=self._frame) create_todo_button = ttk.Button( - master=self.frame, + master=self._frame, text='Create', - command=self.handle_create_todo + command=self._handle_create_todo ) - self.create_todo_entry.grid( + self._create_todo_entry.grid( row=2, column=0, padx=5, @@ -136,26 +142,20 @@ def initialize_footer(self): sticky=constants.EW ) - def initialize(self): - self.frame = ttk.Frame(master=self.root) - self.todo_list_frame = ttk.Frame(master=self.frame) + def _initialize(self): + self._frame = ttk.Frame(master=self._root) + self._todo_list_frame = ttk.Frame(master=self._frame) - self.initialize_header() - self.initialize_todo_list() - self.initialize_footer() + self._initialize_header() + self._initialize_todo_list() + self._initialize_footer() - self.todo_list_frame.grid( + self._todo_list_frame.grid( row=1, column=0, columnspan=2, sticky=constants.EW ) - self.frame.grid_columnconfigure(0, weight=1, minsize=400) - self.frame.grid_columnconfigure(1, weight=0) - - def pack(self): - self.frame.pack(fill=constants.X) - - def destroy(self): - self.frame.destroy() + self._frame.grid_columnconfigure(0, weight=1, minsize=400) + self._frame.grid_columnconfigure(1, weight=0) diff --git a/src/ui/ui.py b/src/ui/ui.py index 0ff0d85..93f095e 100644 --- a/src/ui/ui.py +++ b/src/ui/ui.py @@ -5,43 +5,43 @@ class UI: def __init__(self, root): - self.root = root - self.current_view = None + self._root = root + self._current_view = None - def hide_current_view(self): - if self.current_view: - self.current_view.destroy() + def start(self): + self._show_login_view() + + def _hide_current_view(self): + if self._current_view: + self._current_view.destroy() - self.current_view = None + self._current_view = None - def show_login_view(self): - self.hide_current_view() + def _show_login_view(self): + self._hide_current_view() - self.current_view = LoginView( - self.root, - self.show_todos_view, - self.show_create_user_view + self._current_view = LoginView( + self._root, + self._show_todos_view, + self._show_create_user_view ) - self.current_view.pack() + self._current_view.pack() - def show_todos_view(self): - self.hide_current_view() + def _show_todos_view(self): + self._hide_current_view() - self.current_view = TodosView(self.root, self.show_login_view) + self._current_view = TodosView(self._root, self._show_login_view) - self.current_view.pack() + self._current_view.pack() - def show_create_user_view(self): - self.hide_current_view() + def _show_create_user_view(self): + self._hide_current_view() - self.current_view = CreateUserView( - self.root, - self.show_todos_view, - self.show_login_view + self._current_view = CreateUserView( + self._root, + self._show_todos_view, + self._show_login_view ) - self.current_view.pack() - - def start(self): - self.show_login_view() + self._current_view.pack()