Skip to content

Commit

Permalink
Merge pull request #735 from stan-dev/setup/move-to-pyproject
Browse files Browse the repository at this point in the history
Move to pyproject.toml setup, deduplicate dependencies
  • Loading branch information
WardBrian authored Mar 21, 2024
2 parents b420952 + 0db1a27 commit e0b6477
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 149 deletions.
37 changes: 10 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies (python)
- name: Install dependencies
run: python -m pip install --upgrade pip wheel build

- name: Build package
run: |
python -m pip install --upgrade pip wheel build
pip install -r requirements.txt
pip install -r requirements-test.txt
pip install codecov
python -m build
python -m pip install .[test]
- name: Show libraries
run: python -m pip freeze

- name: Run flake8, pylint, mypy
if: matrix.python-version == '3.11'
Expand All @@ -70,22 +74,6 @@ jobs:
pylint -v cmdstanpy test
mypy cmdstanpy
- name: Build wheel
run: python -m build

- name: Install wheel (Linux, macOS)
if: matrix.os != 'windows-latest'
run: pip install dist/*.whl

- name: Install wheel (Windows)
if: matrix.os == 'windows-latest'
run: |
$whl = Get-ChildItem -Path dist -Filter *.whl | Select-Object -First 1
pip install "$whl"
- name: Show libraries
run: python -m pip freeze

- name: CmdStan installation cacheing
id: cache-cmdstan
if: ${{ !startswith(needs.get-cmdstan-version.outputs.version, 'git:') }}
Expand Down Expand Up @@ -118,13 +106,8 @@ jobs:
cd run_tests
pytest -v ../test --cov=../cmdstanpy
- name: Run model with requirements-optional.txt
run: |
cd run_tests
python -m pip install -r ../requirements-optional.txt
python ../test/example_script.py
- name: Submit codecov
run: |
pip install codecov
cd run_tests
codecov
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ jobs:
- name: Install dependencies (python)
run: |
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
pip install -r requirements.txt
pip install -e .
python -m pip install --upgrade pip wheel build twine requests
pip install -e .[doc,test]
- name: Install CmdStan
run: |
Expand Down Expand Up @@ -80,7 +79,7 @@ jobs:
git push -f origin master
- name: Build wheel
run: python setup.py sdist bdist_wheel
run: python -m build

- name: Install bdist_wheel
run: pip install dist/*.whl
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ repos:
rev: v1.5.0
hooks:
- id: mypy
# Copied from setup.cfg
exclude: ^test/
additional_dependencies: [ numpy >= 1.22]
# local uses the user-installed pylint, this allows dependency checking
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This file is used to include extra files in source distributions.
# (Source distributions are generated by running `python setup.py sdist`.)

include requirements*.txt
include LICENSE.md
include cmdstanpy/py.typed
10 changes: 2 additions & 8 deletions docsrc/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ channels:
dependencies:
- python=3.9
- ipykernel
- ipython
- ipywidgets
- numpy>=1.15
- numpy
- pandas
- xarray
- sphinx>5,<6
- nbsphinx
- pydata-sphinx-theme>0.7,<0.9
- sphinx-copybutton
- matplotlib-base
- pip
- cmdstan
- tqdm
- pip:
- -e ../
- -e ../.[docs]
73 changes: 69 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "cmdstanpy"
description = "Python interface to CmdStan"
readme = "README.md"
license = { text = "BSD-3-Clause" }
authors = [{ name = "Stan Dev Team" }]
requires-python = ">=3.8"
dependencies = ["pandas", "numpy>=1.21", "tqdm", "stanio>=0.4.0,<2.0.0"]
dynamic = ["version"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Information Analysis",
]

[project.urls]
"Homepage" = "https://github.com/stan-dev/cmdstanpy"
"Bug Tracker" = "https://github.com/stan-dev/cmdstanpy/issues"

[project.scripts]
install_cmdstan = "cmdstanpy.install_cmdstan:__main__"
install_cxx_toolchain = "cmdstanpy.install_cxx_toolchain:__main__"

[tool.setuptools.dynamic]
version = { attr = "cmdstanpy._version.__version__" }

[tool.setuptools]
packages = ["cmdstanpy", "cmdstanpy.stanfit", "cmdstanpy.utils"]

[tool.setuptools.package-data]
"cmdstanpy" = ["py.typed"]

[project.optional-dependencies]
all = ["xarray"]
test = [
"flake8",
"pylint",
"pytest",
"pytest-cov",
"pytest-order",
"mypy",
"xarray",
]
docs = [
"sphinx>5,<6",
"pydata-sphinx-theme<0.9",
"nbsphinx",
"ipython",
"ipykernel",
"ipywidgets",
"sphinx-copybutton",
"xarray",
"matplotlib",
]


[tool.black]
line-length = 80
skip-string-normalization = true
Expand All @@ -23,8 +88,8 @@ strict_equality = true
disallow_untyped_calls = true

[[tool.mypy.overrides]]
module = [
'tqdm.auto',
'pandas',
]
module = ['tqdm.auto', 'pandas']
ignore_missing_imports = true

[tool.coverage.run]
source = ["cmdstanpy"]
1 change: 0 additions & 1 deletion requirements-optional.txt

This file was deleted.

8 changes: 0 additions & 8 deletions requirements-test.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

90 changes: 0 additions & 90 deletions setup.py

This file was deleted.

0 comments on commit e0b6477

Please sign in to comment.