From 220f2fa646db0c1c24b84d254633328b88457444 Mon Sep 17 00:00:00 2001 From: Anton Kasimov Date: Sat, 9 Dec 2023 03:11:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A8=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=20cookiecu?= =?UTF-8?q?tter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cookiecutter/cookiecutter.json | 16 ++ .../.editorconfig | 20 +++ .../.gitignore | 164 ++++++++++++++++++ .../CHANGELOG.md | 10 ++ .../{{ cookiecutter.project_name }}/Makefile | 28 +++ .../{{ cookiecutter.project_name }}/README.md | 3 + .../pyproject.toml | 57 ++++++ .../{{ cookiecutter.project_name }}/setup.cfg | 9 + 8 files changed, 307 insertions(+) create mode 100644 cookiecutter/cookiecutter.json create mode 100644 cookiecutter/{{ cookiecutter.project_name }}/.editorconfig create mode 100644 cookiecutter/{{ cookiecutter.project_name }}/.gitignore create mode 100644 cookiecutter/{{ cookiecutter.project_name }}/CHANGELOG.md create mode 100644 cookiecutter/{{ cookiecutter.project_name }}/Makefile create mode 100644 cookiecutter/{{ cookiecutter.project_name }}/README.md create mode 100644 cookiecutter/{{ cookiecutter.project_name }}/pyproject.toml create mode 100644 cookiecutter/{{ cookiecutter.project_name }}/setup.cfg diff --git a/cookiecutter/cookiecutter.json b/cookiecutter/cookiecutter.json new file mode 100644 index 0000000..4b32200 --- /dev/null +++ b/cookiecutter/cookiecutter.json @@ -0,0 +1,16 @@ +{ + "project_name": "My New Project", + "project_slug": "{{ cookiecutter.project_name|lower|replace(' ', '-') }}", + "pkg_name": "{{ cookiecutter.project_slug|replace('-', '') }}", + "description": "Project description", + "author_name": "John Doe", + "author_email": "doe@example.net", + "__prompts__": { + "package_name": "Select your project name", + "project_slug": "Project directory", + "pkg_name": "Python package name", + "description": "Short description", + "author_name": "Author full name", + "author_email": "Author email" + } +} diff --git a/cookiecutter/{{ cookiecutter.project_name }}/.editorconfig b/cookiecutter/{{ cookiecutter.project_name }}/.editorconfig new file mode 100644 index 0000000..c5d6e6c --- /dev/null +++ b/cookiecutter/{{ cookiecutter.project_name }}/.editorconfig @@ -0,0 +1,20 @@ +# top-most EditorConfig file +root = true + +[*] +# Unix-style newlines with a newline ending every file +end_of_line = lf +insert_final_newline = True +indent_style = space +indent_size = 2 +charset = utf-8 + +# Whitespace at the end of lines +trim_trailing_whitespace = True + +[*.py] +indent_size = 4 + +# Tab indentation (no size specified) +[Makefile] +indent_style = tab diff --git a/cookiecutter/{{ cookiecutter.project_name }}/.gitignore b/cookiecutter/{{ cookiecutter.project_name }}/.gitignore new file mode 100644 index 0000000..a4c01b7 --- /dev/null +++ b/cookiecutter/{{ cookiecutter.project_name }}/.gitignore @@ -0,0 +1,164 @@ +# ---> Python +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + + +/tags diff --git a/cookiecutter/{{ cookiecutter.project_name }}/CHANGELOG.md b/cookiecutter/{{ cookiecutter.project_name }}/CHANGELOG.md new file mode 100644 index 0000000..19201d6 --- /dev/null +++ b/cookiecutter/{{ cookiecutter.project_name }}/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.0.1] +Project initialization diff --git a/cookiecutter/{{ cookiecutter.project_name }}/Makefile b/cookiecutter/{{ cookiecutter.project_name }}/Makefile new file mode 100644 index 0000000..bbfd338 --- /dev/null +++ b/cookiecutter/{{ cookiecutter.project_name }}/Makefile @@ -0,0 +1,28 @@ +WATCH_COMMAND=poetry run uvicorn --reload --host=::1 {{cookiecutter.pkg_name}}.application:app +SERVER_COMMAND=poetry run uvicorn --host=::1 {{cookiecutter.pkg_name}}.application:app +VERSION != poetry version | tr ' ' - + + +watch: + ${WATCH_COMMAND} + +test: + poetry run pytest -x -n auto --dist loadscope + +retest: + poetry run pytest -lx --ff -n auto + +cov: + poetry run pytest --cov=cpms + +server: + ${SERVER_COMMAND} + +update: + poetry update + +build: + poetry build -f wheel + +wheels: build + poetry run pip wheel -w dist dist/${VERSION}-*.whl diff --git a/cookiecutter/{{ cookiecutter.project_name }}/README.md b/cookiecutter/{{ cookiecutter.project_name }}/README.md new file mode 100644 index 0000000..3096c61 --- /dev/null +++ b/cookiecutter/{{ cookiecutter.project_name }}/README.md @@ -0,0 +1,3 @@ +# {{cookiecutter.project_name}} + +{{cookiecutter.description}} diff --git a/cookiecutter/{{ cookiecutter.project_name }}/pyproject.toml b/cookiecutter/{{ cookiecutter.project_name }}/pyproject.toml new file mode 100644 index 0000000..dad67fb --- /dev/null +++ b/cookiecutter/{{ cookiecutter.project_name }}/pyproject.toml @@ -0,0 +1,57 @@ +[tool.poetry] +name = "{{cookiecutter.pkg_name}}" +version = "0.0.1" +description = "{{cookiecutter.description}}" +authors = ["{{cookiecutter.author_name}} <{{cookiecutter.author_email}}>", "Radium, LLC"] +license = "ISC" + +[tool.poetry.dependencies] +python = "^3.10" +starlette = "^0.33.0" +uvicorn = {extras = ["standard"], version = "^0.24.0.post1"} +sentry-sdk = "^1.5.0" +pydantic = "^2.5.2" +httpx = "^0.25.0" +asyncpg = "^0.29.0" +starlette-htmx = "^0.1.1" + +[tool.poetry.group.test.dependencies] +pytest = "^7.4.3" +pytest-cov = "^4.1.0" +pytest-sugar = "^0.9.7" +pytest-xdist = {extras = ["psutil"], version = "^3.5.0"} +pytest-mock = "^3.6.1" +pytest-snapshot = "^0.9.0" +pytest-httpx = "^0.27.0" +Faker = "^20.1.0" +asgi-lifespan = "^2.1.0" + +[tool.poetry.group.dev.dependencies] +wemake-python-styleguide = "^0.18.0" +flake8-pytest-style = "^1.7.2" +flake8-SQL = "^0.4.1" +flake8-annotations = "^3.0.1" +flake8-logging-format = "^0.9.0" +flake8-spellcheck = "^0.28.0" +isort = "^5.7.0" + + +[build-system] +requires = ["poetry>=0.12"] +build-cpms = "poetry.masonry.api" + +[tool.nitpick] +style = "https://gitea.radium.group/radium/project-configuration/raw/branch/master/nitpick/all.toml" + +[tool.pytest.ini_options] +testpaths = [ + "tests", +] +python_files = "test*.py" +addopts = "-rsxX -l --tb=short --strict-markers --doctest-modules" +xfail_strict = "true" + +[tool.isort] +multi_line_output = 3 +include_trailing_comma = true +use_parentheses = true diff --git a/cookiecutter/{{ cookiecutter.project_name }}/setup.cfg b/cookiecutter/{{ cookiecutter.project_name }}/setup.cfg new file mode 100644 index 0000000..9ecb9d9 --- /dev/null +++ b/cookiecutter/{{ cookiecutter.project_name }}/setup.cfg @@ -0,0 +1,9 @@ +[flake8] +per-file-ignores = tests/**.py: S101, D103, ANN201 +spellcheck-targets=comments +sql-excepted-names=EXISTS +ignore = F841,W504 +nested-classes-whitelist=Meta,Params,Config + +[darglint] +strictness = long