Skip to content

Commit

Permalink
Merge pull request #55 from WenjieDu/dev
Browse files Browse the repository at this point in the history
Use setup.cfg to manage dependencies for different usages
  • Loading branch information
WenjieDu authored Apr 17, 2023
2 parents b390e7e + f03d3fb commit 8efa079
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 14 deletions.
38 changes: 25 additions & 13 deletions .github/workflows/testing_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,48 @@ name: Daily Testing

on:
schedule:
# see https://crontab.guru
# Run "At 03:00 on Sunday, Tuesday, Thursday, and Saturday."
# - cron: '0 3 * * 0,2,4,6'
- cron: '0 3 * * *'
# https://crontab.guru. Run everyday at 0:00AM UTC, i.e. 08:00AM Beijing, i.e. 08:00PM Montreal (summer time)
- cron: "0 0 * * *"

jobs:
test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
shell: bash {0}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.7", "3.9", "3.10"]
torch-version: ["1.13.1"]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
- uses: actions/setup-python@v4.3
with:
python-version: ${{ matrix.python-version }}
check-latest: true
cache: pip
cache-dependency-path: |
setup.cfg
- name: Install Pytorch
- name: Install PyTorch ${{ matrix.torch-version }}+cpu
# we have to install torch in advance because torch_sparse needs it for compilation,
# refer to https://github.com/rusty1s/pytorch_sparse/issues/156#issuecomment-1304869772 for details
run: |
which python
which pip
python -m pip install --upgrade pip
pip install torch>=1.10.0
pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/cpu
python -c "import torch; print('PyTorch:', torch.__version__)"
- name: Install other dependencies
run: |
pip install -r pypots/tests/environment_for_pip_test.txt
pip install -e ".[optional]" -f "https://data.pyg.org/whl/torch-${{ matrix.torch-version }}+cpu.html"
pip install -e ".[basic]"
pip install -e ".[test]"
- name: Fetch the test environment details
run: |
Expand All @@ -46,8 +54,12 @@ jobs:
run: |
coverage run --source=pypots -m pytest
- name: Submit the report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate the LCOV report
run: |
coveralls --service=github
python -m coverage lcov
- name: Submit the report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "coverage.lcov"
40 changes: 39 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,42 @@
max-line-length = 120
extend-ignore =
# why ignore E203? Refer to https://github.com/PyCQA/pycodestyle/issues/373
E203,
E203,


[options.extras_require]
# add dependencies for different usages below

# basic dependencies
basic =
numpy>=1.23.3
scikit-learn>=0.24.1
pandas<2.0.0
torch>=1.10.0
tensorboard
scipy
h5py
tsdb
pycorruptor

# dependencies that are optional
# torch-geometric are only needed for model Raindrop but its installation takes too much time
optional =
torch-geometric
torch-scatter
torch-sparse

# dependencies for run all functions and models in PyPOTS = `basic` dependencies + `optional` dependencies
full =
%(basic)s
%(optional)s

# dependencies to run tests
test =
pytest-xdist
pytest-cov

# dependencies for development = `full` dependencies + `test` dependencies
dev =
%(full)s
%(test)s

0 comments on commit 8efa079

Please sign in to comment.