Skip to content

Commit

Permalink
Merge pull request #20 from ZeroGachis/task/use-poetry
Browse files Browse the repository at this point in the history
Use poetry as the package manager
  • Loading branch information
ducdetronquito authored Jan 4, 2024
2 parents 8465215 + 881b3f2 commit fbf9a54
Show file tree
Hide file tree
Showing 9 changed files with 333 additions and 30 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv/
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
*.pyc
__pycache__

# Poetry virtualenv
.venv/

# Demo artifacts
demo/

# Docker dev env
docker-compose.override.yml

# Jetbrains IDEs
.idea/
.idea/
27 changes: 24 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,33 @@ FROM python:3.10-slim-bullseye

RUN apt update && apt install -y git

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache \
POETRY_VENV=/opt/poetry \
POETRY_VERSION=1.7.1 \
APP_DIR=/home/src/magicparse

RUN pip install pytest
# Add poetry to PATH
ENV PATH="${PATH}:${POETRY_VENV}/bin"

WORKDIR /home/src/magicparse
RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install -U pip setuptools \
&& $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION}

WORKDIR $APP_DIR

# Activate the app virtualenv
ENV APP_VENV="$APP_DIR/.venv"
ENV PATH="$APP_VENV/bin:$PATH"
RUN python3 -m venv $APP_VENV

COPY pyproject.toml poetry.lock ./

RUN poetry install --no-root

COPY . ./
RUN pip install -e .[dev]

RUN poetry install

CMD ["bash"]
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ services:
working_dir: /home/src/magicparse
volumes:
- .:/home/src/magicparse
- /home/src/magicparse/.venv/
275 changes: 275 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tool.poetry]
name = "magicparse"
version = "0.10.1"
description = "Declarative parser 🛸"
authors = ["Smartway <[email protected]>"]
readme = "README.md"
repository = "https://github.com/ZeroGachis/magicparse"

[tool.poetry.dependencies]
python = "^3.9"
flake8-pyproject = "~1.2.3"

[tool.poetry.group.dev.dependencies]
black = "^23.12.1"
flake8 = "^6.1.0"
pytest = "^7.4.4"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.flake8]
max-line-length = 88
extend-ignore = ["E203", "E722"]
exclude = [".git/", ".pytest_cache/", ".venv"]

[tool.pytest.ini_options]
python_files = ["tests/*"]
21 changes: 0 additions & 21 deletions setup.py

This file was deleted.

Loading

0 comments on commit fbf9a54

Please sign in to comment.