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
32 changes: 14 additions & 18 deletions .github/workflows/build-and-test-mlbstatsapi-prd.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
name: Python Build MLBstats API
name: Python Build MLBstats API

on:
push:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3
- 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 }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pytest
python3 -m pip install --upgrade build
python3 -m pip install --upgrade requests
python3 -m pip install --upgrade requests_mock
run: poetry install --no-interaction
- name: Test with mocks with pytest
run: |
python3 -m pytest tests/mock_tests/*
run: poetry run pytest tests/mock_tests/
- name: Test external tests with pytest
run: |
python3 -m pytest tests/external_tests/*
- name: build and install
run: |
python3 -m build
python3 -m pip install .
run: poetry run pytest tests/external_tests/
- name: Build package
run: poetry build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
32 changes: 12 additions & 20 deletions .github/workflows/build-and-test-mlbstatsapi-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,32 @@ on:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3
- 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 }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pytest
python3 -m pip install --upgrade build
python3 -m pip install --upgrade requests
python3 -m pip install --upgrade requests_mock
run: poetry install --no-interaction
- name: Test with mocks with pytest
run: |
python3 -m pytest tests/mock_tests/*
run: poetry run pytest tests/mock_tests/
- name: Test external tests with pytest
run: |
python3 -m pytest tests/external_tests/*
- name: build and install
run: |
python3 -m build
python3 -m pip install .
run: poetry run pytest tests/external_tests/
- name: Build package
run: poetry build
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/



32 changes: 14 additions & 18 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python Build MLBstats API
name: Python Build MLBstats API

on:
push:
Expand All @@ -11,28 +11,24 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- 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 }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pytest
python3 -m pip install --upgrade build
python3 -m pip install --upgrade requests
python3 -m pip install --upgrade requests_mock
run: poetry install --no-interaction
- name: Test with mocks with pytest
run: |
python3 -m pytest tests/mock_tests/*
run: poetry run pytest tests/mock_tests/
- name: Test external tests with pytest
run: |
python3 -m pytest tests/external_tests/*
- name: build and install
run: |
python3 -m build
python3 -m pip install .
run: poetry run pytest tests/external_tests/
- name: Build package
run: poetry build
1 change: 1 addition & 0 deletions mlbstatsapi/models/standings/standings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Standings:
lastupdated: str
teamrecords: List[Union[Teamrecords, dict]]
sport: Optional[Union[Sport, dict]] = None
roundrobin: Optional[dict] = None

def __post_init__(self):
self.league = League(**self.league)
Expand Down
5 changes: 4 additions & 1 deletion mlbstatsapi/models/stats/pitching.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import InitVar, dataclass, field
from dataclasses import InitVar, dataclass, field
from typing import Optional, Union, List

from mlbstatsapi.models.people import Person, Pitcher, Batter
Expand Down Expand Up @@ -389,6 +389,9 @@ class AdvancedPitchingSplit:
inheritedrunnersscored: Optional[int] = None
bequeathedrunners: Optional[int] = None
bequeathedrunnersscored: Optional[int] = None
inningspitchedpergame: Optional[str] = None
flyballpercentage: Optional[str] = None


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