Skip to content

Commit

Permalink
Add pydantic, transformers, and typer to dependencies (#6)
Browse files Browse the repository at this point in the history
* Add pydantic, transformers, and typer to dependencies

* Add caching mechanism in worfklow

* Add different caching mechanism

* Upgrade actions/cache to v3

* Add repository to pyproject.toml

* Fix build issues

Namely:
- fix poetry commands in workflow script (add --local)
- add `poetry run` in front of commands in Makefile.

* Fix typo in poetry.toml

* Revert "Fix typo in poetry.toml"

This reverts commit ad4e6fb.
  • Loading branch information
valentincalomme authored Jan 16, 2024
1 parent 691b68d commit e744c52
Show file tree
Hide file tree
Showing 5 changed files with 648 additions and 31 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -32,8 +32,21 @@ jobs:
with:
poetry-version: "1.7.1"

- name: Configure Poetry for CI build
run: |
poetry config --unset virtualenvs.create --local
poetry config --unset virtualenvs.in-project --local
- uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ matrix.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
run: make
run: make install

- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.0

- name: CI
run: make ci
40 changes: 15 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,43 @@ modules = ${SRC_DIR} ${TESTS_DIR}

# Run this command to setup the project
init:
make pre-init
make init-routine
make post-init

# Main routine used to setup the project
init-routine:
make install
make setup-pre-commit

pre-init:
# Checks that the poetry.lock file exists and is up-to-date
poetry check --lock

post-init:
# Checks that all configs files are valid before doing anything
make check-configs

install:
# Installs all dependencies and synchronize the environment
# with the locked packages and the specified groups
poetry install --sync
poetry install --sync --all-extras

check-configs:
# Validates poetry's config files
poetry check
# Validates the pre-commit config file.
pre-commit validate-config .pre-commit-config.yaml
poetry run pre-commit validate-config .pre-commit-config.yaml

setup-pre-commit:
# Install all pre-commit hooks
pre-commit install --install-hooks
poetry run pre-commit install --install-hooks

pre-commit:
# Run all pre-commit hooks
pre-commit run --all-files
poetry run pre-commit run --all-files

format:
ruff format ${modules}
poetry run ruff format ${modules}

ruff:
# Run ruff on all modules
ruff check ${modules} --no-fix
poetry run ruff check ${modules} --no-fix

mypy:
# Run mypy on everything
mypy .
poetry run mypy .

.PHONY: lint-imports
lint-imports:
lint-imports
poetry run lint-imports

lint: lint-imports ruff mypy

Expand All @@ -63,14 +50,17 @@ qa: format lint
.PHONY: tests
tests:
# Run tests (including doctests) and compute coverage
pytest --cov=${SRC_DIR} --doctest-modules
poetry run pytest --cov=${SRC_DIR} --doctest-modules

.PHONY: docs
docs:
# Build the documentation and break on any warnings/errors
mkdocs build --strict
poetry run mkdocs build --strict

docs-serve:
mkdocs serve
poetry run mkdocs serve

build:
poetry build

ci: qa docs tests
ci: check-configs qa docs tests
Loading

0 comments on commit e744c52

Please sign in to comment.