Skip to content

Commit

Permalink
Switch to setup.cfg and update package versions (#78)
Browse files Browse the repository at this point in the history
* Switch to setup.cfg

* Fix package name

* Move to Python 3.8

* Build to 3.7

* Add pyproject.toml

* we are not fastmri

* Add version to gitignore

* Update checkout

* Update other actions to v3

* Update readthedocs

* Rename yaml

* Try changing pip reqs

* Try importlib

* Fix syntax

* Import torchkbnufft

* Early version of torch

* Test index url

* Index URL to diff file

* Update metadata files

* Update all package versions

* Test on Python 3.10

* Num to string

* Update python setup version
  • Loading branch information
mmuckley committed Nov 23, 2022
1 parent 9c960c8 commit 3352905
Show file tree
Hide file tree
Showing 20 changed files with 176 additions and 170 deletions.
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.ipynb linguist-documentation
*.ipynb linguist-documentation
36 changes: 24 additions & 12 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest]
python-version: [3.7, 3.8]
python-version: ["3.8", "3.10"]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
python -m pip install --upgrade pip
pip install --upgrade wheel
pip install -e .
pip install --upgrade wheel build setuptools
python -m build .
pip install dist/*.whl
- name: Test Import
run: |
python -c 'import torchkbnufft'
Expand All @@ -42,21 +43,32 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest]
python-version: [3.7, 3.8]
python-version: ["3.8", "3.10"]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v3
with:
python-version: 3.8
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
pip install -e .
pip install --upgrade wheel
pip install --editable ".[tests]"
- name: Format and lint
run: |
black --check .
Expand Down
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.pytest_cache/
__pycache__/
.pytest_cache/
.vscode/
dist/
build/
torchkbnufft.egg-info/
*checkpoint.ipynb
speedtests/
_build/
build/
dist/
gram/
speedtests/
torchkbnufft/_version.py
torchkbnufft.egg-info/
8 changes: 8 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs
system_packages: true
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Matthew John Muckley
Copyright (c) 2022 Matthew John Muckley

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 0 additions & 5 deletions dev-requirements.txt

This file was deleted.

3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sphinx>=3.2.0
sphinx-rtd-theme>=0.5.1
sphinxcontrib-katex
sphinx-autodoc-typehints
sphinx-autodoc-typehints
torch --extra-index-url https://download.pytorch.org/whl/cpu
5 changes: 3 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
from datetime import date
import os
import sys

sys.path.insert(0, os.path.abspath("../.."))
os.environ["PYTORCH_JIT"] = "0"
year = date.today().year

import torchkbnufft
import torch


# -- Project information -----------------------------------------------------

project = "torchkbnufft"
copyright = "2021, Matthew Muckley"
copyright = f"{year}, Matthew Muckley"
author = "Matthew Muckley"

# The full version, including alpha/beta/rc tags
Expand Down
9 changes: 0 additions & 9 deletions mypy.ini

This file was deleted.

10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools-scm>=6.3.2",
"setuptools>=59.5.0",
"wheel>=0.37.0",
]

[tool.setuptools_scm]
write_to = "torchkbnufft/_version.py"
11 changes: 0 additions & 11 deletions readthedocs.yml

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

70 changes: 70 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[flake8]
max-line-length=88
per-file-ignores=__init__.py:F401
extend-exclude = *brain_challenge*,*2020-08*
extend-ignore = E203, E266, E501

[metadata]
author = Matthew Muckley
author_email = matt.muckley@gmail.com
classifiers =
Environment :: Console
Natural Language :: English
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Development Status :: 4 - Beta
Intended Audience :: Developers
Topic :: Scientific/Engineering :: Artificial Intelligence
Topic :: Scientific/Engineering :: Mathematics
Topic :: Scientific/Engineering :: Medical Science Apps.
Topic :: Scientific/Engineering :: Physics
description = A high-level, easy-to-deploy non-uniform Fast Fourier Transform in PyTorch.
license = MIT
license_files = LICENSE
long_description = file: README.md
long_description_content_type = text/markdown
name = torchkbnufft
project_urls =
Homepage = https://torchkbnufft.readthedocs.io/en/stable/
Source = https://github.com/mmuckley/torchkbnufft

[mypy]

# modules that don't play well with mypy
[mypy-numpy.*,scipy.*]
ignore_missing_imports=True

# directories we're not tracking
[mypy-tests.*]
ignore_missing_imports=True

[options]
install_requires =
numpy>=1.22.4
scipy>=1.8.1
torch>=1.12
packages = find:
python_requires = >=3.8

[options.extras_require]
dev =
black==22.10.0
flake8==5.0.4
mypy==0.991
pytest==7.2.0
tests =
black==22.10.0
flake8==5.0.4
mypy==0.991
numpy==1.23.5
pytest==7.2.0
scipy==1.9.3
torch==1.13.0

[options.packages.find]
exclude =
tests
notebooks
docs
59 changes: 2 additions & 57 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,58 +1,3 @@
import builtins
import pathlib
from setuptools import setup

from setuptools import find_packages, setup

# https://github.com/williamFalcon/pytorch-lightning/blob/master/setup.py


# The directory containing this file
HERE = pathlib.Path(__file__).parent

# The text of the README file
README = (HERE / "README.md").read_text()

builtins.__TORCHKBNUFFT_SETUP__ = True

import torchkbnufft # noqa: E402

install_requires = ["torch>=1.12", "numpy", "scipy"]

# https://packaging.python.org/discussions/install-requires-vs-requirements
setup(
name="torchkbnufft",
version=torchkbnufft.__version__,
description=torchkbnufft.__docs__,
author=torchkbnufft.__author__,
author_email=torchkbnufft.__author_email__,
url=torchkbnufft.__homepage__,
download_url="https://github.com/mmuckley/torchkbnufft",
license=torchkbnufft.__license__,
packages=find_packages(exclude=["tests", "notebooks", "docs"]),
long_description=open("README.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
include_package_data=True,
zip_safe=False,
keywords=["MRI", "pytorch", "nufft", "deep-learning"],
python_requires=">=3.7",
setup_requires=[],
install_requires=install_requires,
classifiers=[
"Environment :: Console",
"Natural Language :: English",
# How mature is this project? Common values are
# 3 - Alpha, 4 - Beta, 5 - Production/Stable
"Development Status :: 4 - Beta",
# Indicate who your project is intended for
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Topic :: Scientific/Engineering :: Physics",
# Pick your license as you wish
"License :: OSI Approved :: MIT License",
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
],
)
setup()

0 comments on commit 3352905

Please sign in to comment.