Skip to content

Commit

Permalink
remove setup.py, replacing it with pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
grlee77 committed Oct 24, 2023
1 parent 209dfc3 commit dc02f8a
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 239 deletions.
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ repos:
hooks:
- id: isort
files: ^python/cucim/src/.*
args: ["--settings-path=python/cucim/pyproject_.toml"]
args: ["--settings-path=python/cucim/pyproject.toml"]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
files: (python|legate)/.*
args: ["--config", "python/cucim/pyproject_.toml"]
args: ["--config", "python/cucim/pyproject.toml"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
hooks:
- id: ruff
files: python/.*$
args: ["--exclude", "__init__.py"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: ["--toml", "python/cucim/pyproject_.toml"]
args: ["--toml", "python/cucim/pyproject.toml"]
additional_dependencies:
- tomli
2 changes: 1 addition & 1 deletion conda/recipes/cucim/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ cp -P python/install/lib/* python/cucim/src/cucim/clara/
pushd python/cucim

echo "PYTHON: ${PYTHON}"
$PYTHON setup.py install
$PYTHON -m pip install .

popd
241 changes: 241 additions & 0 deletions python/cucim/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
# See file LICENSE for terms.

[build-system]
build-backend = "setuptools.build_meta"
# TODO: generate this list with `rapids-dependency-file-generator`
requires = [
"setuptools>=24.2.0",
"wheel",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.

[project]
name = "cucim"
version = "23.12.00"
description = "cuCIM - an extensible toolkit designed to provide GPU accelerated I/O, computer vision & image processing primitives for N-Dimensional images with a focus on biomedical imaging."
# TODO: tried also adding CHANGELOG.md as in setup.py's long_description, but ruff complained about it
readme = { file = "README.md", content-type = "text/markdown" }
# readme = [
# { file = "README.md", content-type = "text/markdown" },
# { file = "CHANGELOG.md", content-type = "text/markdown" },
# ]
authors = [
{ name = "NVIDIA Corporation" },
]
license = { text = "Apache 2.0" }
requires-python = ">=3.8"
#TODO: add dependencies.yaml and generate this by `rapids-dependency-file-generator` instead
dependencies = [
"click",
"numpy",
"lazy_loader>=0.1",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Intended Audience :: Healthcare Industry",
"Topic :: Scientific/Engineering",
"Operating System :: POSIX :: Linux",
"Environment :: Console",
"Environment :: GPU :: NVIDIA CUDA :: 11.0",
"Environment :: GPU :: NVIDIA CUDA :: 12.0",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: C++",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]

[project.urls]
Homepage = "https://developer.nvidia.com/multidimensional-image-processing"
Documentation = "https://docs.rapids.ai/api/cucim/stable/"
Changelog = "https://github.com/rapidsai/cucim/blob/branch-23.12/CHANGELOG.md"
Source = "https://github.com/rapidsai/cucim"
Tracker = "https://github.com/rapidsai/cucim/issues"

[project.optional-dependencies]
test = [
"cupy-cuda11x>=12.0.0",
"scipy",
"scikit-image>=0.19",
"pytest",
"pytest-lazy-fixture",
"gputil",
"openslide-python",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
developer = [
"black",
"isort",
"pre-commit",
"ruff",
]
docs = [
"Sphinx==4.5.0",
"sphinx-autobuild",
"sphinx-book-theme",
"sphinxcontrib-bibtex<2.0.0", # https://github.com/executablebooks/jupyter-book/issues/1137
"sphinx-copybutton",
"sphinx-panels",
"sphinx-thebe",
"sphinx-togglebutton",
"sphinxemoji",
"ablog",
"docutils==0.16", # 0.17 causes error. https://github.com/executablebooks/MyST-Parser/issues/343
"pydata_sphinx_theme",
"myst-parser",
"myst-nb",
"ipywidgets",
"nbclient",
"plotly<5",
"pandas",
"matplotlib",
"cupy-cuda110",
"numpy",
"scipy",
"scikit-image",
]

[project.entry-points."console_scripts"]
cucim = "cucim.clara.cli:main"

[tool.setuptools]
license-files = ["LICENSE"]
# By default, include-package-data is true in pyproject.toml, so you do
# NOT have to specify this line.
include-package-data = true

[tool.setuptools.packages.find]
where = ["src/cucim"]

[tool.setuptools.package-data]
mypkg = ["*.pyi", "*.h", "*.cu"]

[tool.isort]
profile = "black"
force_single_line = false
line_length = 80
forced_separate = "test_cucim"
force_grid_wrap = 0
multi_line_output = 3
order_by_type = true
combine_as_imports = true
include_trailing_comma = true
known_first_party = [
"cucim",
]
default_section = "THIRDPARTY"
sections = [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER",
]
skip = [
"3rdparty",
"thirdparty",
".eggs",
".git",
".hg",
".mypy_cache",
".tox",
".venv",
"ci",
"cpp",
"_build",
"build",
"build-debug",
"build-release",
"_deps",
"dist",
]

[tool.pytest.ini_options]
# If a pytest section is found in one of the possible config files
# (pytest.ini, tox.ini or setup.cfg), then pytest will not look for any others,
# so if you add a pytest config section elsewhere,
# you will need to delete this section from setup.cfg.
norecursedirs = "migrations"
python_files = [
"test_*.py",
"*_test.py",
"tests.py",
]
addopts = [
"-ra",
"--strict-markers",
# --doctest-modules",
# --doctest-glob=\*.rst",
"--tb=short",
"--ignore-glob=build*",
]
testpaths = [
"src",
"tests",
]

[tool.ruff]
# see: https://docs.astral.sh/ruff/rules/
select = ["E", "F", "W"]
fixable = ["ALL"]
exclude = [
# TODO: Remove this in a follow-up where we fix __all__.
".tox",
".eggs",
"ci/templates",
"build",
"dist",
".git",
"__pycache__",
"doc/conf.py",
"doc/sphinxext",
"__init__.py",
]
line-length = 80

[tool.ruff.per-file-ignores]
# "src/cucim/skimage/util/tests/test_shape.py" = ["E201", "E202"]

[tool.black]
line-length = 80
target-version = ["py39"]
include = '\.py?$'
exclude = '''
/(
3rdparty |
thirdparty |
\.eggs |
\.git |
\.hg |
\.mypy_cache |
\.tox |
\.venv |
_build |
_deps |
cpp |
ci |
build |
build-debug |
build-release |
dist |
docker |
docs |
)/
'''

[tool.codespell]
# note: pre-commit passes explicit lists of files here, which this skip file list doesn't override -
# this is only to allow you to run codespell interactively
# e.g. via
# codespell --toml python/cucim/pyproject.toml . -i 3 -w
skip = "build*,dist,.cache,html,_build,_deps,3rdparty,_static,generated,latex,.git,*.ipynb,test_data/input/LICENSE-3rdparty,jitify_testing"
# ignore-regex = ""
ignore-words-list = "ans,coo,boun,bui,gool,hart,lond,nd,paeth,unser,wronly"
quiet-level = 3

# to undo: ./test_data/input/LICENSE-3rdparty
Loading

0 comments on commit dc02f8a

Please sign in to comment.