Skip to content

Commit e0b6477

Browse files
authored
Merge pull request #735 from stan-dev/setup/move-to-pyproject
Move to pyproject.toml setup, deduplicate dependencies
2 parents b420952 + 0db1a27 commit e0b6477

File tree

10 files changed

+84
-149
lines changed

10 files changed

+84
-149
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,16 @@ jobs:
5656
with:
5757
python-version: ${{ matrix.python-version }}
5858

59-
- name: Install dependencies (python)
59+
- name: Install dependencies
60+
run: python -m pip install --upgrade pip wheel build
61+
62+
- name: Build package
6063
run: |
61-
python -m pip install --upgrade pip wheel build
62-
pip install -r requirements.txt
63-
pip install -r requirements-test.txt
64-
pip install codecov
64+
python -m build
65+
python -m pip install .[test]
66+
67+
- name: Show libraries
68+
run: python -m pip freeze
6569

6670
- name: Run flake8, pylint, mypy
6771
if: matrix.python-version == '3.11'
@@ -70,22 +74,6 @@ jobs:
7074
pylint -v cmdstanpy test
7175
mypy cmdstanpy
7276
73-
- name: Build wheel
74-
run: python -m build
75-
76-
- name: Install wheel (Linux, macOS)
77-
if: matrix.os != 'windows-latest'
78-
run: pip install dist/*.whl
79-
80-
- name: Install wheel (Windows)
81-
if: matrix.os == 'windows-latest'
82-
run: |
83-
$whl = Get-ChildItem -Path dist -Filter *.whl | Select-Object -First 1
84-
pip install "$whl"
85-
86-
- name: Show libraries
87-
run: python -m pip freeze
88-
8977
- name: CmdStan installation cacheing
9078
id: cache-cmdstan
9179
if: ${{ !startswith(needs.get-cmdstan-version.outputs.version, 'git:') }}
@@ -118,13 +106,8 @@ jobs:
118106
cd run_tests
119107
pytest -v ../test --cov=../cmdstanpy
120108
121-
- name: Run model with requirements-optional.txt
122-
run: |
123-
cd run_tests
124-
python -m pip install -r ../requirements-optional.txt
125-
python ../test/example_script.py
126-
127109
- name: Submit codecov
128110
run: |
111+
pip install codecov
129112
cd run_tests
130113
codecov

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ jobs:
3232
3333
- name: Install dependencies (python)
3434
run: |
35-
python -m pip install --upgrade pip wheel twine codecov "sphinx>5,<6" nbsphinx ipython ipykernel "pydata-sphinx-theme<0.9" requests sphinx-copybutton xarray matplotlib
36-
pip install -r requirements.txt
37-
pip install -e .
35+
python -m pip install --upgrade pip wheel build twine requests
36+
pip install -e .[doc,test]
3837
3938
- name: Install CmdStan
4039
run: |
@@ -80,7 +79,7 @@ jobs:
8079
git push -f origin master
8180
8281
- name: Build wheel
83-
run: python setup.py sdist bdist_wheel
82+
run: python -m build
8483

8584
- name: Install bdist_wheel
8685
run: pip install dist/*.whl

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ repos:
2323
rev: v1.5.0
2424
hooks:
2525
- id: mypy
26-
# Copied from setup.cfg
2726
exclude: ^test/
2827
additional_dependencies: [ numpy >= 1.22]
2928
# local uses the user-installed pylint, this allows dependency checking

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# This file is used to include extra files in source distributions.
2-
# (Source distributions are generated by running `python setup.py sdist`.)
32

4-
include requirements*.txt
53
include LICENSE.md
64
include cmdstanpy/py.typed

docsrc/env.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@ channels:
55
dependencies:
66
- python=3.9
77
- ipykernel
8-
- ipython
9-
- ipywidgets
10-
- numpy>=1.15
8+
- numpy
119
- pandas
1210
- xarray
13-
- sphinx>5,<6
14-
- nbsphinx
15-
- pydata-sphinx-theme>0.7,<0.9
16-
- sphinx-copybutton
1711
- matplotlib-base
1812
- pip
1913
- cmdstan
2014
- tqdm
2115
- pip:
22-
- -e ../
16+
- -e ../.[docs]

pyproject.toml

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "cmdstanpy"
7+
description = "Python interface to CmdStan"
8+
readme = "README.md"
9+
license = { text = "BSD-3-Clause" }
10+
authors = [{ name = "Stan Dev Team" }]
11+
requires-python = ">=3.8"
12+
dependencies = ["pandas", "numpy>=1.21", "tqdm", "stanio>=0.4.0,<2.0.0"]
13+
dynamic = ["version"]
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
"License :: OSI Approved :: BSD License",
17+
"Operating System :: OS Independent",
18+
"Development Status :: 5 - Production/Stable",
19+
"Intended Audience :: Science/Research",
20+
"Natural Language :: English",
21+
"Programming Language :: Python",
22+
"Topic :: Scientific/Engineering :: Information Analysis",
23+
]
24+
25+
[project.urls]
26+
"Homepage" = "https://github.com/stan-dev/cmdstanpy"
27+
"Bug Tracker" = "https://github.com/stan-dev/cmdstanpy/issues"
28+
29+
[project.scripts]
30+
install_cmdstan = "cmdstanpy.install_cmdstan:__main__"
31+
install_cxx_toolchain = "cmdstanpy.install_cxx_toolchain:__main__"
32+
33+
[tool.setuptools.dynamic]
34+
version = { attr = "cmdstanpy._version.__version__" }
35+
36+
[tool.setuptools]
37+
packages = ["cmdstanpy", "cmdstanpy.stanfit", "cmdstanpy.utils"]
38+
39+
[tool.setuptools.package-data]
40+
"cmdstanpy" = ["py.typed"]
41+
42+
[project.optional-dependencies]
43+
all = ["xarray"]
44+
test = [
45+
"flake8",
46+
"pylint",
47+
"pytest",
48+
"pytest-cov",
49+
"pytest-order",
50+
"mypy",
51+
"xarray",
52+
]
53+
docs = [
54+
"sphinx>5,<6",
55+
"pydata-sphinx-theme<0.9",
56+
"nbsphinx",
57+
"ipython",
58+
"ipykernel",
59+
"ipywidgets",
60+
"sphinx-copybutton",
61+
"xarray",
62+
"matplotlib",
63+
]
64+
65+
166
[tool.black]
267
line-length = 80
368
skip-string-normalization = true
@@ -23,8 +88,8 @@ strict_equality = true
2388
disallow_untyped_calls = true
2489

2590
[[tool.mypy.overrides]]
26-
module = [
27-
'tqdm.auto',
28-
'pandas',
29-
]
91+
module = ['tqdm.auto', 'pandas']
3092
ignore_missing_imports = true
93+
94+
[tool.coverage.run]
95+
source = ["cmdstanpy"]

requirements-optional.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements-test.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)