Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINT] Drop Python3.8 support #1056

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/advanced-on-demand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.9, "3.10", "3.11", "3.12"]
poetry-version: [1.5.1]
test-group: [1, 2, 3, 4]

Expand Down
85 changes: 43 additions & 42 deletions .github/workflows/ci-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,58 @@ on:
push:
branches: [main]
paths:
- '.github/workflows/ci-install.yml'
- 'dowhy/**'
- 'tests/**'
- 'pyproject.toml'
- 'poetry.lock'
- ".github/workflows/ci-install.yml"
- "dowhy/**"
- "tests/**"
- "pyproject.toml"
- "poetry.lock"

pull_request:
branches: [main]
paths:
- '.github/workflows/ci-install.yml'
- 'dowhy/**'
- 'tests/**'
- 'pyproject.toml'
- 'poetry.lock'
- ".github/workflows/ci-install.yml"
- "dowhy/**"
- "tests/**"
- "pyproject.toml"
- "poetry.lock"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
# TODO: Enable "3.12" when packages are updated
python-version: [3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install graphviz
run: |
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config

- name: Install dependencies
run: |
python -m pip install --upgrade pip
echo "HEAD_REPO='$HEAD_REPO'"
echo "HEAD_BRANCH='$HEAD_BRANCH'"
echo "GITHUB_CONTEXT='$GITHUB_CONTEXT'"
pip install git+https://github.com/${HEAD_REPO}@${HEAD_BRANCH:-main}
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
HEAD_BRANCH: ${{ github.event.pull_request.head.ref || github.head_ref || 'main' }}

- name: Notify Discord
if: failure() && github.ref == 'refs/heads/main'
uses: th0th/[email protected]
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_JOB_NAME: CI Install Check Failed on Main
GITHUB_JOB_STATUS: ${{ job.status }}
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install graphviz
run: |
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config

- name: Install dependencies
run: |
python -m pip install --upgrade pip
echo "HEAD_REPO='$HEAD_REPO'"
echo "HEAD_BRANCH='$HEAD_BRANCH'"
echo "GITHUB_CONTEXT='$GITHUB_CONTEXT'"
pip install git+https://github.com/${HEAD_REPO}@${HEAD_BRANCH:-main}
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
HEAD_BRANCH: ${{ github.event.pull_request.head.ref || github.head_ref || 'main' }}

- name: Notify Discord
if: failure() && github.ref == 'refs/heads/main'
uses: th0th/[email protected]
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_JOB_NAME: CI Install Check Failed on Main
GITHUB_JOB_STATUS: ${{ job.status }}
113 changes: 57 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,84 @@ on:
push:
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'dowhy/**'
- 'tests/**'
- 'docs/source/example_notebooks/**'
- 'pyproject.toml'
- 'poetry.lock'
- ".github/workflows/ci.yml"
- "dowhy/**"
- "tests/**"
- "docs/source/example_notebooks/**"
- "pyproject.toml"
- "poetry.lock"
pull_request:
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'dowhy/**'
- 'tests/**'
- 'docs/source/example_notebooks/**'
- 'pyproject.toml'
- 'poetry.lock'
- ".github/workflows/ci.yml"
- "dowhy/**"
- "tests/**"
- "docs/source/example_notebooks/**"
- "pyproject.toml"
- "poetry.lock"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
# TODO: Enable "3.12" when packages are updated
python-version: [3.9, "3.10", "3.11"]
poetry-version: [1.5.1]
test-group: [1, 2, 3, 4, 5, 6]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry ${{ matrix.poetry-version }}
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install Poetry ${{ matrix.poetry-version }}
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install graphviz
run: |
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config
- name: Install graphviz
run: |
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config

- name: Install dependencies
run: |
python -m pip install --upgrade pip
echo "installing poetry dependencies"
poetry install -E plotting -E pygraphviz
- name: Install dependencies
run: |
python -m pip install --upgrade pip
echo "installing poetry dependencies"
poetry install -E plotting -E pygraphviz

- name: Lint
run: poetry run poe lint
- name: Lint
run: poetry run poe lint

- name: Check Formatting
run: poetry run poe format_check
- name: Check Formatting
run: poetry run poe format_check

- name: Test
run: poetry run poe test --splits 6 --group ${{ matrix.test-group }}
- name: Test
run: poetry run poe test --splits 6 --group ${{ matrix.test-group }}

- name: Install EconML dependency
run: |
poetry install -E plotting -E pygraphviz -E econml
- name: Install EconML dependency
run: |
poetry install -E plotting -E pygraphviz -E econml

- name: Test EconML based functionality
run: poetry run poe test_econml
- name: Test EconML based functionality
run: poetry run poe test_econml

- name: Test README errors for PyPI
run: |
pip install poetry-dynamic-versioning
pip install twine
poetry-dynamic-versioning
poetry build
twine check dist/*
- name: Test README errors for PyPI
run: |
pip install poetry-dynamic-versioning
pip install twine
poetry-dynamic-versioning
poetry build
twine check dist/*

- name: Notify Discord
if: failure() && github.ref == 'refs/heads/main'
uses: th0th/[email protected]
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_JOB_NAME: CI Failed on Main
GITHUB_JOB_STATUS: ${{ job.status }}
- name: Notify Discord
if: failure() && github.ref == 'refs/heads/main'
uses: th0th/[email protected]
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_JOB_NAME: CI Failed on Main
GITHUB_JOB_STATUS: ${{ job.status }}
6 changes: 6 additions & 0 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
with:
fetch-depth: 0

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: "x64"

- name: Install Python Dependencies
run: poetry install -E plotting -E pydot -E pygraphviz -E econml --with docs

Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/docs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag'
description: "Release tag"
required: true
type: string

Expand All @@ -25,7 +25,13 @@ jobs:
with:
fetch-depth: 0

- name: Install Python Dependencies
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: "x64"

- name: Install Python Dependencies
run: poetry install -E plotting -E pydot -E pygraphviz -E econml --with docs

- run: git config --global --add safe.directory /__w/dowhy/dowhy
Expand All @@ -34,7 +40,7 @@ jobs:
run: ./docs/generate_docs.sh
env:
DOCS_VERSION: ${{ env.release_tag }}

- name: Commit and push to gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/docs.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note whoever is the owner of "ghcr.io/${{ github.repository_owner }}/dowhy-docs-generation:latest" needs to update the container to use Python3.8+

Preferably Python3.11, since that will future proof the CI and it's just doc building.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. @petergtz I remember you had set this up? can you update the python version as Adam suggests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adam2392 @amit-sharma Hey guys, the image referred to by Adam is built using the build-docker-image-docs.yml workflow. The Dockerfile it refers to is docs/Dockerfile.

This Dockerfile builds on top of another Docker image (ghcr.io/py-why/dowhy-example-notebooks-deps) where the actual installation of packages happens. You can find its Dockerfile in py-why/dowhy-example-notebooks-deps-dockerfile.

If you want to bump the Python version, it should probably happen there. I wouldn't know from the top of my mind how to do it though, as we're never explicitly specifying the Python version. Maybe using a newer Ubuntu base image could do, but unsure. Also have a look at the README, it says that the R dependencies are really difficult to control. Maybe you can delete all these dependencies now, because there is no R code anymore. Otherwise, you'll probably have to go through some trial and error.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "pyproject.toml"
- "poetry.lock"
workflow_run:
workflows: [ "Build Docker image (docs)" ]
workflows: ["Build Docker image (docs)"]
types:
- completed

Expand All @@ -24,6 +24,12 @@ jobs:
with:
fetch-depth: 0

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: "x64"

- name: Install Python Dependencies
run: poetry install -E plotting -E pydot -E pygraphviz -E econml --with docs

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
# TODO: Enable "3.12" when packages are updated
python-version: [3.9, "3.10", "3.11"]
poetry-version: [1.5.1]

steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
__pycache__/
*.py[cod]
*$py.class
*.DS_Store
*.vscode

# Distribution / packaging
.Python
Expand Down
2 changes: 1 addition & 1 deletion docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM ghcr.io/py-why/dowhy-example-notebooks-deps

RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install --yes --quiet curl
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
RUN curl -sSL https://install.python-poetry.org | python3.10 - --version 1.5.1
ENV PATH=$PATH:/root/.local/share/pypoetry/venv/bin

# Install Node for Documntation Tooling
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ repository = "https://github.com/py-why/dowhy"
classifiers = [
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
keywords = [
'causality',
Expand Down Expand Up @@ -52,8 +52,9 @@ files = ["dowhy/__init__.py"]
# Dependency compatibility notes:
# * numba (imported by econml) requires python <3.11
#
# * networkx has tight-integration with Python release schedule
[tool.poetry.dependencies]
python = ">=3.8,<3.12"
python = ">=3.9,<3.13"
cython = ">=0.29.32"
scipy = ">=1.4.1"
statsmodels = ">=0.13.5"
Expand Down
Loading