forked from py-why/dowhy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Poetry for Managing Dependencies, Tasks, and Package Builds (py-w…
…hy#584) * replace legacy build and dependency systems with poetry Signed-off-by: Chris Trevino <[email protected]> * remove style=semver config Signed-off-by: Chris Trevino <[email protected]> * update pip install of poetry-dynamic-versioning Signed-off-by: Chris Trevino <[email protected]> * pin llvmlite to version used by causalml; update python range accordingly Signed-off-by: Chris Trevino <[email protected]> * add note about networkx requirement; remove pandas-stubs, pytest-xdist for futures PRs Signed-off-by: Chris Trevino <[email protected]> * update poetry.lock Signed-off-by: Chris Trevino <[email protected]> * remove import from _version Signed-off-by: Chris Trevino <[email protected]> * PR comments Signed-off-by: Chris Trevino <[email protected]> * move sphinx, sphinxscontrib-googleanalytics to poetry Signed-off-by: Chris Trevino <[email protected]> * add some missing Sphinx dependencies; ignore generated documentation path Signed-off-by: Chris Trevino <[email protected]> * add pandoc dependency for documentation generation Signed-off-by: Chris Trevino <[email protected]> * add rpy2 to build-and-publish-docs action Signed-off-by: Chris Trevino <[email protected]> * add cuda, r dependencies Signed-off-by: Chris Trevino <[email protected]> * use the original image for the docs build Signed-off-by: Chris Trevino <[email protected]> * use updated docker image for generating docs Signed-off-by: Chris Trevino <[email protected]> * move documentation dependencies into poetry as 'docs' optional Signed-off-by: Chris Trevino <[email protected]> Signed-off-by: Chris Trevino <[email protected]>
- Loading branch information
1 parent
eba2c1c
commit 2b4832a
Showing
21 changed files
with
4,746 additions
and
2,996 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
max-line-length = 127 | ||
max-complexity = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
|
||
name: DoWhy CI | ||
|
||
on: | ||
|
@@ -12,39 +10,45 @@ on: | |
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9] | ||
python-version: [3.8, 3.9] | ||
poetry-version: [1.1.14] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
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 Dynamic Versioning Plugin | ||
run: pip install poetry-dynamic-versioning | ||
|
||
- name: Install graphviz | ||
run: | | ||
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
if [ -f requirements-plotting.txt ]; then pip install -r requirements-plotting.txt; fi | ||
pip install 'scikit-learn==1.0.2' --force-reinstall | ||
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt --use-deprecated=legacy-resolver; fi | ||
pip install 'numpy<=1.21' --force-reinstall | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest -v -m "not advanced" | ||
- name: Check package consistency with twine | ||
echo "installing poetry dependencies" | ||
poetry install -E plotting -E causalml | ||
- name: Lint | ||
run: poetry run poe lint | ||
|
||
- name: Test | ||
run: poetry run poe test | ||
|
||
- name: Check package consistency | ||
run: | | ||
python setup.py check sdist bdist_wheel | ||
twine check dist/* | ||
poetry build | ||
poetry run poe verifyPackage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,18 +14,28 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
python-version: '3.8' | ||
|
||
- name: Install Poetry 1.1.14 | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: '1.1.14' | ||
|
||
- name: Install Poetry Dynamic Versioning Plugin | ||
run: pip install poetry-dynamic-versioning | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
run: poetry install | ||
|
||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* | ||
poetry-dynamic-versioning | ||
poetry build | ||
poetry run poe uploadPackage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# This dockerfile was used to generate darthtrevino/dowhy-docs, used in the | ||
# build-and-publish-docs.yml workflow | ||
# | ||
FROM pego/dowhy-examples-notebooks-deps | ||
|
||
RUN DEBIAN_FRONTEND=noninteractive apt install --yes --quiet curl | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
ENV PATH=$PATH:/root/.local/share/pypoetry/venv/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
sphinx-apidoc -f -o source ../dowhy | ||
#!/bin/bash -ex | ||
|
||
cd $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
poetry run sphinx-apidoc -f -o source ../dowhy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import logging | ||
from dowhy.causal_model import CausalModel | ||
from . import _version | ||
|
||
logging.getLogger(__name__).addHandler(logging.NullHandler()) | ||
|
||
__version__ = _version.get_versions()["version"] | ||
# | ||
# 0.0.0 is standard placeholder for poetry-dynamic-versioning | ||
# any changes to this should not be checked in | ||
# | ||
__version__ = "0.0.0" |
Oops, something went wrong.