From bf34785cd6b76a00d51680f7ad966959910ca95d Mon Sep 17 00:00:00 2001 From: JLBegin Date: Sat, 19 Apr 2025 19:28:45 -0400 Subject: [PATCH 1/5] replace setup.py with pyproject --- README.md | 2 +- pyproject.toml | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ pytest.ini | 3 --- requirements.txt | 1 - setup.py | 57 -------------------------------------------- 5 files changed, 63 insertions(+), 62 deletions(-) create mode 100644 pyproject.toml delete mode 100644 pytest.ini delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/README.md b/README.md index 265ed932..5113f0a2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

Monte Carlo simulations of light transport made easy.

- +

This python package is an object-oriented implementation of Monte Carlo modeling for light transport in diffuse media. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..bb0a990c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,62 @@ +[build-system] +requires = ["setuptools>=77.0"] +build-backend = "setuptools.build_meta" + +[project.urls] +GitHub = "https://github.com/DCC-Lab/PyTissueOptics" + +[project] +name = "pytissueoptics" +version = "2.0.0b1" +description = "Python module for 3D Monte Carlo Simulation of Light Propagation" +readme = "README.md" +authors = [ + { name = "Ludovick Begin", email = "ludovick.begin@gmail.com" }, + { name = "Marc-Andre Vigneault", email = "marc-andre.vigneault.2@ulaval.ca" }, + { name = "Daniel Cote", email = "dccote@cervo.ulaval.ca" } +] +license = "MIT" +license-files = ["LICENSE"] +requires-python = ">=3.9" +dependencies = [ + "numpy>=2.0.0", + "matplotlib", + "tqdm", + "psutil", + "configobj", + "Pygments", + "siphash24; python_version < '3.13'", + "pyopencl", + "vtk>=9.4", + "mayavi-dev", + "pyqt5", +] + +[project.optional-dependencies] +dev = [ + "mockito", + "coverage", + "pytest", + "ruff", +] + +[tool.setuptools] +packages = ["pytissueoptics"] + +[tool.setuptools.package-data] +"pytissueoptics" = ["rayscattering/opencl/src/*.c", "**/*.obj", "examples/*.py"] + +[tool.pytest.ini_options] +testpaths = ["pytissueoptics"] +python_files = ["test*.py"] + +[tool.ruff] +line-length = 120 +target-version = "py39" + +[tool.ruff.lint] +select = ["ALL"] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 79206d20..00000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -testpaths = pytissueoptics -python_files = test*.py diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9c558e35..00000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -. diff --git a/setup.py b/setup.py deleted file mode 100644 index 1903f43c..00000000 --- a/setup.py +++ /dev/null @@ -1,57 +0,0 @@ -import setuptools - -""" -To distribute: -============= -rm dist/*; python setup.py sdist bdist_wheel; python -m twine upload dist/* -""" - -with open('README.md', 'r') as readme_file: - long_description = readme_file.read() - -setuptools.setup( - name="pytissueoptics", - version="2.0.0b1", - url="https://github.com/DCC-Lab/PyTissueOptics", - author=["Ludovick Begin", "Marc-Andre Vigneault", "Daniel Cote"], - author_email=["ludovick.begin@gmail.com", "marc-andre.vigneault.2@ulaval.ca", "dccote@cervo.ulaval.ca"], - description="Python module for 3D Monte Carlo Simulation of Light Propagation", - long_description=long_description, - long_description_content_type='text/markdown', - license='MIT', - keywords='tissue, optics, monte carlo, light propagation, simulation, scattering, ray tracing, 3D', - packages=setuptools.find_packages(), - install_requires=[ - 'numpy', - 'matplotlib', - 'tqdm', - 'mockito', - 'psutil', - 'configobj', - 'Pygments', - 'siphash24; python_version < "3.13"', - 'pyopencl', - 'traitsui', - 'vtk>=9.4', - 'mayavi-dev', - 'pyqt5', - ], - python_requires='>=3.9', - package_data={'pytissueoptics': ['rayscattering/opencl/src/*.c', '**/*.obj', 'examples/*.py']}, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Science/Research', - 'Intended Audience :: Education', - 'Topic :: Scientific/Engineering :: Physics', - 'Topic :: Scientific/Engineering :: Visualization', - 'Topic :: Education', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Programming Language :: Python :: 3.13', - 'Operating System :: OS Independent' - ], -) From b87b459e4128f606731a4185392db3aa0ca1dfce Mon Sep 17 00:00:00 2001 From: JLBegin Date: Sat, 19 Apr 2025 21:44:03 -0400 Subject: [PATCH 2/5] Update tests.yaml --- .github/workflows/tests.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b5dba491..2316f228 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,8 +42,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install setuptools>=40.8.0 wheel pytest - python -m pip install . + python -m pip install -e .[dev] python -m pip freeze --all - name: Validate OpenCL From 470cbcc482c062f0bfca3cd8afdaa64220572020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Vigneault?= Date: Sun, 20 Apr 2025 10:12:04 -0400 Subject: [PATCH 3/5] outdated installation guidelines --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5113f0a2..44c9611b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,14 @@ As discussed in the [why use this package](#why-use-this-package) section, compu - [Examples](#examples) ## Installation -Requires Python 3.6+ installed on the device. +Requires Python >=3.9 installed on the device. + +### Installing the latest release +> Currently, this `pip` version is outdated. We recommend installing the development version. +```shell +python -m pip install --upgrade pip +python -m pip install --upgrade pytissueoptics +``` ### Installing the development version 1. Clone the repository. @@ -39,14 +46,7 @@ Requires Python 3.6+ installed on the device. - On MacOS/Linux: `source venv/bin/activate`. - On Windows: `venv\Scripts\activate.bat`. 4. Upgrade `pip` with `pip install --upgrade pip`. -5. Install the package requirements with `pip install -r requirements.txt`. - -### Installing the previous release -> Currently, this `pip` version is outdated. We recommend installing the development version. -```shell -pip install --upgrade pip -pip install --upgrade pytissueoptics -``` +5. Install the package requirements with `python -m pip install -e .[dev]`. ## Getting started A command-line interface is available to help you run examples and tests. From 0eedb0fdeb0478b4bc730f39d1d4fe50f998d6b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Vigneault?= Date: Sun, 20 Apr 2025 10:47:34 -0400 Subject: [PATCH 4/5] auto versioning with setuptools-scm based on branch,number of commits and latest tag. --- pyproject.toml | 7 +++++-- pytissueoptics/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bb0a990c..8fd6c421 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=77.0"] +requires = ["setuptools>=77.0","setuptools_scm>=7"] build-backend = "setuptools.build_meta" [project.urls] @@ -7,7 +7,6 @@ GitHub = "https://github.com/DCC-Lab/PyTissueOptics" [project] name = "pytissueoptics" -version = "2.0.0b1" description = "Python module for 3D Monte Carlo Simulation of Light Propagation" readme = "README.md" authors = [ @@ -46,6 +45,10 @@ packages = ["pytissueoptics"] [tool.setuptools.package-data] "pytissueoptics" = ["rayscattering/opencl/src/*.c", "**/*.obj", "examples/*.py"] +[tool.setuptools_scm] +version_scheme = "guess-next-dev" +local_scheme = "node-and-date" + [tool.pytest.ini_options] testpaths = ["pytissueoptics"] python_files = ["test*.py"] diff --git a/pytissueoptics/__init__.py b/pytissueoptics/__init__.py index 47a54a43..93cba814 100644 --- a/pytissueoptics/__init__.py +++ b/pytissueoptics/__init__.py @@ -1,5 +1,5 @@ from .scene import * from .rayscattering import * +from importlib.metadata import version - -__version__ = "2.0.0b1" +__version__ = version("pytissueoptics") From ee66bdb694d60d42d938a98518dcfcbc64e49ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Vigneault?= Date: Sun, 20 Apr 2025 10:51:11 -0400 Subject: [PATCH 5/5] add dynamic version property to.pytoml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 8fd6c421..e439b238 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ authors = [ license = "MIT" license-files = ["LICENSE"] requires-python = ">=3.9" +dynamic = ["version"] dependencies = [ "numpy>=2.0.0", "matplotlib",