Browse Source

chore: move python code to `/scripts`

NateScarlet 2 years ago
parent
commit
ef9f9cd5e3

+ 3 - 3
.github/workflows/main.yml

@@ -16,7 +16,7 @@ jobs:
         with:
           python-version: '3.8'
       - name: Install dependencies
-        run: pip install -r requirements.txt -r dev-requirements.txt
+        run: pip install -r dev-requirements.txt
       - name: Setup git user
         run: |
           git config user.name "GitHub Actions"
@@ -29,10 +29,10 @@ jobs:
         if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}
         env:
           GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
-        run: coverage run -a ./update.py --release
+        run: coverage run -a ./scripts/update.py --release
       - name: Update
         if: ${{ !(github.ref == 'refs/heads/master' && github.event_name != 'pull_request') }}
-        run: coverage run -a ./update.py 
+        run: coverage run -a ./scripts/update.py 
       # FIXME
       #- name: Report coverage
       #  env:

+ 4 - 0
Makefile

@@ -13,3 +13,7 @@ lint:
 
 format:
 	$(PYTHON) -m black -t py38 . 
+
+.PHONY: test
+test:
+	$(PYTHON) -m pytest

+ 7 - 0
dev-requirements.txt

@@ -1,3 +1,10 @@
+# main
+requests==2.28.1
+beautifulsoup4==4.11.1
+tqdm==4.64.1
+icalendar==4.1.0
+
+# test
 pytest==7.2.0
 coverage==6.5.0
 black==22.10.0

+ 0 - 4
requirements.txt

@@ -1,4 +0,0 @@
-requests==2.28.1
-beautifulsoup4==4.11.1
-tqdm==4.64.1
-icalendar==4.1.0

+ 0 - 0
tests/description_parsing_cases.json → scripts/description_parsing_cases.json


+ 0 - 0
fetch_holidays.py → scripts/fetch.py


+ 2 - 2
tests/test_fetch_holidays.py → scripts/fetch_test.py

@@ -3,7 +3,7 @@ import json
 
 import pytest
 
-from fetch_holidays import (
+from fetch import (
     CustomJSONEncoder,
     DescriptionParser,
     get_paper,
@@ -11,7 +11,7 @@ from fetch_holidays import (
     get_rules,
 )
 
-from .filetools import _file_path
+from filetools import _file_path
 
 
 def test_get_paper_urls():

+ 0 - 0
tests/filetools.py → scripts/filetools.py


+ 0 - 0
generate_ics.py → scripts/generate_ics.py


+ 1 - 1
update.py → scripts/update.py

@@ -13,7 +13,7 @@ from zipfile import ZipFile
 
 from tqdm import tqdm
 
-from fetch_holidays import CustomJSONEncoder, fetch_holiday
+from fetch import CustomJSONEncoder, fetch_holiday
 from generate_ics import generate_ics
 
 

+ 0 - 0
tests/__init__.py