Skip to content

Commit

Permalink
Merge pull request #103 from bomzheg/tech/setuptools
Browse files Browse the repository at this point in the history
setuptools
  • Loading branch information
bomzheg authored Jul 29, 2024
2 parents 127593c + a17460e commit fe4e786
Show file tree
Hide file tree
Showing 8 changed files with 343 additions and 4,296 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,51 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install uv
run: pipx install uv
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: "poetry"
cache-dependency-path: poetry.lock
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: poetry install --with test
run: uv venv && uv pip install -e .[test]
lint:
needs: build
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install uv
run: pipx install uv
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: "poetry"
cache-dependency-path: poetry.lock
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: uv venv && uv pip install -e .[test]
- name: black (ruff format)
run: poetry run ruff format --check .
run: source .venv/bin/activate && ruff format --check .
- name: ruff
run: poetry run ruff check .
run: source .venv/bin/activate && ruff check .
- name: mypy
run: poetry run mypy .
run: source .venv/bin/activate && mypy .
test:
needs: build
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install uv
run: pipx install uv
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: "poetry"
cache-dependency-path: poetry.lock
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: uv venv && uv pip install .[test]
- name: Test with pytest
run: poetry run pytest
run: source .venv/bin/activate && pytest
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM python:3.11-buster as builder
FROM python:3.11-buster AS builder
ENV VIRTUAL_ENV=/opt/venv
ENV CODE_PATH=/code
RUN pip3 install --no-cache-dir poetry==1.4.2
RUN python3 -m venv $VIRTUAL_ENV
WORKDIR $CODE_PATH
COPY poetry.lock pyproject.toml ${CODE_PATH}/
RUN python3 -m poetry export -f requirements.txt | $VIRTUAL_ENV/bin/pip install -r /dev/stdin
COPY lock.txt ${CODE_PATH}/
RUN $VIRTUAL_ENV/bin/pip install -r lock.txt

