Skip to content

Commit

Permalink
update query to force inclusion of game_code, add support for transac…
Browse files Browse the repository at this point in the history
…tions that include FAAB and/or draft picks, update docs, add simple Docker usage, and update package
  • Loading branch information
uberfastman committed Nov 6, 2023
1 parent fc62699 commit 48545c0
Show file tree
Hide file tree
Showing 279 changed files with 14,567 additions and 2,304 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# macOS
**.DS_Store

# JetBrains
.idea/

# Python
**__pycache__
**.pytest_cache

# environment
**.env*
!**.env.template*
.venv

# auth secrets
**private*.json
!**private.template.json
**token*.json
!**token.template.json

# Docker
compose*.yaml
.dockerignore
docker/Dockerfile
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug Report
about: 'Report any bugs, errors, problems, etc. found in the FFMWR app. '
about: 'Report any bugs, errors, problems, etc. found in YFPY. '
title: "[Bug] Short Description of Erroneous/Problematic Behavior"
labels: bug
assignees: uberfastman
Expand All @@ -12,14 +12,14 @@ Please put a longer description of the bug/issue/problem you are encountering he

## Additional Information as Applicable

#### Fantasy Football Platform
Yahoo/ESPN/Sleeper/Fleaflicker

#### League ID
#### Yahoo Fantasy Sports League ID
XXXXXX...

#### Operating System
macOS/Windows/Linux
#### Yahoo Fantasy Sports League Privacy
Public/Private

#### Operating System/Environment
macOS/Windows/Linux/Docker/etc.

#### Other
Any other setup/environment/configuration information you might deem potentially relevant.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
name: Feature Request
about: Suggest a new idea/feature for the FFMWR app.
about: Suggest a new idea/feature for YFPY.
title: "[Feature Request] Short Description of New Idea/Feature"
labels: feature
assignees: ''

---

## Description
Please describe what new idea/feature would like to see added to the app.
Please describe what new idea/feature would like to see added to the YFPY package.

## Use case
Please elaborate on how your idea/feature request will be provide additional value and/or interesting information beyond what is already included in the generated reports.
Please elaborate on how your idea/feature request will provide additional value/functionality.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ dist/
test_output/

# Environment
*.env
*.env*
!.env.template
*.venv
!EXAMPLE.env
.python-version

# Credentials
*private*.json
!EXAMPLE.private.json
!private.template.json
*token*.json
7 changes: 5 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ include requirements.txt
include dev-requirements.txt

# Include Yahoo Fantasy Sports REST API authentication resources
include auth/EXAMPLE.private.json
include auth/EXAMPLE.env
include auth/private.template.json
include auth/.env.template

# Include YFPY Docker resources
include compose.yaml

