diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..0430273 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-docstring-first + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-yaml # checks for correct yaml syntax for github actions ex. + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.2.2 + hooks: + - id: ruff + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..77666c3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,57 @@ +[build-system] +requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "src/simulatedmicroscopy/_version.py" + +[tool.black] +line-length = 79 +target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] + +[tool.ruff] +line-length = 79 +select = [ + "E", "F", "W", #flake8 + "UP", # pyupgrade + "I", # isort + "BLE", # flake8-blind-exception + "B", # flake8-bugbear + "A", # flake8-builtins + "C4", # flake8-comprehensions + "ISC", # flake8-implicit-str-concat + "G", # flake8-logging-format + "PIE", # flake8-pie + "SIM", # flake8-simplify +] + +ignore = [ + "E501", + "E203", + "W503", +] + +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".mypy_cache", + ".pants.d", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv", + "*vendored*", + "*_vendor*", +] + +target-version = "py38" +fix = true diff --git a/setup.cfg b/setup.cfg index b844578..da8b4a3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,61 @@ -[flake8] -ignore=E501,E203,W503 \ No newline at end of file +[metadata] +name = simulatedmicroscopy + +description = Python package to create synthetic (fluorescence) microscopy images of (nano)particles and convolution with a point spread function +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/rhoitink/simulatedmicroscopy +author = Roy Hoitink +author_email = L.D.Hoitink@uu.nl +license = MIT +license_files = LICENSE +classifiers = + Development Status :: 4 - Beta + Intended Audience :: Science/Research + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + Topic :: Scientific/Engineering :: Image Processing +project_urls = + Bug Tracker = https://github.com/rhoitink/simulatedmicroscopy/issues + Documentation = https://github.com/rhoitink/simulatedmicroscopy#README.md + Source Code = https://github.com/rhoitink/simulatedmicroscopy + User Support = https://github.com/rhoitink/simulatedmicroscopy/issues + +[options] +packages = find: +install_requires = + numpy + matplotlib + h5py + scipy + scikit-image>=0.20.0 + +python_requires = >=3.8 +include_package_data = True +package_dir = + =src +setup_requires = setuptools_scm + +[options.packages.find] +where = src + +[options.extras_require] +dev = + black + flake8 + pytest + pytest-cov +docs = + mkdocs + mkdocs-material + mkdocstrings[python] + mkdocs-gen-files + mkdocs-literate-nav \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index de801b3..0000000 --- a/setup.py +++ /dev/null @@ -1,34 +0,0 @@ -from setuptools import setup, find_packages - -setup( - name="simulatedmicroscopy", - version="1.4.0", - author="Roy Hoitink", - author_email="L.D.Hoitink@uu.nl", - long_description=open("README.md").read(), - packages=find_packages(include=["simulatedmicroscopy", "simulatedmicroscopy.*"]), - python_requires=">=3.8", - install_requires=[ - "numpy", - "matplotlib", - "h5py", - "scipy", - "scikit-image>=0.20.0", - ], - extras_require={ - "dev": [ - "black", - "flake8", - "pytest", - "pytest-cov", - "bump2version", - ], - "docs": [ - "mkdocs", - "mkdocs-material", - "mkdocstrings[python]", - "mkdocs-gen-files", - "mkdocs-literate-nav", - ] - }, -) diff --git a/simulatedmicroscopy/__init__.py b/src/simulatedmicroscopy/__init__.py similarity index 78% rename from simulatedmicroscopy/__init__.py rename to src/simulatedmicroscopy/__init__.py index 9484a7c..c243d25 100644 --- a/simulatedmicroscopy/__init__.py +++ b/src/simulatedmicroscopy/__init__.py @@ -2,6 +2,10 @@ from .image import Image, HuygensImage from .psf import HuygensPSF, GaussianPSF from .particle import Sphere, Shell, PointParticle, Spherocylinder, Cube +try: + from ._version import version as __version__ +except ImportError: + __version__ = "unknown" __all__ = [ "Coordinates", @@ -14,6 +18,4 @@ "Shell", "Spherocylinder", "Cube", -] - -__version__ = "1.4.0" +] \ No newline at end of file diff --git a/src/simulatedmicroscopy/_version.py b/src/simulatedmicroscopy/_version.py new file mode 100644 index 0000000..081efef --- /dev/null +++ b/src/simulatedmicroscopy/_version.py @@ -0,0 +1,16 @@ +# file generated by setuptools_scm +# don't change, don't track in version control +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = '1.4.1.dev7+g5e7fa38.d20240219' +__version_tuple__ = version_tuple = (1, 4, 1, 'dev7', 'g5e7fa38.d20240219') diff --git a/simulatedmicroscopy/image.py b/src/simulatedmicroscopy/image.py similarity index 100% rename from simulatedmicroscopy/image.py rename to src/simulatedmicroscopy/image.py diff --git a/simulatedmicroscopy/input.py b/src/simulatedmicroscopy/input.py similarity index 100% rename from simulatedmicroscopy/input.py rename to src/simulatedmicroscopy/input.py diff --git a/simulatedmicroscopy/particle.py b/src/simulatedmicroscopy/particle.py similarity index 100% rename from simulatedmicroscopy/particle.py rename to src/simulatedmicroscopy/particle.py diff --git a/simulatedmicroscopy/psf.py b/src/simulatedmicroscopy/psf.py similarity index 100% rename from simulatedmicroscopy/psf.py rename to src/simulatedmicroscopy/psf.py