From 0ea3e88652b3872a365bc4e2edcd2db66ae304bb Mon Sep 17 00:00:00 2001 From: Enrico Bianchi Date: Fri, 7 Apr 2023 10:45:40 +0200 Subject: [PATCH 1/5] Removed old requirements.txt --- requirements-dev.txt | 2 -- requirements.txt | 0 2 files changed, 2 deletions(-) delete mode 100644 requirements-dev.txt delete mode 100644 requirements.txt diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index e1c44e2..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Further requirements file for testing safety. -pytest diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e69de29..0000000 From 78069e4c2e581a352833f93369083dc832278a1b Mon Sep 17 00:00:00 2001 From: Enrico Bianchi Date: Fri, 7 Apr 2023 10:45:59 +0200 Subject: [PATCH 2/5] Added pyproject.toml --- pyproject.toml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7b521d4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "python-cookiecutter" +version = "0.0.1" +description = "This is a Python Cookiecutter reposityr" +authors = [ + "A user " +] +readme = "README.md" +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] +[tool.poetry.dependencies] +python = "^3.11" + +[tool.poetry.group.test.dependencies] +tox = "^4.4.7" +pytest = "^7.2.2" From 3e7a40421286495302aeca2d6fe3f748ffa140b2 Mon Sep 17 00:00:00 2001 From: Enrico Bianchi Date: Fri, 7 Apr 2023 10:55:41 +0200 Subject: [PATCH 3/5] Updated tox.ini to use poetry --- tox.ini | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/tox.ini b/tox.ini index fc30279..4b4cff2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,16 @@ [tox] -envlist = py3, safety -skipsdist=True +envlist = + py3 + safety + +skipsdist = True [testenv] +description = run unit tests +usedevelop = True deps = - -rrequirements.txt - -rrequirements-dev.txt + pytest>=7 + pytest-sugar # Uncomment here to set an extra PIP_INDEX_URL # setenv = @@ -17,19 +22,25 @@ setenv = # To show pytest logs in console, use # tox -- --log-cli-level=DEBUG commands = - pytest {posargs} + pytest {posargs} +# Because safety need to work on requirements.txt, and tox doesn't permit to +# redirect output, we need to create a temporary file reporting all dependencies [testenv:safety] -deps = - -rrequirements.txt - -rrequirements-dev.txt - safety +deps = safety + +allowlist_externals = + poetry + safety + bash setenv = PYTHONPATH=:.: commands = - safety check --short-report -r requirements.txt + poetry export -f requirements.txt -o requirements.txt + safety check --short-report -r requirements.txt + bash -c "rm requirements.txt" [flake8] # Ignore long lines in flake8 because @@ -59,7 +70,7 @@ passenv = commands = # rm dist -rf - python setup.py bdist_wheel # sdist, or whatever + poetry build -f wheel # or sdist twine upload {posargs} dist/* From 9f426aff4cddf6611b5a4c8cba1e93a38707ed21 Mon Sep 17 00:00:00 2001 From: Enrico Bianchi Date: Fri, 7 Apr 2023 13:17:18 +0200 Subject: [PATCH 4/5] Extended README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 9d1e9b5..0420e48 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,17 @@ Please, see [CONTRIBUTING.md](CONTRIBUTING.md) for more details on: You can create new projects starting from this repository, so you can use a consistent CI and checks for different projects. +To enable the virtual environment, use this command: + +```bash +poetry install +``` + +To use the virtualenvironment, use this command: + +```bash +poetry shell +``` Besides all the explanations in the [CONTRIBUTING.md](CONTRIBUTING.md) file, you can use the docker-compose file (e.g. if you prefer to use docker instead of installing the tools locally) From 1a0e0307b8654b6fdce753c20feef012aef1ae93 Mon Sep 17 00:00:00 2001 From: Enrico Bianchi Date: Fri, 7 Apr 2023 13:22:03 +0200 Subject: [PATCH 5/5] Improved README --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0420e48..f4a84f7 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,21 @@ To enable the virtual environment, use this command: poetry install ``` -To use the virtualenvironment, use this command: +To use the virtual environment, use this command: ```bash poetry shell ``` +To add a dependency, use this command: + +```bash +poetry add +``` + +When install or add dependencies, file `poetry.lock` is created. This file is used to track all dependencies used +in the project, so is a good practice commit it in the repository. + Besides all the explanations in the [CONTRIBUTING.md](CONTRIBUTING.md) file, you can use the docker-compose file (e.g. if you prefer to use docker instead of installing the tools locally)