Skip to content

Commit 5582f77

Browse files
authored
Merge pull request #32 from LabForComputationalVision/pyprojecttoml
Switch all metadata to pyproject.toml
2 parents 8955baf + 9aceae5 commit 5582f77

40 files changed

+85
-136
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ docs/_build
3939
docs/api
4040

4141
.idea
42+
43+
# created automatically by setuptools.scm, don't track
44+
version.py

.readthedocs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "mambaforge-4.10"
12+
python: "3.10"
1313

1414
# Build documentation in the docs/ directory with Sphinx
1515
sphinx:
@@ -24,9 +24,9 @@ formats:
2424
- htmlzip
2525

2626
# Optionally set the version of Python and requirements required to build your docs
27-
conda:
28-
environment: docs/environment.yml
2927
python:
3028
install:
3129
- method: pip
3230
path: .
31+
extra_requirements:
32+
- docs

CITATION.cff

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ authors:
1717
given-names: Nikhil
1818
- family-names: Ward
1919
given-names: Brian
20-
orcid: https://orcid.org/0000-0000-0000-0000
2120
title: "Pyrtools: tools for multi-scale image processing"
22-
version: v1.0.3
21+
version: v1.0.4
2322
date-released: 2023-11-20
2423
doi: 10.5281/zenodo.10161031
2524
url: "https://github.com/LabForComputationalVision/pyrtools"

README.md

