Skip to content

Commit

Permalink
Merge pull request #20 from bento-platform/chore/poetry-reconfig
Browse files Browse the repository at this point in the history
chore: update dependencies/images & reconfigure Poetry
  • Loading branch information
davidlougheed authored Jul 17, 2023
2 parents 261fd2d + 0b06f3f commit 959aa18
Show file tree
Hide file tree
Showing 19 changed files with 760 additions and 808 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
- name: Install dependencies
run: poetry install
- name: Test
run: pytest -svv --cov=bento_notification_service --cov-branch
- name: Codecov
run: codecov
run: poetry run pytest -svv --cov=bento_notification_service --cov-branch
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ db.sqlite3
htmlcov/

# IDE stuff
.idea/workspace.xml
.idea/dataSources*
.idea/*
*.swp
*.swo

Expand Down
4 changes: 0 additions & 4 deletions .idea/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/chord_notification_service.iml

This file was deleted.

11 changes: 0 additions & 11 deletions .idea/dataSources.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/dictionaries/dlougheed.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/sqldialects.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2023.02.27
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2023.05.12

# Run as root in the Dockerfile until we drop down to the service user in the entrypoint
USER root
Expand All @@ -15,13 +15,13 @@ WORKDIR /notification
RUN mkdir -p /notification/data

COPY pyproject.toml .
COPY poetry.toml .
COPY poetry.lock .

# Install production dependencies
# Without --no-root, we get errors related to the code not being copied in yet.
# But we don't want the code here, otherwise Docker cache doesn't work well.
RUN poetry install --without dev --no-root
RUN poetry config virtualenvs.create false && \
poetry install --without dev --no-root

# Manually copy only what's relevant
# (Don't use .dockerignore, which allows us to have development containers too)
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@ installed using the following command:
poetry install
```

Afterwards we need to set up the DB:
Afterward, we need to set up the DB:

```bash
flask db upgrade
poetry run flask db upgrade
```

To create migrations, make sure your database is on the latest migration. Then, do the following:

```bash
flask db migrate -m "Some message here"
poetry run flask db migrate -m "Some message here"
```


## Testing

To test locally, run:

```bash
poetry run tox
```
7 changes: 3 additions & 4 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2023.02.27
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2023.05.12

SHELL ["/bin/bash", "-c"]

Expand All @@ -8,7 +8,6 @@ USER root
RUN apt-get update -y && \
apt-get install -y libpq-dev python-dev && \
rm -rf /var/lib/apt/lists/* && \
source /env/bin/activate && \
pip install --no-cache-dir gunicorn==20.1.0

WORKDIR /notification
Expand All @@ -17,15 +16,15 @@ WORKDIR /notification
RUN mkdir -p /notification/data

COPY pyproject.toml .
COPY poetry.toml .
COPY poetry.lock .
COPY entrypoint.bash .
COPY run.dev.bash .

# Install production + development dependencies
# Without --no-root, we get errors related to the code not being copied in yet.
# But we don't want the code here, otherwise Docker cache doesn't work well.
RUN source /env/bin/activate && poetry install --no-root
RUN poetry config virtualenvs.create false && \
poetry install --no-root

# Don't include actual code in the development image - will be mounted in using a volume.

Expand Down
Loading

0 comments on commit 959aa18

Please sign in to comment.