Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
tieandrews authored Jul 11, 2023
2 parents 0ee747c + bd7b030 commit 262da53
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev_fortunatowheels-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions

name: Build and deploy Python app to Azure Web App - fortunatowheels-dev
name: Dev - Build/Deploy to Azure-fortunatowheels-dev

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main_fortunatowheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions

name: Build and deploy Python app to Azure Web App - fortunatowheels
name: Prod - Build/Deploy to Azure-fortunatowheels

on:
push:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/testing-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Testing & Code Coverage

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main", "dev" ]
workflow_dispatch:

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- 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 --cov=src --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.xml # coverage report
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![codecov][codecov-shield]][codecov-url]

![](assets/fortunato-wheels-logo-blue-white.png)
(Fortunato: Latin word for "lucky")
(Fortunato: Latin for "lucky")

Fortunato wheels takes the guesswork out of buying a used car. It does this by compiling datasets of used cars from multiple websites, analyzing the data to identify trends and baselines for car prices, then make this information available to users in an interactive tool to evaluate car prices.

Expand Down Expand Up @@ -31,3 +38,16 @@ To start using Fortunato wheels you can browse through our database of used car
## References

- Craigslist Used Cars Dataset, Austin Reese, https://www.kaggle.com/datasets/austinreese/craigslist-carstrucks-data

[contributors-shield]: https://img.shields.io/github/contributors/tieandrews/fortunato-wheels.svg?style=for-the-badge
[contributors-url]: https://github.com/tieandrews/fortunato-wheels/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/tieandrews/fortunato-wheels.svg?style=for-the-badge
[forks-url]: https://github.com/tieandrews/fortunato-wheels/network/members
[stars-shield]: https://img.shields.io/github/stars/tieandrews/fortunato-wheels.svg?style=for-the-badge
[stars-url]: https://github.com/tieandrews/fortunato-wheels/stargazers
[issues-shield]: https://img.shields.io/github/issues/tieandrews/fortunato-wheels.svg?style=for-the-badge
[issues-url]: https://github.com/tieandrews/fortunato-wheels/issues
[license-shield]: https://img.shields.io/github/license/tieandrews/fortunato-wheels.svg?style=for-the-badge
[license-url]: https://github.com/tieandrews/fortunato-wheels/blob/master/LICENSE.txt
[codecov-shield]: https://img.shields.io/codecov/c/github/tieandrews/fortunato-wheels?style=for-the-badge
[codecov-url]: https://codecov.io/gh/tieandrews/fortunato-wheels
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- "*/tests/*”
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ dash-loading-spinners~=1.0
azure-storage-blob~=12.16
azure-identity~=1.12
python-dotenv~=1.0
python-frontmatter~=1.0
python-frontmatter~=1.0
pytest-cov~=4.1
pytest~=6.2
coverage~=7.2
codecov~=2.1
7 changes: 6 additions & 1 deletion src/pages/explore_ads.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,19 @@ def update_filter_options(
],
State("num-ads-summary-store", "data"),
State("makes-models-store", "data"),
State("price-summary-store", "data"),
)
def update_ad_filter_count(
age_range, price_range, models, makes, num_ads_summary_dict, makes_models_dict
age_range, price_range, models, makes, num_ads_summary_dict, makes_models_dict, price_summary_store
):
start_time = time.time()

num_ads_summary_df = pd.DataFrame.from_dict(num_ads_summary_dict, orient="columns")
makes_models_df = pd.DataFrame.from_dict(makes_models_dict, orient="columns")
price_summary_df = pd.DataFrame.from_dict(price_summary_store, orient="columns")

if price_range is None:
price_range = price_summary_df.max().max()

if (len(models) == 0) & (len(makes) == 0):
# remove some models that are not really models
Expand Down
12 changes: 3 additions & 9 deletions tests/visualizations/test_explore_ads_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
# Date: 2023-05-08
import os, sys
import pytest

# on launch ensure src is in path
cur_dir = os.getcwd()
try:
SRC_PATH = cur_dir[: cur_dir.index("fortunato-wheels") + len("fortunato-wheels")]
except ValueError:
# deal with Azure app service not working with relative imports
SRC_PATH = ""
pass

# ensure that the parent directory is on the path for relative imports
SRC_PATH = sys.path.append(os.path.join(os.path.dirname(__file__), "..", ".."))
if SRC_PATH not in sys.path:
sys.path.append(SRC_PATH)

Expand Down

0 comments on commit 262da53

Please sign in to comment.