Skip to content

Commit 81dd31f

Browse files
committed
refresh github actions and use pyproject.toml
1 parent 5c63ee7 commit 81dd31f

File tree

7 files changed

+242
-205
lines changed

7 files changed

+242
-205
lines changed

.github/workflows/nightly.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
if: github.repository == 'pymc-devs/pytensor'
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1313
with:
1414
fetch-depth: 0
15-
- uses: actions/setup-python@v2
15+
- uses: actions/setup-python@v3
1616
with:
1717
python-version: "3.9"
1818
- name: Install dependencies

.github/workflows/pypi.yml

+26-7
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,47 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20+
# The job to build pypi wheels users can installed precompiled for them.
21+
# At the moment only linux wheels are build, Windows and MacOS will compile on installation
22+
# Before prebuilds all users had to compile code anyway.
2023
build:
24+
strategy:
25+
matrix:
26+
python-version: ["3.7", "3.8", "3.9", "3.10"]
2127
name: Build source distribution
2228
runs-on: ubuntu-latest
2329
steps:
24-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v3
2531
with:
2632
fetch-depth: 0
27-
- uses: actions/setup-python@v2
33+
- uses: actions/setup-python@v3
2834
with:
29-
python-version: "3.8"
35+
python-version: ${{ matrix.python-version }}
3036
- name: Build the sdist and the wheel
3137
run: |
32-
pip install wheel
33-
python setup.py sdist bdist_wheel
38+
pip install build
39+
python -m build
3440
- name: Check the sdist installs and imports
3541
run: |
3642
mkdir -p test-sdist
3743
cd test-sdist
3844
python -m venv venv-sdist
3945
venv-sdist/bin/python -m pip install ../dist/pytensor-*.tar.gz
46+
# check import
4047
venv-sdist/bin/python -c "import pytensor;print(pytensor.__version__)"
41-
- uses: actions/upload-artifact@v2
48+
# check import cython module
49+
venv-sdist/bin/python -c 'from pytensor.scan import scan_perform; print(scan_perform.get_version())'
50+
- name: Check the bdist installs and imports
51+
run: |
52+
mkdir -p test-bdist
53+
cd test-bdist
54+
python -m venv venv-bdist
55+
venv-bdist/bin/python -m pip install ../dist/pytensor-*.whl
56+
# check import
57+
venv-bdist/bin/python -c "import pytensor;print(pytensor.__version__)"
58+
# check import cython module
59+
venv-bdist/bin/python -c 'from pytensor.scan import scan_perform; print(scan_perform.get_version())'
60+
- uses: actions/upload-artifact@v3
4261
with:
4362
name: artifact
4463
path: dist/*
@@ -49,7 +68,7 @@ jobs:
4968
runs-on: ubuntu-latest
5069
if: github.event_name == 'release' && github.event.action == 'published'
5170
steps:
52-
- uses: actions/download-artifact@v2
71+
- uses: actions/download-artifact@v3
5372
with:
5473
name: artifact
5574
path: dist

.github/workflows/test.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
outputs:
2424
changes: ${{ steps.changes.outputs.src }}
2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
2727
with:
2828
fetch-depth: 0
2929
- uses: dorny/paths-filter@v2
@@ -52,7 +52,7 @@ jobs:
5252
runs-on: ubuntu-latest
5353
if: ${{ needs.changes.outputs.changes == 'true' }}
5454
steps:
55-
- uses: actions/checkout@v2
55+
- uses: actions/checkout@v3
5656
- uses: actions/setup-python@v2
5757
with:
5858
python-version: '3.9'
@@ -90,7 +90,7 @@ jobs:
9090
install-numba: 1
9191
part: "tests --ignore=tests/tensor/nnet --ignore=tests/tensor/signal"
9292
steps:
93-
- uses: actions/checkout@v2
93+
- uses: actions/checkout@v3
9494
with:
9595
fetch-depth: 0
9696
- name: Set up Python ${{ matrix.python-version }}
@@ -110,7 +110,7 @@ jobs:
110110
echo $MATRIX_CONTEXT
111111
export MATRIX_ID=`echo $MATRIX_CONTEXT | md5sum | cut -c 1-32`
112112
echo $MATRIX_ID
113-
echo "::set-output name=id::$MATRIX_ID"
113+
echo "id=$MATRIX_ID" >> $GITHUB_OUTPUT
114114
115115
- name: Install dependencies
116116
shell: bash -l {0}
@@ -143,7 +143,7 @@ jobs:
143143
FLOAT32: ${{ matrix.float32 }}
144144

145145
- name: Upload coverage file
146-
uses: actions/upload-artifact@v2
146+
uses: actions/upload-artifact@v3
147147
with:
148148
name: coverage
149149
path: coverage/coverage-${{ steps.matrix-id.outputs.id }}.xml
@@ -164,7 +164,7 @@ jobs:
164164
needs: [changes, all-checks]
165165
if: ${{ needs.changes.outputs.changes == 'true' && needs.all-checks.result == 'success' }}
166166
steps:
167-
- uses: actions/checkout@v2
167+
- uses: actions/checkout@v3
168168

169169
- name: Set up Python
170170
uses: actions/setup-python@v1

pyproject.toml

+208
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=48.0.0",
4+
"cython",
5+
"numpy>=1.17.0",
6+
"versioneer[toml]==0.28",
7+
]
8+
build-backend = "setuptools.build_meta"
9+
10+
[project]
11+
name = "pytensor"
12+
dynamic = [
13+
'version'
14+
]
15+
requires-python = ">=3.7"
16+
authors = [
17+
{name = "pymc-devs", email = "[email protected]"}
18+
]
19+
description = "Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs."
20+
readme = "DESCRIPTION.txt"
21+
license = {file = "LICENCE.txt"}
22+
classifiers = [
23+
"Development Status :: 6 - Mature",
24+
"Intended Audience :: Education",
25+
"Intended Audience :: Science/Research",
26+
"Intended Audience :: Developers",
27+
"License :: OSI Approved :: BSD License",
28+
"Programming Language :: Python",
29+
"Topic :: Software Development :: Code Generators",
30+
"Topic :: Software Development :: Compilers",
31+
"Topic :: Scientific/Engineering :: Mathematics",
32+
"Operating System :: Microsoft :: Windows",
33+
"Operating System :: POSIX",
34+
"Operating System :: Unix",
35+
"Operating System :: MacOS",
36+
"Programming Language :: Python :: 3",
37+
"Programming Language :: Python :: 3.7",
38+
"Programming Language :: Python :: 3.8",
39+
"Programming Language :: Python :: 3.9",
40+
"Programming Language :: Python :: 3.10",
41+
]
42+
43+
keywords = [
44+
"pytensor",
45+
"math",
46+
"numerical",
47+
"symbolic",
48+
"blas",
49+
"numpy",
50+
"autodiff",
51+
"differentiation",
52+
]
53+
dependencies = [
54+
"setuptools>=48.0.0",
55+
"scipy>=0.14",
56+
"numpy>=1.17.0",
57+
"filelock",
58+
"etuples",
59+
"logical-unification",
60+
"miniKanren",
61+
"cons",
62+
"typing_extensions",
63+
]
64+
65+
[project.urls]
66+
homepage = "https://github.com/pymc-devs/pytensor"
67+
repository = "https://github.com/pymc-devs/pytensor"
68+
documentation = "https://pytensor.readthedocs.io/en/latest/"
69+
70+
71+
[project.scripts]
72+
pytensor-cache = "bin.pytensor_cache:main"
73+
74+
[project.optional-dependencies]
75+
complete = [
76+
"pytensor[jax]",
77+
"pytensor[numba]",
78+
]
79+
development = [
80+
"pytensor[complete]",
81+
"pytensor[tests]",
82+
"pytensor[rtd]"
83+
]
84+
tests = [
85+
"pytest",
86+
"pre-commit",
87+
"pytest-cov>=2.6.1",
88+
"coverage>=5.1",
89+
]
90+
rtd = [
91+
"sphinx>=1.3.0",
92+
"sphinx_rtd_theme",
93+
"pygments",
94+
"pydot",
95+
"pydot2",
96+
"pydot-ng",
97+
]
98+
jax = [
99+
"jax",
100+
"jaxlib",
101+
]
102+
numba = [
103+
"numba>=0.55",
104+
"numba-scipy>=0.3.0"
105+
]
106+
107+
[tool.setuptools.packages.find]
108+
exclude = [
109+
"tests",
110+
"tests.*"
111+
]
112+
113+
[tool.setuptools.package-data]
114+
"*" = [
115+
"*.txt",
116+
"*.rst",
117+
"*.cu",
118+
"*.cuh",
119+
"*.c",
120+
"*.sh",
121+
"*.pkl",
122+
"*.h",
123+
"*.cpp",
124+
"ChangeLog",
125+
"c_code/*",
126+
]
127+
pytensor = [
128+
"py.typed"
129+
]
130+
"pytensor.misc" = [
131+
"*.sh"
132+
]
133+
"pytensor.d3viz" = [
134+
"html/*",
135+
"css/*",
136+
"js/*",
137+
]
138+
139+
[tool.coverage.run]
140+
omit = [
141+
"pytensor/_version.py",
142+
"tests/*",
143+
"pytensor/assert_op.py",
144+
"pytensor/graph/opt.py",
145+
"pytensor/graph/opt_utils.py",
146+
"pytensor/graph/optdb.py",
147+
"pytensor/graph/kanren.py",
148+
"pytensor/graph/unify.py",
149+
"pytensor/link/jax/jax_linker.py",
150+
"pytensor/link/jax/jax_dispatch.py",
151+
"pytensor/graph/toolbox.py",
152+
"pytensor/scalar/basic_scipy.py",
153+
]
154+
branch = true
155+
relative_files = true
156+
157+
[tool.coverage.report]
158+
omit = [
159+
"pytensor/_version.py",
160+
"tests/",
161+
]
162+
exclude_lines = [
163+
"pragma: no cover",
164+
"if TYPE_CHECKING:",
165+
]
166+
show_missing = true
167+
168+
[tool.versioneer]
169+
VCS = "git"
170+
style = "pep440"
171+
versionfile_source = "pytensor/_version.py"
172+
versionfile_build = "pytensor/_version.py"
173+
tag_prefix = "rel-"
174+
175+
[tool.pytest]
176+
addopts = "--durations=50"
177+
testpaths = "tests/"
178+
179+
[tool.pylint]
180+
max-line-length = 88
181+
182+
[tool.pylint.messages_control]
183+
disable = ["C0330", "C0326"]
184+
185+
[tool.isort]
186+
profile = "black"
187+
lines_after_imports = 2
188+
lines_between_sections = 1
189+
honor_noqa = true
190+
skip_gitignore = true
191+
skip = "pytensor/version.py"
192+
skip_glob = "**/*.pyx"
193+
194+
[tool.mypy]
195+
ignore_missing_imports = true
196+
no_implicit_optional = true
197+
check_untyped_defs = false
198+
strict_equality = true
199+
warn_redundant_casts = true
200+
warn_unused_configs = true
201+
warn_unused_ignores = true
202+
warn_return_any = true
203+
warn_no_return = false
204+
warn_unreachable = true
205+
show_error_codes = true
206+
allow_redefinition = false
207+
files = ["pytensor", "tests"]
208+
plugins = ["numpy.typing.mypy_plugin"]

requirements-rtd.txt

-12
This file was deleted.

requirements.txt

-21
This file was deleted.

0 commit comments

Comments
 (0)