diff --git a/README.md b/README.md index 9d1e9b5..f4a84f7 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,26 @@ 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 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) 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" 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 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/*