# Include quickstart resources
include quickstart/quickstart.py
Expand Down
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ In order to use YFPY with private fantasy leagues, you must set up an app on you
* `API Permissions` (**Required**): check the `Fantasy Sports` checkbox. You can leave the `Read` option selected (appears in an accordion expansion underneath the `Fantasy Sports` checkbox once you select it).
* Click the `Create App` button.
* Once the app is created, it should redirect you to a page for your app, which will show both a `Client ID` and a `Client Secret`.
* Make a copy of [`auth/EXAMPLE.private.json`](https://github.com/uberfastman/yfpy/blob/main/auth/EXAMPLE.private.json), rename it to just `private.json`, and copy the `Client ID` and `Client Secret` values to their respective fields (make sure the strings are wrapped regular quotes (`""`), NOT formatted quotes (`“”`)). The path to this file will be needed to point YFPY to your credentials.
* Make a copy of [`auth/private.template.json`](https://github.com/uberfastman/yfpy/blob/main/auth/private.template.json), rename it to just `private.json`, and copy the `Client ID` and `Client Secret` values to their respective fields (make sure the strings are wrapped regular quotes (`""`), NOT formatted quotes (`“”`)). The path to this file will be needed to point YFPY to your credentials.
* Now you should be ready to initialize the OAuth2 connection between YFPY your Yahoo account.

---
Expand All @@ -113,6 +113,34 @@ In order to use YFPY with private fantasy leagues, you must set up an app on you
* Uncomment/comment out whichever query lines in the `RUN QUERIES` section you wish to run.
* Uncomment/comment out whichever query lines in the `CHECK FOR MISSING DATA FIELDS` section you wish to check for any new/missing data fields returned by the Yahoo Sports Fantasy Football API.

#### Docker

YFPY can be used within Docker for a more seamless, platform-agnostic experience.

* Build the Docker image:
```shell
docker compose build
```
* Run the Docker container:
```shell
docker compose up
```
* You can then run commands in the Docker container in two different ways:
* Connect to the running container and run commands from within it:
```shell
docker exec -it yfpy-package-1 bash
```
Then:
```shell
python quickstart/quickstart.py
```
* Send commands to the running container from your host machine:
```shell
docker exec -i yfpy-package-1 bash -c "python quickstart/quickstart.py"
```

***NOTE***: *If you wish to actively make changes to or develop against YFPY within the Docker container, uncomment the `- .:/opt/yfpy` volume mount in [`compose.yaml`](https://github.com/uberfastman/yfpy/blob/main/compose.yaml) so that any code changes you make in YFPY are reflected inside the running container.*

---

<a name="testing"></a>
Expand All @@ -127,7 +155,7 @@ YFPY has a collection of fully functional code snippets that can be run using [p
#### Integration

* See the [`test/integration`](https://github.com/uberfastman/yfpy/blob/main/test/integration/) directory for example code snippets using pytest.
* Before running any integration tests, make a copy of [`auth/EXAMPLE.env`](https://github.com/uberfastman/yfpy/blob/main/auth/EXAMPLE.env) in the [`auth/`](https://github.com/uberfastman/yfpy/blob/main/auth/) directory and rename it to `.env`.
* Before running any integration tests, make a copy of [`auth/.env.template`](https://github.com/uberfastman/yfpy/blob/main/auth/.env.template) in the [`auth/`](https://github.com/uberfastman/yfpy/blob/main/auth/) directory and rename it to `.env`.
* Copy your Yahoo `Client ID` and `Client Secret` into the environment variables in `.env` so that pytest can use them when hitting the Yahoo Fantasy Sports API.
* If this is the first time running pytest with your Yahoo API credentials, you ***MUST*** allow interactive prompts within pytest by using the `-s` flag.
* The fixture values in [`test/integration/conftest.py`](https://github.com/uberfastman/yfpy/blob/main/test/integration/conftest.py) are defined in [`quickstart/quickstart.py`](https://github.com/uberfastman/yfpy/blob/main/quickstart/quickstart.py), and can be changed for testing by uncommenting/commenting out the values inside each respective function.
Expand Down
2 changes: 1 addition & 1 deletion VERSION.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# DO NOT EDIT - VERSIONING CONTROLLED BY GIT TAGS
__version__ = "v13.0.0"
__version__ = "v14.0.0"
File renamed without changes.
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- PYTHON_VERSION_MINOR=11
context: .
dockerfile: docker/Dockerfile
image: ghcr.io/uberfastman/yfpy:13.0.0 # DO NOT EDIT IMAGE - VERSIONING CONTROLLED BY GIT TAGS
image: ghcr.io/uberfastman/yfpy:14.0.0 # DO NOT EDIT IMAGE - VERSIONING CONTROLLED BY GIT TAGS
platform: linux/amd64
environment:
- RUNTIME_ENVIRONMENT=docker
Expand Down
36 changes: 36 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG PYTHON_VERSION_MAJOR=$PYTHON_VERSION_MAJOR
ARG PYTHON_VERSION_MINOR=$PYTHON_VERSION_MINOR

# set base image
FROM --platform=linux/amd64 python:${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}-slim

LABEL "org.opencontainers.image.source"="https://github.com/uberfastman/yfpy"

# update package index list
RUN apt update && \
apt upgrade && \
apt install -y git

# set the working directory in the container
WORKDIR /opt/yfpy

# set python environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

## copy the project root contents to the working directory
COPY .. .

# install dependencies
RUN pip install --upgrade pip && \
pip install -r requirements.txt

RUN chmod +x ./docker/docker-entrypoint.sh

# specify docker as package runtime environment
ENV RUNTIME_ENVIRONMENT docker

ENTRYPOINT ["./docker/docker-entrypoint.sh"]

# command to run on container start
CMD tail -f /dev/null
7 changes: 7 additions & 0 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# startup message
/bin/echo "YFPY is ready!"

# execute CMD from Dockerfile
exec "$@"
29 changes: 29 additions & 0 deletions docs-sphinx/source/_autosummary/yfpy.models.Pick.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
yfpy.models.Pick
================

.. currentmodule:: yfpy.models

.. autoclass:: Pick
:members:
:show-inheritance:
:inherited-members:
:special-members: __call__, __add__, __mul__



.. rubric:: Methods

.. autosummary::
:nosignatures:

~Pick.clean_data_dict
~Pick.from_json
~Pick.serialized
~Pick.subclass_dict
~Pick.to_json






1 change: 1 addition & 0 deletions docs-sphinx/source/_autosummary/yfpy.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
OutcomeTotals
Ownership
PercentOwned
Pick
Player
PlayerAdvancedStats
PlayerPoints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@
.. autosummary::

~YahooFantasySportsQuery.YFO
~YahooFantasySportsQuery.runtime_environment_is_docker


2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 97ec4bc4af03b9613a945ece5253f01a
config: 325f953d1e0471bd06261a26c996b30e
tags: 645f666f9bcd5a90fca523b33c5a78b7
Loading

0 comments on commit 48545c0

Please sign in to comment.