commit 0e5d92208b19d4ffd2d44676b98ace699985f98a Author: Dmitry Afanasyev Date: Wed Jan 18 00:04:11 2023 +0300 initial commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2135ddf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,227 @@ +# Created by .ignore support plugin (hsz.mobi) +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Python template +# 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/ +pip-wheel-metadata/ +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/ + +# 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 +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.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 + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__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/ + +### VirtualEnv template +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +.Python +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +pyvenv.cfg +.venv +pip-selfcheck.json + +.idea +.gitignore +.git +.dockerignore + +docker/data +config.yaml +frontend +helm +.gitlab-ci.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0f451c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,226 @@ +#### joe made this: http://goel.io/joe +#### macos #### +# General +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk +#### linux #### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* +#### windows #### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk +#### 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/ +*.egg-info/ +.installed.cfg +*.egg + +# 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/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +.python-version + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# files for cli (one-time script) commands +files/ + +#### jetbrains #### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.vscode +.idea/ +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +config.local.yaml +local.yaml + +# Ignore dynaconf secret files +.secrets.* + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b94a11f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +FROM python:3.11.1 + +ARG POETRY_VERSION=1.3.1 +ARG USER + +# python: +ENV PYTHONFAULTHANDLER=1 \ + PYTHONUNBUFFERED=1 \ + PYTHONHASHSEED=random \ + PYTHONDONTWRITEBYTECODE=1 \ + # pip: + PIP_NO_CACHE_DIR=off \ + PIP_DISABLE_PIP_VERSION_CHECK=on \ + PIP_DEFAULT_TIMEOUT=100 \ + # poetry: + POETRY_VERSION=${POETRY_VERSION} \ + POETRY_NO_INTERACTION=1 \ + POETRY_VIRTUALENVS_CREATE=false \ + POETRY_CACHE_DIR='/var/cache/pypoetry' \ + PATH="$PATH:/root/.poetry/bin" + +RUN apt update \ + && apt-get update \ + && apt-get install --no-install-recommends -y \ + bash \ + build-essential \ + curl \ + gettext \ + git \ + libpq-dev \ + nano \ + && export TERM=xterm \ + # Installing `poetry` package manager: +# # https://github.com/python-poetry/poetry +# && curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - + && pip install --upgrade pip \ + && pip install poetry + + +RUN groupadd ${USER} && useradd -g ${USER} ${USER} + +RUN mkdir /code /poetry +RUN chown -R ${USER}:${USER} /code /poetry + +COPY --chown=${USER}:${USER} ./poetry/pyproject.toml /code/ + +WORKDIR /code + +RUN export PATH="/root/.local/bin:$PATH" \ + && poetry --version \ + && poetry lock \ + && poetry export -f requirements.txt --without-hashes --output requirements.txt + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..10499cb --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Poetry main package + +Used for poetry packages management with docker + +required `docker` and `docker-compose` + + +## Poetry lock for any version + +- copy `pyproject.toml` file to poetry dir +- set `python` version the same as in `pyproject.toml` and set `poetry` versions in Dockerfile + +run + +```bash +docker-compose up --build +``` + +script will generate `poetry.lock` and `requirements.txt` files \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7a5613b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.9' + +services: + python: + image: "poetry-python:latest" + container_name: 'poetry-python' + build: + context: . + dockerfile: Dockerfile + args: + - USER=${USER} + volumes: + - ./poetry/:/poetry/ + command: > + bash -c " + cp /code/* /poetry -r + && sleep 2 + && chown ${USER}:$USER -R /poetry + " \ No newline at end of file diff --git a/poetry/pyproject.toml b/poetry/pyproject.toml new file mode 100644 index 0000000..a3763d2 --- /dev/null +++ b/poetry/pyproject.toml @@ -0,0 +1,64 @@ +[tool.poetry] +name = "create requirements" +version = "1.0.2" +description = "poetry requiremts creation" +authors = ["Dmitry Afanasyev "] + +[tool.poetry.dependencies] +Python="3.11.1" +aiohttp = "*" +aiosignal = "*" +alembic = "*" +bcrypt = "*" +click = "*" +cookiecutter = "*" +coverage = "*" +decorator = "*" +Django = "*" +factory-boy = "*" +Faker = "*" +fastapi = "*" +httpx = "*" +identify = "*" +Jinja2 = "*" +keyring = "*" +loguru = "*" +MouseInfo = "*" +numpy = "*" +orjson = "*" +Pillow = "*" +pre-commit = "*" +prompt-toolkit = "*" +psycopg2-binary = "*" +PyAutoGUI = "*" +pydantic = "*" +Pygments = "*" +PyQt6 = "*" +python-decouple = "*" +pytz = "*" +PyYAML = "*" +requests = "*" +selenium = "*" +simple-term-menu = "*" +six = "*" +SQLAlchemy = "*" +starlette = "*" +termcolor = "*" +uvicorn = "*" +validators = "*" +virtualenv = "*" +wget = "*" +zipp = "*" + +[tool.poetry.dev-dependencies] +black = "*" +flake8 = "*" +ipython = "*" +mypy = "*" +pytest = "*" +pytest-cov = "*" + + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a3763d2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,64 @@ +[tool.poetry] +name = "create requirements" +version = "1.0.2" +description = "poetry requiremts creation" +authors = ["Dmitry Afanasyev "] + +[tool.poetry.dependencies] +Python="3.11.1" +aiohttp = "*" +aiosignal = "*" +alembic = "*" +bcrypt = "*" +click = "*" +cookiecutter = "*" +coverage = "*" +decorator = "*" +Django = "*" +factory-boy = "*" +Faker = "*" +fastapi = "*" +httpx = "*" +identify = "*" +Jinja2 = "*" +keyring = "*" +loguru = "*" +MouseInfo = "*" +numpy = "*" +orjson = "*" +Pillow = "*" +pre-commit = "*" +prompt-toolkit = "*" +psycopg2-binary = "*" +PyAutoGUI = "*" +pydantic = "*" +Pygments = "*" +PyQt6 = "*" +python-decouple = "*" +pytz = "*" +PyYAML = "*" +requests = "*" +selenium = "*" +simple-term-menu = "*" +six = "*" +SQLAlchemy = "*" +starlette = "*" +termcolor = "*" +uvicorn = "*" +validators = "*" +virtualenv = "*" +wget = "*" +zipp = "*" + +[tool.poetry.dev-dependencies] +black = "*" +flake8 = "*" +ipython = "*" +mypy = "*" +pytest = "*" +pytest-cov = "*" + + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api"