Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: bert-score-api
name: python-template

services:
app:
Expand Down
25 changes: 25 additions & 0 deletions .github/actions/setup-python/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Setup Python Environment"
description: "Set up Python environment for the given Python version"

runs:
using: "composite"
steps:
# - uses: actions/setup-python@v5
# with:
# python-version-file: ".python-version"

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: "true"
cache-suffix: "UV_PYTHON"

- name: Install Python
run: uv python install
shell: bash

- name: Create virtual environment
run: |
uv venv
shell: bash
19 changes: 7 additions & 12 deletions .github/workflows/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Set up cache
uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- name: Pip Update
run: |
make -s update-pip
- name: Set up python environment
uses: ./.github/actions/setup-python
# - name: Set up cache
# uses: actions/cache@v2
# with:
# key: ${{ github.ref }}
# path: .cache
- name: Docs Dependency Installation
run: |
make -s install-doc
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Pip Update
run: |
make -s update-pip
- name: Set up python environment
uses: ./.github/actions/setup-python
- name: Lint Dependency Installation
run: |
make -s install-lint
Expand Down
65 changes: 28 additions & 37 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,40 @@ on:
- main

jobs:
# test:
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - name: Disable Logger Outputs
# run: |
# sed -i "s/log_cli = true/log_cli = false/" pyproject.toml
# - name: Install the latest version of rye
# uses: eifinger/setup-rye@v4
# with:
# enable-cache: true
# cache-prefix: 'rye-venv-cache'
# - name: Install the Project with Test Dependencies
# run: |
# rye sync --no-lock
# - name: Test the Project
# run: |
# python -m pytest -n auto

test_matrix:
strategy:
matrix:
python-version: ['3.11', '3.12']
os: [ubuntu-22.04] # windows-latest
runs-on: ${{ matrix.os }}
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Disable Logger Outputs
run: |
sed -i "s/log_cli = true/log_cli = false/" pyproject.toml
- name: Install the latest version of rye
uses: eifinger/setup-rye@v4
with:
enable-cache: true
cache-prefix: 'rye-venv-cache'
- name: Pin Python Version - ${{ matrix.python-version }}
run: |
rye pin ${{ matrix.python-version }}
- name: Set up python environment
uses: ./.github/actions/setup-python
- name: Install the Project with Test Dependencies
run: |
rye sync --no-lock
make install
- name: Test the Project
run: |
python -m pytest -n auto
# - name: Publish code coverage
# uses: codecov/codecov-action@v3
make test-all-parallel

# test_matrix:
# strategy:
# matrix:
# python-version: ['3.11', '3.12']
# os: [ubuntu-22.04] # windows-latest
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# - name: Disable Logger Outputs
# run: |
# sed -i "s/log_cli = true/log_cli = false/" pyproject.toml
# - name: Set up python environment
# uses: ./.github/actions/setup-python
# - name: Install the Project with Test Dependencies
# run: |
# make install
# - name: Test the Project
# run: |
# make test-all-parallel
# # - name: Publish code coverage
# # uses: codecov/codecov-action@v3
30 changes: 14 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-merge-conflict
- id: check-docstring-first
# - id: check-symlinks
# - id: check-json
- id: check-toml
Expand All @@ -21,27 +18,28 @@ repos:
- id: mixed-line-ending
args: ["--fix=lf"]
description: Forces to replace line ending by the UNIX 'lf' character.
- id: fix-encoding-pragma
args: ["--remove"]
description: Removes the encoding-pragma since python3 codes are utf-8 by default
- id: check-added-large-files
args: ["--maxkb=1000"]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-mock-methods
- id: python-no-log-warn
- id: python-no-eval
- id: python-use-type-annotations
# - repo: https://github.com/astral-sh/uv-pre-commit
# # uv version.
# rev: 0.4.20
# hooks:
# # Update the uv lockfile
# - id: uv-lock
# # Run the pip compile
# - id: pip-compile
# args: [requirements.in, -o, requirements.txt]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.5.7
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
# Run the Ruff linter.
- id: ruff
args: [--exit-non-zero-on-fix, --config=pyproject.toml]
# Run the Ruff formatter.
- id: ruff-format
args: [--config=pyproject.toml]

# NOTE: It doesn't use pyproject.toml configs. We might enable it the future.
# - repo: https://github.com/pre-commit/mirrors-mypy
Expand Down
Loading