Skip to content

Commit 052d2c8

Browse files
Merge pull request #228 from SocialChangeLab/dev
Fix keywords trend
2 parents 61f9cdc + ed339f5 commit 052d2c8

File tree

81 files changed

+5191
-10674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+5191
-10674
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
"installTools": true,
2424
"version": "3.10"
2525
},
26-
"ghcr.io/devcontainers-contrib/features/poetry:2": { },
27-
"ghcr.io/nikobockerman/devcontainer-features/poetry-persistent-cache:1": { },
2826
"ghcr.io/devcontainers-contrib/features/ruff:1": { },
2927
"ghcr.io/devcontainers-contrib/features/starship:1": { },
3028

.devcontainer/postCreateCommand.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ Rscript -e 'renv::restore(project = "/workspaces/media-impact-monitor/backend-R"
4848
####
4949

5050
echo 'eval "$(starship init bash)"' >> ~/.bashrc
51-
cd backend-python && poetry config virtualenvs.in-project true && poetry install # install everything once at setup
51+
cd backend-python && uv sync # install everything once at setup

.devcontainer/postStartCommand.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/bash
22
## postStartCommand.sh
33

4-
cd backend-python && source .venv/bin/activate && poetry install # install changed packages
4+
cd backend-python && source .venv/bin/activate && uv sync # install changed packages
55
# bash

.dockerignore

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Version control
2+
.git
3+
.gitignore
4+
.github
5+
.gitattributes
6+
7+
# Development environments
8+
.vscode
9+
.devcontainer
10+
.venv
11+
**/.venv
12+
**/__pycache__
13+
**/*.pyc
14+
**/*.pyo
15+
**/*.pyd
16+
.Python
17+
**/env/
18+
**/venv/
19+
**/ENV/
20+
**/env.bak/
21+
**/venv.bak/
22+
23+
# Build and cache directories
24+
cache/
25+
**/cache/
26+
.pytest_cache/
27+
**/.pytest_cache/
28+
.coverage
29+
htmlcov/
30+
.tox/
31+
.nox/
32+
dist/
33+
build/
34+
*.egg-info/
35+
36+
# Frontend
37+
frontend-nextjs/
38+
frontend-observable/
39+
**/node_modules/
40+
*.log
41+
42+
# Documentation and notebooks
43+
docs/
44+
notebooks/
45+
*.md
46+
!README.md
47+
48+
# System files
49+
.DS_Store
50+
**/.DS_Store
51+
.DS_Store?
52+
._*
53+
.Spotlight-V100
54+
.Trashes
55+
ehthumbs.db
56+
Thumbs.db
57+
58+
# Environment and secrets
59+
.env
60+
.env.*
61+
*.pem
62+
*.key
63+
64+
# IDE specific
65+
.idea/
66+
*.swp
67+
*.swo
68+
.vscode/
69+
*.sublime-workspace
70+
*.sublime-project
71+
72+
# Temporary files
73+
*.tmp
74+
*.temp
75+
*.bak
76+
*.swp
77+
*~
78+
79+
# Large data files
80+
*.csv
81+
*.json
82+
*.parquet
83+
*.db
84+
*.sqlite
85+
*.sqlite3
86+
87+
# Python specific
88+
**/.python-version
89+
**/.coverage
90+
**/.pytest_cache/
91+
**/.mypy_cache/
92+
**/.ruff_cache/
93+
**/.tox/
94+
**/.nox/
95+
**/.hypothesis/
96+
**/.ipynb_checkpoints/

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ ACLED_EMAIL=
33
ACLED_KEY=
44
# media data
55
MEDIACLOUD_API_TOKEN=
6-
ZENROWS_API_KEY=
76
# google trends data
87
DATAFORSEO_EMAIL=
98
DATAFORSEO_PASSWORD=

.github/workflows/deploy.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,23 @@ jobs:
4141
with:
4242
python-version: '3.10'
4343

44-
- name: Install Poetry
44+
- name: Install uv
4545
run: |
46-
pip install poetry
46+
pip install uv
4747
4848
- name: Install dependencies
4949
run: |
5050
cd backend-python
51-
poetry install
51+
uv sync
5252
5353
- name: Run pytest
5454
run: |
5555
cd backend-python
56-
poetry run pytest
56+
uv run --extra dev pytest
5757
env:
5858
MEDIACLOUD_API_TOKEN: ${{ secrets.MEDIACLOUD_API_TOKEN }}
5959
ACLED_EMAIL: ${{ secrets.ACLED_EMAIL }}
6060
ACLED_KEY: ${{ secrets.ACLED_KEY }}
61-
ZENROWS_API_KEY: ${{ secrets.ZENROWS_API_KEY }}
6261
AZURE_API_BASE: ${{ secrets.AZURE_API_BASE }}
6362
AZURE_API_VERSION: ${{ secrets.AZURE_API_VERSION }}
6463
AZURE_API_KEY: ${{ secrets.AZURE_API_KEY }}

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"media_impact_monitor.api:app",
2020
"--host=0.0.0.0",
2121
"--port=8000",
22-
"--reload",
23-
"--reload-dir=backend-python/media_impact_monitor"
22+
// "--reload",
23+
// "--reload-dir=backend-python/media_impact_monitor"
2424
],
2525
"jinja": true
2626
}

Dockerfile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
# build it: docker build -t socialchangelab/media-impact-monitor --build-arg VCS_REF=$(git rev-parse --short HEAD) --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') .
22
# run it: docker run -p 8000:8000 -e MEDIACLOUD_API_TOKEN="${MEDIACLOUD_API_TOKEN}" -e ACLED_EMAIL="${ACLED_EMAIL}" -e ACLED_KEY="${ACLED_KEY}" socialchangelab/media-impact-monitor
3-
FROM --platform=linux/amd64 python:3.10-slim
4-
# install poetry
5-
RUN pip install --upgrade pip
6-
RUN pip install poetry
7-
# copy the poetry files and install the dependencies
8-
COPY backend-python/poetry.lock backend-python/pyproject.toml backend-python/README.md /app/backend-python/
3+
FROM --platform=linux/amd64 ghcr.io/astral-sh/uv:python3.10-bookworm
4+
# copy the uv files and install the dependencies
5+
COPY backend-python/uv.lock backend-python/pyproject.toml backend-python/README.md /app/backend-python/
96
WORKDIR /app/backend-python
10-
RUN poetry config virtualenvs.create false \
11-
&& poetry install --no-interaction --no-ansi
7+
RUN uv sync
128
# copy the rest of the files and set the working directory
139
WORKDIR /app/
14-
COPY . /app/
10+
COPY backend-python/ /app/backend-python/
1511
WORKDIR /app/backend-python
1612
# set git commit and build date
1713
ARG VCS_REF
1814
ARG BUILD_DATE
1915
ENV VCS_REF=$VCS_REF
2016
ENV BUILD_DATE=$BUILD_DATE
2117
# run the application
22-
CMD ["uvicorn", "media_impact_monitor.api:app", "--host", "0.0.0.0", "--port", "8000"]
18+
CMD ["uv", "run", "uvicorn", "media_impact_monitor.api:app", "--host", "0.0.0.0", "--port", "8000"]
2319
# OCI Labels as per https://github.com/opencontainers/image-spec/blob/main/annotations.md
2420
LABEL org.opencontainers.image.title="media-impact-monitor"
2521
LABEL org.opencontainers.image.description="Media Impact Monitor"

backend-R/.Renviron

Lines changed: 0 additions & 1 deletion
This file was deleted.

backend-R/.Rprofile

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)