最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to install package in remote interpreter in Pycharm + Poetry? - Stack Overflow

matteradmin6PV0评论

I have a FastAPI + Celery + Pytest app with next structure:

Dockerfile:

FROM python:3.11 as normal

WORKDIR /portal-podrjadchika

ENV PYTHONUNBUFFERED=1

COPY poetry.lock pyproject.toml ./
COPY ./src .

RUN apt-get install -y --no-install-recommends gcc libc6-dev wget libpq-dev unzip && apt-get clean && pip install poetry==1.8.3

RUN poetry config virtualenvs.create false && poetry install

docker-compose.yaml:

version: '3.11'

services:
  build: &build
    build:
      context: .
    volumes:
      - ./src:/portal-podrjadchika
#      - ./poetry.lock:/portal-podrjadchika/poetry.lock
#      - ./pyproject.toml:/portal-podrjadchika/pyproject.toml

  fastapi-app:
    <<: *build
    env_file:
      - app.env
    command: bash -c "uvicorn main.app:fastapi_app --reload --host 0.0.0.0 --port 8000"
    ports:
      - "8000:8000"
    depends_on:
      - db

  celery:
    <<: *build
    env_file:
      - app.env
    command: bash -c "celery -A main.celery:celery_app worker"
    depends_on:
      - redis

  flower:
    <<: *build
    env_file:
      - app.env
    command: bash -c "celery -A main.celery:celery_app flower"
    depends_on:
      - celery
    ports:
      - "5555:5555"

  tests:
    <<: *build
    stdin_open: true
    env_file:
      - tests.env

  db:
    image: postgres:14.7-alpine
    volumes:
      - postgres_portal_podrjadchika_data:/var/lib/postgresql/data/
    environment:
      - POSTGRES_USER=portal_podrjadchika
      - POSTGRES_PASSWORD=portal_podrjadchika
      - POSTGRES_DB=portal-podrjadchika
    ports:
      - "5432:5432"

  redis:
    image: redis:7.4.1-alpine3.20
    restart: unless-stopped
    ports:
      - "6379:6379"

volumes:
  postgres_portal_podrjadchika_data:

services in Pycharm:

and remote interpreter:

For now I'm trying to figure out how to install packages? I mean there are remote interpreter for only fastapi-app and package should be installed in each container (celery, flower, fastapi-app and tests). Also pyproject.yaml and poetry.lock should be updated when package installed... How could I do that?

Post a comment

comment list (0)

  1. No comments so far