Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize #151

Merged
merged 6 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ docs/build/

# coverage.py files
.coverage

# Virtual environments
.venv
15 changes: 10 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@ exclude: "docs"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort

- repo: https://gitlab.com/pycqa/flake8
rev: 5.0.4
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
args: ["--config=setup.cfg"]

- repo: https://github.com/crate-ci/typos
rev: v1.24.5
hooks:
- id: typos
2 changes: 1 addition & 1 deletion nrrd/tests/test_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def test_quoted_string_list_header(self):
# Strip newline from end of line
lines = [line.rstrip() for line in lines]

# Note the order of the lines dont matter, we just want to verify theyre outputted correctly
# Note the order of the lines dont matter, we just want to verify they are outputted correctly
self.assertTrue('units: "mm" "cm" "in"' in lines)
self.assertTrue('space units: "mm" "cm" "in"' in lines)
self.assertTrue('labels: "X" "Y" "f(log(X, 10), Y)"' in lines)
Expand Down
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "pynrrd"
dynamic = ["version"]
description = "Pure python module for reading and writing NRRD files."
readme = { file = "README.txt", content-type = "text/x-rst" }
requires-python = ">=3.7"
license = { text = "MIT License" }
authors = [{ name = "Maarten Everts", email = "[email protected]" }]
keywords = ["nrrd", "teem", "image", "processing", "file", "format"]
classifiers = [
"License :: OSI Approved :: MIT License",
"Topic :: Scientific/Engineering",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]

dependencies = ["numpy >=1.11.1", "nptyping", "typing_extensions"]

[project.optional-dependencies]
dev = ["build", "pre-commit", "pytest"]

[project.urls]
Homepage = "https://github.com/mhe/pynrrd"
Tracker = "https://github.com/mhe/pynrrd/issues"
addisonElliott marked this conversation as resolved.
Show resolved Hide resolved

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

[tool.setuptools.packages]
find = { exclude = ["*.tests", "*.tests.*", "tests.*", "tests"] }
6 changes: 0 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
[bdist_wheel]
# This flag says that the code is written to work on both Python 2 and Python
# 3. If at all possible, it is good practice to do this. If you cannot, you
# will need to generate wheels for each Python version that you support.
universal=1

[flake8]
max-line-length = 120
ignore =
Expand Down
45 changes: 3 additions & 42 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,5 @@
import os
from setuptools import setup

from setuptools import find_packages, setup

currentPath = os.path.abspath(os.path.dirname(__file__))

# Get __version__ from _version.py
__version__ = None
with open(os.path.join(currentPath, 'nrrd/_version.py')) as fh:
exec(fh.read())

# Get the long description from the README file
with open(os.path.join(currentPath, 'README.rst')) as fh:
longDescription = fh.read()

longDescription = '\n' + longDescription

setup(name='pynrrd',
python_requires='>=3.7',
version=__version__,
description='Pure python module for reading and writing NRRD files.',
long_description=longDescription,
long_description_content_type='text/x-rst',
author='Maarten Everts',
author_email='[email protected]',
url='https://github.com/mhe/pynrrd',
license='MIT License',
install_requires=['numpy>=1.11.1', 'nptyping', 'typing_extensions'],
packages=find_packages(exclude=['*.tests', '*.tests.*', 'tests.*', 'tests']),
keywords='nrrd teem image processing file format',
classifiers=[
'License :: OSI Approved :: MIT License',
'Topic :: Scientific/Engineering',
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
project_urls={
'Tracker': 'https://github.com/mhe/pynrrd/issues',
}
)
if __name__ == "__main__":
setup()