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

Migrate to pyproject.toml #653

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ _pycache__/
build
dist
*.egg-info
*_version.py

# documentation / sphinx
docs/build
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ help:
@echo "clean - remove artifacts"

pypi:
python setup.py sdist bdist_wheel
python -m build --sdist --wheel
twine upload dist/*

pypi-test:
python setup.py sdist bdist_wheel
python -m build --sdist --wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

docs:
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ To install VIP, then simply cd into your local VIP directory, and run the instal
.. code-block:: bash

cd VIP
pip install -e . -r requirements-dev.txt
pip install -e .[dev]

If cloned from your fork, make sure to link your VIP directory to the upstream
source, to be able to easily update your local copy when a new version comes
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

sys.path.insert(0, os.path.abspath('../../vip_hci/'))

with open(os.path.join(os.path.abspath('../../vip_hci/'), '__init__.py')) as init:
with open(os.path.join(os.path.abspath('../../vip_hci/'), '_version.py')) as init:
for line in init:
if "__version__ =" in line:
version = line.split('"')[1]
Expand Down
70 changes: 70 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[build-system]
requires = ["setuptools", "wheel", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_file = "vip_hci/_version.py"

[project]
dynamic = ["version", "dependencies"]
name = "vip_hci"
license = {text = "MIT"}
readme = {file = "README.rst", content-type = "text/x-rst"}
requires-python = ">=3.8"
authors = [{name = "Carlos Alberto Gomez Gonzalez", email = "[email protected]"}]
maintainers = [{name = "Valentin Christiaens", email = "[email protected]"}]
description = "Package for astronomical high-contrast image processing"
classifiers = [
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also be compatible with Windows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um I blindly copied the description classifiers from the previous setup; I guess it’s a good time to update them indeed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve just updated them—both the Windows classifier and the Python version, as you pointed out.

'Operating System :: Microsoft :: Windows',
'Natural Language :: English',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Scientific/Engineering :: Astronomy'
]

[tool.setuptools]
packages = ['vip_hci',
'vip_hci.config',
'vip_hci.fits',
'vip_hci.fm',
'vip_hci.invprob',
'vip_hci.metrics',
'vip_hci.objects',
'vip_hci.preproc',
'vip_hci.psfsub',
'vip_hci.stats',
'vip_hci.var']

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[project.optional-dependencies]
dev = [
"sphinx",
"myst-nb",
"myst-parser",
"pandoc",
"nbsphinx",
"sphinx_rtd_theme",
"jupyter_sphinx",
"pytest",
"pytest-cov ~=2.6.0",
"pytest-split",
"flake8",
"flake8-bandit",
"flake8-docstrings",
"autopep8",
"pre-commit",
"opencv-python",
"ratelimit"
]

[project.urls]
Documentation = "https://vip.readthedocs.io/en/latest/"
Repository = "https://github.com/vortex-exoplanet/VIP"
108 changes: 0 additions & 108 deletions setup.py

This file was deleted.

11 changes: 9 additions & 2 deletions vip_hci/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__version__ = "1.6.4"

from . import preproc
from . import config
from . import fits
Expand All @@ -11,3 +9,12 @@
from . import var
from . import objects
from .vip_ds9 import *

try:
from ._version import __version__
except ImportError:
from importlib.metadata import version, PackageNotFoundError
try:
__version__ = version(__name__)
except PackageNotFoundError:
__version__ = "0.0.0" # Default version
7 changes: 5 additions & 2 deletions vip_hci/config/utils_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
from functools import wraps
import multiprocessing
import warnings
from vip_hci import __version__

sep = "―" * 80
vip_figsize = (8, 5)
vip_figdpi = 100

def get_vip_version():
from vip_hci import __version__ # Delayed import to avoid circular import
return __version__


def print_precision(array, precision=3):
"""Prints an array with a given floating point precision. 3 by default."""
Expand Down Expand Up @@ -60,7 +63,7 @@ def save(self, filename):
data["_item_{}".format(a)] = True

np.savez_compressed(
filename, _vip_version=__version__, _vip_object=vip_object, **data
filename, _vip_version=get_vip_version(), _vip_object=vip_object, **data
)

else:
Expand Down
Loading