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
48 changes: 27 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]
workflow_dispatch:

jobs:
deploy:

build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # required for Trusted Publishing (OIDC)

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Set up Python
run: uv python install

- name: Build distributions
run: uv build --no-sources

- name: Smoke test artifacts
run: |
uv run --no-project --with dist/*.whl -- python -c "import yahoofantasy"

# Publish to PyPI using Trusted Publishing (no secrets)
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
50 changes: 27 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
name: Tests and linter

on:
- push
- pull_request
push:
pull_request:

jobs:
build:

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test_requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Set up Python
run: uv python install ${{ matrix.python-version }}

- name: Sync dependencies
run: uv sync --dev

- name: Lint with flake8
run: |
uv run flake8 yahoofantasy --count --select=E9,F63,F7,F82 --show-source --statistics
uv run flake8 yahoofantasy --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Test with pytest
run: uv run -m pytest
34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "yahoofantasy"
dynamic = ["version"]
description = "An SDK for the Yahoo! Fantasy Sports API"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"click>=8.3.0",
"colorama>=0.4.6",
"pydash>=8.0.5",
"requests>=2.32.5",
"xmljson>=0.2.1",
]

[tool.setuptools.dynamic]
version = {attr = "yahoofantasy.__version__"}

[project.scripts]
yahoofantasy = "yahoofantasy.cli:yahoofantasy"

[dependency-groups]
dev = [
"coverage>=5.0.4",
"flake8>=3.7.9",
"pytest>=7",
"pytest-cov>=2.8.1",
"pytest-testmon>=1.0.2",
"pytest-watch>=4.2.0",
"responses>=0.10.12",
]
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

38 changes: 0 additions & 38 deletions setup.py

This file was deleted.

7 changes: 0 additions & 7 deletions test_requirements.txt

This file was deleted.

Loading