Skip to content

Commit

Permalink
Add build script (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaebradley committed Jan 19, 2022
1 parent 8db4484 commit 2184e2e
Show file tree
Hide file tree
Showing 19 changed files with 612 additions and 533 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]
poetry-version: [1.0.9]
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -25,10 +24,9 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install Poetry
run: |
bash ./build.sh
- name: Install dependencies, run linting, run tests, and generate code coverage
run: |
poetry install
Expand Down
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
which python3
if [[ $? -ne 0 ]]; then echo "Cannot find python3" && exit 255; fi

# Needed to execute /Applications/Python\ 3.9/Install\ Certificates.command
# Without execution, was getting an SSLError
curl -sSL https://install.python-poetry.org | python3 - --version 1.1.12
if [[ $? -ne 0 ]]; then echo "Failed to install poetry" && exit 255; fi
10 changes: 3 additions & 7 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ The `v2` branch (as well as the `2.0.0+` version) will be deprecated in the near

## Local

Install dependencies using [`poetry`](https://python-poetry.org/) - for installation directions, see
[the documentation](https://python-poetry.org/docs/).
There is a build script written in Bash named `build.sh` that checks if `Python 3` is installed, installs a specific version of [`Poetry`](https://python-poetry.org/).

Once `poetry` has been installed, dependencies can be installed using the `install` command like

```bash
poetry install
```
After the `build.sh` script finishes executing, there will be instructions printed to standard output that give context
around the location of `Poetry`'s `bin` directory and how to add this directory to the `PATH` environment variable.

!!! note
The `pyproject.toml` file is used to describe the project's requirements and relevant metadata including both the
Expand Down
26 changes: 7 additions & 19 deletions draft_kings/url_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,22 @@ def __init__(self, base_path: str = BASE_URL, api_base_path: str = API_BASE_URL)
self.api_base_path = api_base_path

def build_draft_group_url(self, draft_group_id: int) -> str:
return "{API_BASE_URL}/draftgroups/v1/{draft_group_id}".format(
API_BASE_URL=self.api_base_path,
draft_group_id=draft_group_id
)
return f"{self.api_base_path}/draftgroups/v1/{draft_group_id}"

def build_countries_url(self) -> str:
return "{API_BASE_URL}/addresses/v1/countries".format(API_BASE_URL=self.api_base_path)
return f"{self.api_base_path}/addresses/v1/countries"

def build_regions_url(self, country_code: str) -> str:
return "{API_BASE_URL}/addresses/v1/countries/{country_code}/regions".format(
API_BASE_URL=self.api_base_path,
country_code=country_code,
)
return f"{self.api_base_path}/addresses/v1/countries/{country_code}/regions"

def build_contests_url(self) -> str:
return "{BASE_URL}/lobby/getcontests".format(BASE_URL=self.base_path)
return f"{self.base_path}/lobby/getcontests"

def build_available_players_url(self) -> str:
return "{BASE_URL}/lineup/getavailableplayers".format(BASE_URL=self.base_path)
return f"{self.base_path}/lineup/getavailableplayers"

def build_draftables_url(self, draft_group_id: int) -> str:
return "{API_BASE_URL}/draftgroups/v1/draftgroups/{draft_group_id}/draftables".format(
API_BASE_URL=self.api_base_path,
draft_group_id=draft_group_id
)
return f"{self.api_base_path}/draftgroups/v1/draftgroups/{draft_group_id}/draftables"

def build_game_type_rules_url(self, game_type_id: int) -> str:
return "{API_BASE_URL}/lineups/v1/gametypes/{game_type_id}/rules".format(
API_BASE_URL=self.api_base_path,
game_type_id=game_type_id,
)
return f"{self.api_base_path}/lineups/v1/gametypes/{game_type_id}/rules"
Loading

0 comments on commit 2184e2e

Please sign in to comment.