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
23 changes: 12 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install rye
uses: baptiste0928/cargo-install@v2

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
crate: rye
git: https://github.com/mitsuhiko/rye
branch: main
- name: Fix Python version
run: rye pin 3.11
- name: Install Dependencies
run: rye sync
python-version-file: "pyproject.toml"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run mypy
run: |
rye run mypy metaboatrace
run: uv run mypy metaboatrace
29 changes: 15 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@ on:

jobs:
publish:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install rye
uses: baptiste0928/cargo-install@v2

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
crate: rye
git: https://github.com/astral-sh/rye
branch: main
- name: Fix Python version
run: rye pin 3.11
- name: Build the package
run: |
rye build
- name: Publish the package
run: |
rye publish --token ${{ secrets.PYPI_API_TOKEN }} --yes
enable-cache: true
cache-dependency-glob: uv.lock

- name: Set up Python
run: uv python install 3.11

- name: Build
run: uv build

- name: Publish
run: uv publish -t ${{ secrets.PYPI_TOKEN }}
24 changes: 13 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install rye
uses: baptiste0928/cargo-install@v2

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
crate: rye
git: https://github.com/mitsuhiko/rye
branch: main
- name: Fix Python version
run: rye pin 3.11
- name: Install Dependencies
run: rye sync
python-version-file: "pyproject.toml"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run tests with coverage
run: |
rye run pytest --cov=metaboatrace.models tests --cov-report=xml:coverage.xml
run: uv run pytest --cov=metaboatrace.models tests --cov-report=xml:coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@

## 概要

ボートレース関連の開発で用いるモデルのパッケージ
ボートレース関連の開発で用いるモデルのパッケージ
※ 機械学習におけるモデルではなく、クリーンアーキテクチャでのエンティティ層に相当するモジュールの集積

## インストール

```bash
$ pip install metaboatrace.models
```

## 開発環境構築

```bash
uv sync
source .venv/bin/activate
```

※ `uv` が事前にインストールされていること
Empty file removed metaboatrace/models/__init__.pyi
Empty file.
28 changes: 0 additions & 28 deletions metaboatrace/models/boat.pyi

This file was deleted.

13 changes: 12 additions & 1 deletion metaboatrace/models/race.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ class WinningTrick(Enum):
NUKI = 5
MEGUMARE = 6

def valid_courses(self) -> set[int]:
"""Returns a set of valid course numbers (1-6) based on the winning trick."""
if self == WinningTrick.NIGE:
return {1}
elif self in {WinningTrick.SASHI, WinningTrick.MAKURI}:
return {2, 3, 4, 5, 6}
elif self == WinningTrick.MAKURIZASHI:
return {3, 4, 5, 6}
else:
return {1, 2, 3, 4, 5, 6}


class Disqualification(Enum):
CAPSIZE = 1
Expand Down Expand Up @@ -111,7 +122,7 @@ class BoatSetting(_RaceEntryIdentifier):


class Odds(_RaceIdentifier, _BettingMixin):
ratio: float = Field(None, ge=0, le=9999.0)
ratio: Optional[float] = Field(None, ge=0, le=9999.0)


class Payoff(_RaceIdentifier, _BettingMixin):
Expand Down
101 changes: 0 additions & 101 deletions metaboatrace/models/race.pyi

This file was deleted.

54 changes: 0 additions & 54 deletions metaboatrace/models/racer.pyi

This file was deleted.

Loading