Lines changed: 17 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Build Status](https://github.com/LabForComputationalVision/pyrtools/workflows/build/badge.svg)](https://github.com/LabForComputationalVision/pyrtools/actions?query=workflow%3Abuild)
77
[![Documentation Status](https://readthedocs.org/projects/pyrtools/badge/?version=latest)](https://pyrtools.readthedocs.io/en/latest/?badge=latest)
88
[![DOI](https://zenodo.org/badge/137527035.svg)](https://zenodo.org/doi/10.5281/zenodo.10161031)
9-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/LabForComputationalVision/pyrtools/v1.0.3?filepath=TUTORIALS%2F)
9+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/LabForComputationalVision/pyrtools/v1.0.4?filepath=TUTORIALS%2F)
1010
[![codecov](https://codecov.io/gh/LabForComputationalVision/pyrtools/branch/main/graph/badge.svg?token=Ei9TYftdYi)](https://codecov.io/gh/LabForComputationalVision/pyrtools)
1111

1212
Briefly, the tools include:
@@ -20,10 +20,11 @@ Briefly, the tools include:
2020
auto-scaling options, rounding to integer zoom factors to avoid
2121
resampling artifacts, and useful labeling (dimensions and gray-range).
2222

23-
This is a python 3 port of Eero Simoncelli's matlabPyrTools, but it
24-
does not attempt to recreate all of the matlab code from
25-
matlabPyrTools. The goal is to create a Python interface for the C
26-
code at the heart of matlabPyrTools.
23+
This is a python 3 port of Eero Simoncelli's
24+
[matlabPyrTools](https://github.com/LabForComputationalVision/matlabPyrTools),
25+
but it does not attempt to recreate all of the matlab code from matlabPyrTools.
26+
The goal is to create a Python interface for the C code at the heart of
27+
matlabPyrTools.
2728

2829
**NOTE**: If you are only interested in the complex steerable pyramid, we have a
2930
pytorch implementation in the
@@ -49,19 +50,6 @@ want the changes you make in the directory to be reflected in your
4950
install) from the root directory of this project. The core of this
5051
code is the C code, and the pip install will compile it nicely.
5152

52-
## Dependencies
53-
54-
Dependencies are documented in `setup.py`.
55-
56-
IPython is optional. If it's not installed,
57-
`pyrtools.display_tools.animshow` must be called with `as_html5=False`
58-
(but since this is for displaying the animated image in a Jupyter /
59-
IPython notebook, you probably won't need that functionality).
60-
61-
For the C code to compile, we require `gcc` version >= 6, because of
62-
[this
63-
issue](https://stackoverflow.com/questions/46504700/gcc-compiler-not-recognizing-fno-plt-option)
64-
6553
# Pyramid resources
6654

6755
If you would like to learn more about pyramids and why they're helpful
@@ -78,23 +66,9 @@ for image processing, here are some resources to get you started:
7866
- Notes from Eero Simoncelli on [the Steerable
7967
Pyramid](http://www.cns.nyu.edu/~eero/STEERPYR/)
8068

81-
# Authors
82-
83-
Rob Young and Eero Simoncelli, 7/13
84-
85-
William Broderick, 6/17
86-
87-
William Broderick, Pierre-Étienne Fiquet, Zhuo Wang, Zahra Kadkhodaie,
88-
Nikhil Parthasarathy, and the Lab for Computational Vision, 4/19
89-
9069
# Usage:
9170

92-
method parameters mimic the matlab function parameters except that there's no
93-
need to pass pyr or pind, since the pyPyrTools version pyr and pyrSize are
94-
properties of the class.
95-
96-
- load modules (note that if you installed via pip, you can skip the
97-
first two lines):
71+
- load modules:
9872
```
9973
import pyrtools as pt
10074
```
@@ -109,41 +83,29 @@ pyr = pt.pyramids.LaplacianPyramid(img)
10983
recon_img = pyr.recon_pyr()
11084
```
11185

112-
Please see `TUTORIALS/02_pyramids.ipynb` for more examples. You can
113-
start this with: `jupyter notebook 02_pyramids.ipynb` if you have iPython
114-
and Jupyter installed.
86+
Please see `TUTORIALS/02_pyramids.ipynb` for more examples.
11587

116-
# Testing
88+
# For developres
11789

118-
All code should be considered a beta release. By that we mean that it is being
119-
actively developed and tested. You can find unit tests in
120-
`TESTS/unitTests.py` and run them with `python TESTS/unitTests.py`.
90+
## Testing
12191

122-
If you're using functions or parameters that do not have associated unit
123-
tests you should test this yourself to make sure the results are correct.
124-
You could then submit your test code, so that we can build more complete
125-
unit tests.
92+
You can find unit tests in `TESTS/unitTests.py` and run them with `python
93+
TESTS/unitTests.py`.
12694

127-
# Build the documentation
95+
## Build the documentation
12896

12997
NOTE: If you just want to read the documentation, you do not need to
13098
do this; documentation is built automatically on
13199
[readthedocs](https://pyrtools.readthedocs.io/en/latest/).
132100

133101
However, it can be built locally as well. You would do this if you've
134102
made changes locally to the documentation (or the docstrings) that you
135-
would like to examine before pushing. The virtual environment required
136-
to do so is defined in `docs/environment.yml`, so to create that
137-
environment and build the docs, do the following from the project's
138-
root directory:
103+
would like to examine before pushing.
139104

140105
```
141-
# install sphinx and required packages to build documentation
142-
conda env create -f docs/environment.yml
143-
# activate the environment
144-
conda activate pyrtools_docs
145-
# install pyrtools
146-
pip install -e .
106+
# create a new virtual environment and then...
107+
# install pyrtools with sphinx and documentation-related dependencies
108+
pip install -e .[docs]
147109
# build documentation
148110
cd docs/
149111
make html
@@ -152,10 +114,3 @@ make html
152114
The index page of the documentation will then be located at
153115
`docs/_build/html/index.html`, open it in your browser to navigate
154116
around.
155-
156-
The `pyrtools_docs` environment you're creating contains the package
157-
`sphinx` and several extensions for it that are required to build the
158-
documentation. You also need to install `pyrtools` from your local
159-
version so that `sphinx` can import the library and grab all of the
160-
docstrings (you're installing the local version so you can see all the
161-
changes you've made).

docs/environment.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:target: https://github.com/LabForComputationalVision/pyrtools/actions?query=workflow%3Abuild
1111

1212
.. |binder| image:: https://mybinder.org/badge_logo.svg
13-
:target: https://mybinder.org/v2/gh/LabForComputationalVision/pyrtools/v1.0.3?filepath=TUTORIALS%2F
13+
:target: https://mybinder.org/v2/gh/LabForComputationalVision/pyrtools/v1.0.4?filepath=TUTORIALS%2F
1414

1515
.. |doi| image:: https://zenodo.org/badge/137527035.svg
1616
:target: https://zenodo.org/doi/10.5281/zenodo.10161031

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ When installing from source on Linux or Mac, we require ``gcc`` version >= 6 in
3737
order for the C code to compile, because of `this issue
3838
<https://stackoverflow.com/questions/46504700/gcc-compiler-not-recognizing-fno-plt-option>`_
3939

40-
When installing from source on Windows, Microsoft Visual C++ 14.0 or greater is required, which can be obtained with `Microsoft C++ Build Tools <https://visualstudio.microsoft.com/visual-cpp-build-tools/`_.
40+
When installing from source on Windows, Microsoft Visual C++ 14.0 or greater is required, which can be obtained with `Microsoft C++ Build Tools <https://visualstudio.microsoft.com/visual-cpp-build-tools/>`_.

docs/quickstart.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ In the python interpreter, then call::
1111

1212
import pyrtools as pt
1313

14-
which should run without errors if the install worked correctly. If
15-
you have an issue with the installation, it will most likely be with
16-
the compilation of the C code. There is hopefully a warning of this
17-
when you import the library, but if you get an error message along the
18-
lines of `lib not defined` when attempting to build a pyramid or call
19-
the functions `corrDn`, `upConv`, or `pointOp`, this is probably
20-
what's at fault.
21-
2214
Create pyramid::
2315

2416
pyr = pt.pyramids.LaplacianPyramid(img)
@@ -28,7 +20,7 @@ Reconstruct image from pyramid::
2820
recon_img = pyr.recon_pyr()
2921

3022
For more details, see the jupyter notebooks included in the
31-
`TUTORIALS/` directory, static versions of which are linked in the
23+
``TUTORIALS/`` directory, static versions of which are linked in the
3224
navigation sidebar. You can play around with a live version of them in
3325
order to test out the code before downloading on `binder
34-
<https://mybinder.org/v2/gh/LabForComputationalVision/pyrtools/v1.0.3?filepath=TUTORIALS%2F>`_
26+
<https://mybinder.org/v2/gh/LabForComputationalVision/pyrtools/v1.0.4?filepath=TUTORIALS%2F>`_

pyproject.toml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
[project]
2+
name = "pyrtools"
3+
dynamic = ["version"]
4+
authors = [{name="Pyrtools authors"}]
5+
description = "Python tools for multi-scale image processing, including Laplacian pyramids, Wavelets, and Steerable Pyramids."
6+
readme = "README.md"
7+
requires-python = ">=3.7"
8+
classifiers = [
9+
"Development Status :: 4 - Beta",
10+
"Programming Language :: Python :: 3",
11+
"License :: OSI Approved :: MIT License",
12+
"Intended Audience :: Science/Research",
13+
]
14+
keywords = ['image processing', 'visual information processing', 'computational models']
15+
16+
dependencies = ['numpy>=1.1',
17+
'scipy>=0.18',
18+
'matplotlib>=1.5',
19+
'tqdm>=4.29',
20+
'requests>=2.21']
21+
22+
[project.optional-dependencies]
23+
docs = [
24+
'sphinx',
25+
'numpydoc',
26+
# because of this issue:
27+
# https://nbsphinx.readthedocs.io/en/0.6.0/installation.html#Pygments-Lexer-for-Syntax-Highlighting
28+
'ipython',
29+
'nbsphinx',
30+
'nbsphinx_link',
31+
'sphinxcontrib-apidoc',
32+
# fix sphinx 7 incompatibility issue
33+
'sphinx_rtd_theme>=1.3.0rc1'
34+
]
35+
136
[build-system]
2-
requires = ["setuptools", "wheel"]
37+
requires = ["setuptools", "wheel", "setuptools-scm[toml]"]
338
build-backend = "setuptools.build_meta"
39+
40+
[project.urls]
41+
"Homepage" = "https://github.com/LabForComputationalVision/pyrtools"
42+
"Documentation" = "https://pyrtools.readthedocs.io/en/latest/"
43+
"Download" = "https://zenodo.org/records/10403034"
44+
45+
[tool.setuptools.packages.find]
46+
where = ["src"]
47+
48+
[tool.setuptools_scm]
49+
write_to = "src/pyrtools/version.py"
50+
version_scheme = 'python-simplified-semver'
51+
local_scheme = 'no-local-version'

pyrtools/version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
from wheel.bdist_wheel import bdist_wheel
44
from setuptools import setup, Extension
5-
import importlib
6-
import os
7-
8-
# copied from kymatio's setup.py: https://github.com/kymatio/kymatio/blob/master/setup.py
9-
pyrtools_version_spec = importlib.util.spec_from_file_location('pyrtools_version',
10-
'pyrtools/version.py')
11-
pyrtools_version_module = importlib.util.module_from_spec(pyrtools_version_spec)
12-
pyrtools_version_spec.loader.exec_module(pyrtools_version_module)
13-
VERSION = pyrtools_version_module.version
145

156
# Adapted from the cibuildwheel example https://github.com/joerick/python-ctypes-package-sample
167
# it marks the wheel as not specific to the Python API version.
@@ -25,33 +16,15 @@ def get_tag(self):
2516

2617

2718
setup(
28-
name='pyrtools',
29-
version=VERSION,
30-
long_description=open('README.md', 'r').read(),
31-
long_description_content_type='text/markdown',
32-
description='Python tools for multi-scale image processing, including Laplacian pyramids, Wavelets, and Steerable Pyramids',
33-
license='MIT',
34-
url='https://github.com/LabForComputationalVision/pyrtools',
35-
author='Eero Simoncelli',
36-
author_email='[email protected]',
37-
keywords='multi-scale image-processing',
38-
packages=['pyrtools', 'pyrtools.pyramids', 'pyrtools.tools', 'pyrtools.pyramids.c'],
39-
package_data={'': ['*.h', 'LICENSE']},
40-
install_requires=['numpy>=1.1',
41-
'scipy>=0.18',
42-
'matplotlib>=1.5',
43-
'tqdm>=4.29',
44-
'requests>=2.21'],
4519
ext_modules=[Extension('pyrtools.pyramids.c.wrapConv',
46-
sources=['pyrtools/pyramids/c/py.c',
47-
'pyrtools/pyramids/c/convolve.c',
48-
'pyrtools/pyramids/c/edges.c',
49-
'pyrtools/pyramids/c/wrap.c',
50-
'pyrtools/pyramids/c/internal_pointOp.c'],
51-
depends=['pyrtools/pyramids/c/meta.h',
52-
'pyrtools/pyramids/c/convolve.h',
53-
'pyrtools/pyramids/c/internal_pointOp.h'],
20+
sources=['src/pyrtools/pyramids/c/py.c',
21+
'src/pyrtools/pyramids/c/convolve.c',
22+
'src/pyrtools/pyramids/c/edges.c',
23+
'src/pyrtools/pyramids/c/wrap.c',
24+
'src/pyrtools/pyramids/c/internal_pointOp.c'],
25+
depends=['src/pyrtools/pyramids/c/meta.h',
26+
'src/pyrtools/pyramids/c/convolve.h',
27+
'src/pyrtools/pyramids/c/internal_pointOp.h'],
5428
extra_compile_args=['-fPIC', '-shared'])],
5529
cmdclass={"bdist_wheel": WheelABINone},
56-
tests='TESTS',
5730
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)