Skip to content

Commit

Permalink
feature: package and publish xplique-cpu in addition to xplique
Browse files Browse the repository at this point in the history
  • Loading branch information
schmatzler-jona committed Jan 9, 2025
1 parent 777936f commit bde7a55
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ jobs:
TWINE_PASSWORD: ${{ secrets.XPLIQUE_TOKEN }}
run: |
python setup.py sdist bdist_wheel
python setup.py sdist bdist_wheel --cpu
twine upload dist/*
6 changes: 4 additions & 2 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox (Python ${{ matrix.python-version }} - TF ${{ matrix.tf-version }})
run: tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }} | tr -d .)
- name: Test with tox (Python ${{ matrix.python-version }} - TF ${{ matrix.tf-version }}(-cpu))
run: |
tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }} | tr -d .)
tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }}-cpu | tr -d .)
8 changes: 8 additions & 0 deletions requirements_cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
numpy<2.0.0
tensorflow-cpu>=2.1.0
scikit-learn
scikit-image
matplotlib
scipy
opencv-python
deprecated
28 changes: 20 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tag = False
[bumpversion:file:xplique/__init__.py]

[pylint]
disable =
disable =
R0903, # allows to expose only one public method
R0914, # allow multiples local variables
E0401, # pending issue with pylint see pylint#2603
Expand All @@ -30,29 +30,41 @@ ignore-imports = no
ignore-signatures = yes

[tox:tox]
envlist = py{37,38,39,310}-lint, py{37,38,39,310}-tf{22,25,28,211}, py{38,39,310}-tf{25,28,211}-torch{111,113,200}
envlist = py{37,38,39,310}-lint, py{37,38,39,310}-tf{22,25,28,211}, py{37,38,39,310}-tf{22,25,28,211}-cpu, py{38,39,310}-tf{25,28,211}-torch{111,113,200}

[testenv:py{37,38,39,310}-lint]
deps =
deps =
pylint
-rrequirements.txt
commands =
commands =
python -m pylint xplique

[testenv:py{37,38,39,310}-tf{22,25,28,211}]
deps =
deps =
pytest
pytest-cov
tf21: tensorflow ~= 2.2.0,<2.16
tf25: tensorflow ~= 2.5.0,<2.16
tf28: tensorflow ~= 2.8.0,<2.16
tf211: tensorflow ~= 2.11.0,<2.16
-rrequirements.txt
commands =
commands =
pytest --cov=xplique --ignore=xplique/wrappers/pytorch.py --ignore=tests/wrappers/test_pytorch_wrapper.py --ignore=tests/concepts/test_craft_torch.py --ignore=tests/example_based/test_torch.py {posargs}

[testenv:py{37,38,39,310}-tf{22,25,28,211}-cpu]
deps =
pytest
pytest-cov
tf21: tensorflow-cpu ~= 2.2.0,<2.16
tf25: tensorflow-cpu ~= 2.5.0,<2.16
tf28: tensorflow-cpu ~= 2.8.0,<2.16
tf211: tensorflow-cpu ~= 2.11.0,<2.16
-rrequirements_cpu.txt
commands =
pytest --cov=xplique --ignore=xplique/wrappers/pytorch.py --ignore=tests/wrappers/test_pytorch_wrapper.py --ignore=tests/concepts/test_craft_torch.py --ignore=tests/example_based/test_torch.py {posargs}

[testenv:py{38,39,310}-tf{25,28,211}-torch{111,113,200}]
deps =
deps =
pytest
pytest-cov
tf25: tensorflow ~= 2.5.0,<2.16
Expand All @@ -62,7 +74,7 @@ deps =
torch113: torch == 1.13.0
torch200: torch
-rrequirements.txt
commands =
commands =
pytest --cov=xplique/wrappers/pytorch tests/wrappers/test_pytorch_wrapper.py tests/concepts/test_craft_torch.py tests/example_based/test_torch.py

[mypy]
Expand Down
26 changes: 23 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
from setuptools import setup, find_packages
import sys

INSTALL_REQUIRES = [
'numpy<2.0.0',
'scikit-learn',
'scikit-image',
'matplotlib',
'scipy',
'opencv-python',
'deprecated'
]
TENSORFLOW_VERSION = '>=2.1.0,<2.16.0'
PACKAGE_NAME = "Xplique"

if "--cpu" in sys.argv:
INSTALL_REQUIRES.append('tensorflow-cpu' + TENSORFLOW_VERSION)
PACKAGE_NAME += "-cpu"
sys.argv.remove('--cpu')
else:
INSTALL_REQUIRES.append('tensorflow' + TENSORFLOW_VERSION)


with open("README.md", encoding="utf-8") as fh:
README = fh.read()

setup(
name="Xplique",
name=PACKAGE_NAME,
version="1.4.0",
description="Explanations toolbox for Tensorflow 2",
long_description=README,
long_description_content_type="text/markdown",
author="Thomas FEL",
author_email="[email protected]",
license="MIT",
install_requires=['numpy<2.0.0', 'tensorflow>=2.1.0,<2.16.0', 'scikit-learn', 'scikit-image',
'matplotlib', 'scipy', 'opencv-python', 'deprecated'],
install_requires=INSTALL_REQUIRES,
extras_require={
"tests": ["pytest", "pylint"],
"docs": ["mkdocs", "mkdocs-material", "numkdoc"],
Expand Down

0 comments on commit bde7a55

Please sign in to comment.