Skip to content

Commit 93dc61c

Browse files
authored
Create python-package-conda.yml (#18)
* Create python-package-conda.yml * Update python-package-conda.yml * Create environment.yml * Update environment.yml spacing * replaced pytest with unittest * created test folder to build * checking for folder directory * neccessary file added and path added * removed comments and added init file for workflow * directly testing the file * hardcoding path * troubleshooting
1 parent 7f3cfdc commit 93dc61c

6 files changed

Lines changed: 52 additions & 16 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Python Package using Conda
2+
3+
on: [push]
4+
5+
jobs:
6+
build-linux:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
max-parallel: 5
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Python 3.10
14+
uses: actions/setup-python@v3
15+
with:
16+
python-version: '3.10'
17+
- name: Add conda to system path
18+
run: |
19+
# $CONDA is an environment variable pointing to the root of the miniconda directory
20+
echo $CONDA/bin >> $GITHUB_PATH
21+
- name: Install dependencies
22+
run: |
23+
conda env update --file environment.yml --name base
24+
- name: Lint with flake8
25+
run: |
26+
conda install flake8
27+
# stop the build if there are Python syntax errors or undefined names
28+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31+
- name: Run unittest files by path
32+
run: |
33+
shopt -s nullglob
34+
for i in src/tests/test_*.py; do
35+
echo " RUNNING $i "
36+
python "$i" || exit 1
37+
done

environment.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: myenv
2+
channels:
3+
- defaults
4+
- conda-forge
5+
dependencies:
6+
- python=3.10
7+
- pip
8+
- numpy
9+
- pandas
10+
- requests
11+
- pip:
12+
- beautifulsoup4
13+
- lxml

webscraper/src/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#placeholder for build yaml file in github actions workflow

webscraper/src/main.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
# from Cheaper_Scraper import CheaperScraper
2-
3-
# def main():
4-
# scraper = CheaperScraper("https://www.walmart.com",
5-
# user_agent="CheaperBot/0.1",
6-
# delay=2.0)
7-
# pages = ["/",
8-
# "/about",
9-
# "/shop/clothing-and-accessories/new-arrivals",
10-
# "/ip/Siilsaa-Womens-Tops-2024-Soft-Short-Sleeve-Casual-Blouses-Shirt-Crewneck-Fashion-Knit-Pullover-Sweater-White-M/13496269884?classType=VARIANT&athbdg=L1600"]
11-
# results = scraper.scrape(pages)
12-
# for path, items in results.items():
13-
# print(path, items)
14-
15-
# if __name__ == "__main__":
16-
# main()
171

182
from Cheaper_Scraper import CheaperScraper
193
import json

webscraper/src/tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# github workflow requires an init.py
File renamed without changes.

0 commit comments

Comments
 (0)