FROM python:3.11-slim-buster
LABEL maintainer="bomzheg <[email protected]>" \
Expand All @@ -19,4 +18,4 @@ COPY --from=builder $VIRTUAL_ENV $VIRTUAL_ENV
COPY . ${CODE_PATH}/shvatka
WORKDIR $CODE_PATH/shvatka
RUN echo "{\"vcs_hash\": \"${VCS_SHA}\", \"build_at\": \"${BUILD_AT}\" }" > version.yaml
ENTRYPOINT ["python3", "-m", "shvatka.tgbot"]
ENTRYPOINT ["python3", "-m", "shvatka"]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Core-функционал:
4. Запустить и применить миграции `python -m alembic upgrade head`
5.
```shell
poetry build
pip install ./dist/shvatka-0.1.0-py3-none-any.whl
uv pip install .
export BOT_PATH=$PWD
shvatka-tgbot
```
Expand Down
239 changes: 239 additions & 0 deletions lock.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml
aiofiles==23.2.1
# via aiogram
aiogram==3.5.0
# via
# shvatka (pyproject.toml)
# aiogram-dialog
aiogram-dialog==2.0.0
# via shvatka (pyproject.toml)
aiohttp==3.9.5
# via aiogram
aiosignal==1.3.1
# via aiohttp
alembic==1.13.2
# via shvatka (pyproject.toml)
annotated-types==0.7.0
# via pydantic
anyio==4.4.0
# via
# httpx
# starlette
apscheduler==3.10.4
# via shvatka (pyproject.toml)
asgi-monitor==0.3.0
# via shvatka (pyproject.toml)
asgiref==3.8.1
# via opentelemetry-instrumentation-asgi
async-timeout==4.0.3
# via asyncpg
asyncpg==0.29.0
# via shvatka (pyproject.toml)
attrs==23.2.0
# via aiohttp
bcrypt==4.0.1
# via shvatka (pyproject.toml)
cachetools==5.4.0
# via aiogram-dialog
certifi==2024.7.4
# via
# aiogram
# httpcore
# httpx
# requests
cffi==1.16.0
# via cryptography
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# asgi-monitor
# uvicorn
colorlog==6.8.2
# via shvatka (pyproject.toml)
contourpy==1.2.1
# via matplotlib
cryptography==43.0.0
# via python-jose
cycler==0.12.1
# via matplotlib
dataclass-factory==2.16
# via shvatka (pyproject.toml)
deprecated==1.2.14
# via
# opentelemetry-api
# opentelemetry-semantic-conventions
dishka==1.0.0
# via shvatka (pyproject.toml)
ecdsa==0.19.0
# via python-jose
et-xmlfile==1.1.0
# via openpyxl
fastapi==0.100.1
# via shvatka (pyproject.toml)
fonttools==4.53.1
# via matplotlib
frozenlist==1.4.1
# via
# aiohttp
# aiosignal
greenlet==2.0.2
# via
# shvatka (pyproject.toml)
# sqlalchemy
h11==0.14.0
# via
# httpcore
# uvicorn
httpcore==1.0.5
# via httpx
httpx==0.27.0
# via telegraph
idna==3.7
# via
# anyio
# httpx
# requests
# yarl
importlib-metadata==8.0.0
# via opentelemetry-api
jinja2==3.1.4
# via aiogram-dialog
kiwisolver==1.4.5
# via matplotlib
lxml==4.9.4
# via shvatka (pyproject.toml)
magic-filter==1.0.12
# via
# aiogram
# aiogram-dialog
mako==1.3.5
# via alembic
markupsafe==2.1.5
# via
# jinja2
# mako
matplotlib==3.9.1
# via shvatka (pyproject.toml)
multidict==6.0.5
# via
# aiohttp
# yarl
numpy==2.0.1
# via
# contourpy
# matplotlib
openpyxl==3.1.5
# via shvatka (pyproject.toml)
opentelemetry-api==1.26.0
# via
# opentelemetry-instrumentation
# opentelemetry-instrumentation-asgi
# opentelemetry-sdk
# opentelemetry-semantic-conventions
opentelemetry-instrumentation==0.47b0
# via opentelemetry-instrumentation-asgi
opentelemetry-instrumentation-asgi==0.47b0
# via asgi-monitor
opentelemetry-sdk==1.26.0
# via asgi-monitor
opentelemetry-semantic-conventions==0.47b0
# via
# opentelemetry-instrumentation-asgi
# opentelemetry-sdk
opentelemetry-util-http==0.47b0
# via opentelemetry-instrumentation-asgi
packaging==24.1
# via matplotlib
passlib==1.7.4
# via shvatka (pyproject.toml)
pillow==10.4.0
# via matplotlib
prometheus-client==0.20.0
# via asgi-monitor
pyaes==1.6.1
# via pyrogram
pyasn1==0.6.0
# via
# python-jose
# rsa
pycparser==2.22
# via cffi
pydantic==2.7.4
# via
# shvatka (pyproject.toml)
# aiogram
# fastapi
pydantic-core==2.18.4
# via pydantic
pyparsing==3.1.2
# via matplotlib
pyrogram==2.0.106
# via shvatka (pyproject.toml)
pysocks==1.7.1
# via pyrogram
python-dateutil==2.9.0.post0
# via
# shvatka (pyproject.toml)
# matplotlib
python-jose==3.3.0
# via shvatka (pyproject.toml)
python-multipart==0.0.9
# via shvatka (pyproject.toml)
pytz==2024.1
# via apscheduler
pyyaml==6.0.1
# via shvatka (pyproject.toml)
redis==5.0.7
# via shvatka (pyproject.toml)
requests==2.32.3
# via telegraph
rsa==4.9
# via python-jose
setuptools==72.1.0
# via opentelemetry-instrumentation
six==1.16.0
# via
# apscheduler
# ecdsa
# python-dateutil
sniffio==1.3.1
# via
# anyio
# httpx
sqlalchemy==2.0.31
# via
# shvatka (pyproject.toml)
# alembic
starlette==0.27.0
# via fastapi
structlog==24.4.0
# via asgi-monitor
telegraph==2.2.0
# via shvatka (pyproject.toml)
typing-extensions==4.12.2
# via
# aiogram
# alembic
# fastapi
# opentelemetry-sdk
# pydantic
# pydantic-core
# sqlalchemy
tzlocal==5.2
# via apscheduler
ujson==5.10.0
# via shvatka (pyproject.toml)
urllib3==2.2.2
# via requests
uvicorn==0.20.0
# via shvatka (pyproject.toml)
wrapt==1.16.0
# via
# deprecated
# opentelemetry-instrumentation
yarl==1.9.4
# via aiohttp
zipp==3.19.2
# via importlib-metadata
Loading

0 comments on commit fe4e786

Please sign in to comment.