Skip to content

Commit

Permalink
[CI] Fix CI and update networkx dependency (py-why#99)
Browse files Browse the repository at this point in the history
* Remove python3.8 support

---------

Signed-off-by: Adam Li <[email protected]>
  • Loading branch information
adam2392 authored Oct 31, 2023
1 parent 608206e commit 7151bed
Show file tree
Hide file tree
Showing 30 changed files with 1,683 additions and 1,253 deletions.
30 changes: 20 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ orbs:

jobs:
build_doc:
executor: python/default
executor:
name: python/default
tag: "3.10"
steps:
- restore_cache:
name: Restore .git
Expand Down Expand Up @@ -46,7 +48,8 @@ jobs:
- run:
name: Install the latest version of Poetry
command: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.5.0
curl -sSL https://install.python-poetry.org | python3 - --version 1.6.1
python --version
poetry --version
- run:
name: Set BASH_ENV
Expand All @@ -65,30 +68,37 @@ jobs:
name: Install pysal dependencies
command: |
sudo apt install libspatialindex-dev xdg-utils shared-mime-info desktop-file-utils
- run:
name: Setup torch for pgmpy
command: |
sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc
- run:
name: Setup pandoc
command: sudo apt update && sudo apt install -y pandoc optipng

- python/install-packages:
pkg-manager: poetry
cache-version: "v1" # change to clear cache
cache-version: "v2" # change to clear cache
args: "--with docs --extras viz --extras sims"
- run:
name: Check poetry package versions
command: |
poetry --version
poetry show
- run:
name: Setup torch for pgmpy
command: |
sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc
- run:
name: Check installation
command: |
poetry run python -c "import pywhy_graphs;"
poetry run python -c "import numpy; numpy.show_config()"
LIBGL_DEBUG=verbose poetry run python -c "import matplotlib.pyplot as plt; plt.figure()"
# dowhy currently requires an older version of numpy
- run:
name: Temporary Hack for numpy
command: |
poetry run python -m pip install numpy==1.22.0
- run:
name: Build documentation
command: |
Expand Down Expand Up @@ -152,7 +162,7 @@ jobs:
cat $BASH_ENV
- python/install-packages:
pkg-manager: poetry
cache-version: "v1" # change to clear cache
cache-version: "v1" # change to clear cache
args: "--with docs"
- run:
name: make linkcheck
Expand Down Expand Up @@ -256,4 +266,4 @@ workflows:
filters:
branches:
only:
- main
- main
48 changes: 29 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ concurrency:
on:
pull_request:
paths:
- '**.py'
- "**.py"
- "**.yml"
- "**.toml"
push:
branches: [main]
paths:
- '**.py'
- "**.py"
tags:
- 'v*.*.*'
- "v*.*.*"
workflow_dispatch:

jobs:
Expand All @@ -20,25 +22,25 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
poetry-version: [1.5.1]
poetry-version: [1.6.1]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
python-version: "3.9"
architecture: "x64"
- name: Install Poetry ${{ matrix.poetry-version }}
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install Poetry Dynamic Versioning Plugin
run: pip install poetry-dynamic-versioning

- name: Install dependencies
run: poetry install --only style

# check formatting of the code style
- name: Check code formatting
run: poetry run poe format_check
Expand All @@ -57,7 +59,7 @@ jobs:
matrix:
os: [ubuntu, macos, windows]
python-version: [3.9, "3.10", "3.11"]
poetry-version: [1.5.1]
poetry-version: [1.6.1]
name: build ${{ matrix.os }} - py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
defaults:
Expand All @@ -70,7 +72,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
architecture: "x64"
- name: Install Poetry ${{ matrix.poetry-version }}
uses: abatilo/[email protected]
with:
Expand Down Expand Up @@ -113,9 +115,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: [3.9, "3.11"] # oldest and newest supported versions
poetry-version: [1.5.1]
python-version: [3.9, "3.11"] # oldest and newest supported versions
poetry-version: [1.6.1]
networkx: [stable, main]
exclude:
- python-version: 3.9
networkx: main
name: Unit-test ${{ matrix.os }} - py${{ matrix.python-version }} - Networkx ${{ matrix.networkx }}
runs-on: ${{ matrix.os }}-latest
defaults:
Expand All @@ -128,29 +133,34 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
architecture: "x64"
- name: Install Poetry ${{ matrix.poetry-version }}
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install Poetry Dynamic Versioning Plugin
run: pip install poetry-dynamic-versioning
run: |
pip install --upgrade pip
pip install poetry-dynamic-versioning
- name: Install packages via poetry
run: |
poetry install --with test
- name: Install Networkx (main)
if: "matrix.networkx == 'main'"
run: |
pip uninstall -yq networkx
pip install --progress-bar off git+https://github.com/networkx/networkx
git clone https://github.com/networkx/networkx.git
cd networkx
pip install .[default]
# pip install --progress-bar off git+https://github.com/networkx/networkx
- name: Setup torch for pgmpy
if: "matrix.os == 'ubuntu'"
shell: bash
run: |
sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc
- name: Run pytest # headless via Xvfb on linux
- name: Run pytest # headless via Xvfb on linux
run: poetry run poe unit_test
- name: Upload coverage stats to codecov
if: ${{ matrix.os == 'ubuntu' && matrix.python-version == '3.11' && matrix.networkx == 'stable' }}
Expand All @@ -173,7 +183,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: 'x64'
architecture: "x64"
- name: Install dependencies
run: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
Expand Down
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

repos:
- repo: https://github.com/floatingpurr/sync_with_poetry
rev: "0.4.0" # the revision or tag to clone at
rev: "0.4.0" # the revision or tag to clone at
hooks:
- id: sync_with_poetry
args: ["--all"] # optional args
args: ["--all"] # optional args
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
Expand All @@ -27,18 +27,17 @@ repos:
rev: "6.0.0"
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.971"
hooks:
- id: mypy
name: mypy (dodiscover)
args: ["--config-file", "pyproject.toml"]
files: ^dodiscover/
- repo: https://github.com/pre-commit/mirrors-mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.971"
hooks:
- id: mypy
name: mypy (tests)
args: ["--config-file", "pyproject.toml"]
files: ^tests/

7 changes: 7 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: default

rules:
line-length: disable
document-start: disable
truthy: disable
comments: disable
2 changes: 1 addition & 1 deletion doc/reference/functional/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ model. Currently, we only support linear models, but we plan to support non-line
and we also do not support latent confounders yet.

To add a latent confounder, one can add a confounder explicitly, generate the data
and then drop the confounder varialble in the final dataset. In the roadmap of this submodule,
and then drop the confounder variable in the final dataset. In the roadmap of this submodule,
the plan is to represent any bidirected edge as a uniformly randomly distributed variable
that has an additive noise effect on both variables simultaneously.

Expand Down
1 change: 1 addition & 0 deletions doc/whats_new/v0.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Changelog
- |Feature| Implement and test functions to validate an MAG and check the presence of almost directed cycles, by `Aryan Roy`_ (:pr:`91`)
- |Feature| Implement and test functions to convert a DAG to MAG, by `Aryan Roy`_ (:pr:`96`)
- |Feature| Implement and test functions to convert a PAG to MAG, by `Aryan Roy`_ (:pr:`93`)
- |API| Remove support for Python 3.8 by `Adam Li`_ (:pr:`99`)

Code and Documentation Contributors
-----------------------------------
Expand Down
Loading

0 comments on commit 7151bed

Please sign in to comment.