Skip to content

Commit ecc3be0

Browse files
authored
Merge pull request #235 from zero-sum-seattle/poetry
chore: migrate to Poetry and fix MLB API model fields
2 parents adadc75 + f5da39f commit ecc3be0

9 files changed

Lines changed: 525 additions & 77 deletions

File tree

.github/workflows/build-and-test-mlbstatsapi-prd.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
1-
name: Python Build MLBstats API
1+
name: Python Build MLBstats API
22

33
on:
44
push:
55
branches:
66
- main
7+
78
jobs:
89
build:
9-
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
1313
python-version: ["3.10"]
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v4
18+
uses: actions/setup-python@v5
1919
with:
2020
python-version: ${{ matrix.python-version }}
21+
- name: Install Poetry
22+
uses: snok/install-poetry@v1
23+
with:
24+
virtualenvs-create: true
25+
virtualenvs-in-project: true
2126
- name: Install dependencies
22-
run: |
23-
python3 -m pip install --upgrade pip
24-
python3 -m pip install --upgrade pytest
25-
python3 -m pip install --upgrade build
26-
python3 -m pip install --upgrade requests
27-
python3 -m pip install --upgrade requests_mock
27+
run: poetry install --no-interaction
2828
- name: Test with mocks with pytest
29-
run: |
30-
python3 -m pytest tests/mock_tests/*
29+
run: poetry run pytest tests/mock_tests/
3130
- name: Test external tests with pytest
32-
run: |
33-
python3 -m pytest tests/external_tests/*
34-
- name: build and install
35-
run: |
36-
python3 -m build
37-
python3 -m pip install .
31+
run: poetry run pytest tests/external_tests/
32+
- name: Build package
33+
run: poetry build
3834
- name: Publish a Python distribution to PyPI
3935
uses: pypa/gh-action-pypi-publish@release/v1
4036
with:

.github/workflows/build-and-test-mlbstatsapi-test.yml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,32 @@ on:
77

88
jobs:
99
build:
10-
1110
runs-on: ubuntu-latest
1211
strategy:
1312
matrix:
1413
python-version: ["3.10"]
1514

1615
steps:
17-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1817
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v4
18+
uses: actions/setup-python@v5
2019
with:
2120
python-version: ${{ matrix.python-version }}
21+
- name: Install Poetry
22+
uses: snok/install-poetry@v1
23+
with:
24+
virtualenvs-create: true
25+
virtualenvs-in-project: true
2226
- name: Install dependencies
23-
run: |
24-
python3 -m pip install --upgrade pip
25-
python3 -m pip install --upgrade pytest
26-
python3 -m pip install --upgrade build
27-
python3 -m pip install --upgrade requests
28-
python3 -m pip install --upgrade requests_mock
27+
run: poetry install --no-interaction
2928
- name: Test with mocks with pytest
30-
run: |
31-
python3 -m pytest tests/mock_tests/*
29+
run: poetry run pytest tests/mock_tests/
3230
- name: Test external tests with pytest
33-
run: |
34-
python3 -m pytest tests/external_tests/*
35-
- name: build and install
36-
run: |
37-
python3 -m build
38-
python3 -m pip install .
31+
run: poetry run pytest tests/external_tests/
32+
- name: Build package
33+
run: poetry build
3934
- name: Publish package to TestPyPI
4035
uses: pypa/gh-action-pypi-publish@release/v1
4136
with:
4237
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
4338
repository_url: https://test.pypi.org/legacy/
44-
45-
46-
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python Build MLBstats API
1+
name: Python Build MLBstats API
22

33
on:
44
push:
@@ -11,28 +11,24 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ["3.10"]
14+
python-version: ["3.10", "3.11", "3.12"]
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ matrix.python-version }}
22+
- name: Install Poetry
23+
uses: snok/install-poetry@v1
24+
with:
25+
virtualenvs-create: true
26+
virtualenvs-in-project: true
2227
- name: Install dependencies
23-
run: |
24-
python3 -m pip install --upgrade pip
25-
python3 -m pip install --upgrade pytest
26-
python3 -m pip install --upgrade build
27-
python3 -m pip install --upgrade requests
28-
python3 -m pip install --upgrade requests_mock
28+
run: poetry install --no-interaction
2929
- name: Test with mocks with pytest
30-
run: |
31-
python3 -m pytest tests/mock_tests/*
30+
run: poetry run pytest tests/mock_tests/
3231
- name: Test external tests with pytest
33-
run: |
34-
python3 -m pytest tests/external_tests/*
35-
- name: build and install
36-
run: |
37-
python3 -m build
38-
python3 -m pip install .
32+
run: poetry run pytest tests/external_tests/
33+
- name: Build package
34+
run: poetry build

mlbstatsapi/models/standings/standings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Standings:
3535
lastupdated: str
3636
teamrecords: List[Union[Teamrecords, dict]]
3737
sport: Optional[Union[Sport, dict]] = None
38+
roundrobin: Optional[dict] = None
3839

3940
def __post_init__(self):
4041
self.league = League(**self.league)

mlbstatsapi/models/stats/pitching.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from dataclasses import InitVar, dataclass, field
1+
from dataclasses import InitVar, dataclass, field
22
from typing import Optional, Union, List
33

44
from mlbstatsapi.models.people import Person, Pitcher, Batter
@@ -389,6 +389,9 @@ class AdvancedPitchingSplit:
389389
inheritedrunnersscored: Optional[int] = None
390390
bequeathedrunners: Optional[int] = None
391391
bequeathedrunnersscored: Optional[int] = None
392+
inningspitchedpergame: Optional[str] = None
393+
flyballpercentage: Optional[str] = None
394+
392395

393396
def __repr__(self) -> str:
394397
kws = [f'{key}={value}' for key, value in self.__dict__.items() if value is not None and value]

0 commit comments

Comments
 (0)