Skip to content

Commit

Permalink
Update for python 3.12 compatibility (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarojasm95 authored Jan 8, 2024
1 parent 5378152 commit a8b45d8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 81 deletions.
43 changes: 17 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,27 @@ RUN apt-get update \
g++ \
make \
libc6-dev \
curl \
&& rm -rf /var/lib/apt/lists/*

# Upgrade pip
RUN pip install --upgrade pip

# Configure pip
COPY pip.conf /etc/pip.conf

# Install poetry
ARG POETRY_VERSION=1.0.5
ADD https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py /tmp/get-poetry.py
RUN python /tmp/get-poetry.py --version $POETRY_VERSION
ARG POETRY_VERSION=1.7.1
ENV PATH /root/.local/bin:$PATH
RUN curl -sSL https://install.python-poetry.org -o install-poetry.py && \
python install-poetry.py --version $POETRY_VERSION
ENV POETRY_VIRTUALENVS_CREATE="false"

ENV PATH /venv/bin:$PATH
ENV VIRTUAL_ENV=/venv

# Configure poetry
COPY poetry.toml /root/.config/pypoetry/config.toml
RUN python -m venv /venv && \
pip install --upgrade pip

# Install our python package and dependencies
WORKDIR /build
COPY pyproject.toml poetry.lock README.md ./
RUN . /root/.poetry/env \
&& poetry install --no-root
RUN poetry install --no-root
COPY commands_base commands_base
RUN pip install .
RUN poetry install && pip3 install .
### END BUILDER IMAGE ##################################################################


Expand All @@ -54,20 +52,13 @@ RUN pip install .
FROM python:3.8-slim
LABEL maintainer="dev@fivestars.com"

# Configure pip
COPY --from=builder /etc/pip.conf /etc/pip.conf

# Copy installed python packages from build image
COPY --from=builder /root/.poetry /root/.poetry

# Configure poetry
COPY --from=builder /root/.config/pypoetry /root/.config/pypoetry

# Add poetry directories to PATH
ENV PATH /root/.local/bin:/root/.poetry/bin:$PATH
ENV PATH /root/.local/bin:/venv/bin:$PATH

# Copy installed packages from build image
# Copy installed python packages from build image
COPY --from=builder /root/.local /root/.local
# Copy installed packages from build image
COPY --from=builder /venv /venv

# Create the /code directory for derived images to populate and add it to sys.path
WORKDIR /code
Expand Down
4 changes: 2 additions & 2 deletions commands_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ def main(project_name: str):
def gather_commands(subparsers: argparse.Action, commands_directory: str):
"""Search for available commands and gather their arguments."""
for finder, command_name, _ in pkgutil.iter_modules([commands_directory]):
loader = finder.find_module(command_name)
command_module = loader.load_module()
spec = finder.find_spec(command_name)
command_module = spec.loader.load_module()
command_module.parse_args(subparsers)
62 changes: 22 additions & 40 deletions poetry.lock

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

8 changes: 0 additions & 8 deletions poetry.toml

This file was deleted.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[tool.poetry]
name = "commands-base"
version = "2.1.0"
version = "2.2.0"
description = "Aladdin base command for commands containers"
authors = ["Fivestars <dev@fivestars.com>"]

[tool.poetry.dependencies]
python = "^3.6"
python = "^3.8"
verboselogs = "^1.7"
coloredlogs = "^14.0"
coloredlogs = "^15.0.1"

[tool.poetry.dev-dependencies]

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

[tool.poetry.scripts]
aladdin_command = "commands_base:cli"

0 comments on commit a8b45d8

Please sign in to comment.