-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: Improve typing, pre-commit, updates openfoodfacts package (#198)
- Loading branch information
1 parent
21c2793
commit ff03b0c
Showing
33 changed files
with
581 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,4 @@ POSTGRES_PORT=5432 | |
|
||
POSTGRES_EXPOSE=127.0.0.1:5432 | ||
|
||
ENVIRONMENT=net | ||
ENVIRONMENT=net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish-docs: | ||
runs-on: ubuntu-20.04 | ||
|
@@ -23,32 +23,32 @@ | |
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python version | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
|
||
- name: Generate documentation | ||
run: bash ./build_mkdocs.sh | ||
|
||
# Deploy docs to gh_pages if we are pushing to main | ||
# Example from https://github.com/marketplace/actions/deploy-to-github-pages | ||
- name: Deploy 🚀 | ||
|
@@ -61,4 +61,3 @@ | |
BRANCH: gh-pages # The branch the action should deploy to. | ||
FOLDER: gh_pages # The folder the action should deploy. | ||
CLEAN: true # Automatically remove deleted files from the deploy branch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,5 @@ jobs: | |
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
python-version: '3.11' | ||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,4 +141,4 @@ dmypy.json | |
|
||
static/app | ||
static/img/*/* | ||
gh_pages | ||
gh_pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import typer | ||
|
||
app = typer.Typer() | ||
typer_app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
@typer_app.command() | ||
def import_product_db(batch_size: int = 1000) -> None: | ||
"""Import from DB JSONL dump to insert/update product table.""" | ||
from app.db import session | ||
from app.tasks import import_product_db | ||
from app.utils import get_logger | ||
from app.utils import get_logger # type: ignore | ||
|
||
get_logger() | ||
db = session() | ||
import_product_db(db, batch_size=batch_size) | ||
|
||
|
||
@app.command() | ||
@typer_app.command() | ||
def run_scheduler() -> None: | ||
"""Launch the scheduler.""" | ||
from app import scheduler | ||
from app.utils import get_logger | ||
from app.utils import get_logger # type: ignore | ||
|
||
get_logger() | ||
scheduler.run() | ||
|
||
|
||
def main() -> None: | ||
app() | ||
typer_app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.