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

Move options from setup.cfg to pyproject.toml #2512

Merged
merged 3 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
28 changes: 15 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@
# -- General configuration ------------------------------------------------
import datetime
import os
import sys
from pathlib import Path

# Get configuration information from setup.cfg
from configparser import ConfigParser
if sys.version_info < (3, 11):
import tomli as tomllib
else:
import tomllib

# Sphinx gallery
from sphinx_gallery.sorting import ExplicitOrder, FileNameSortKey

import ctapipe

setup_cfg = ConfigParser()
setup_cfg.read([os.path.join(os.path.dirname(__file__), "..", "setup.cfg")])
setup_metadata = dict(setup_cfg.items("metadata"))
setup_options = dict(setup_cfg.items("options"))
pyproject_path = Path(__file__).parent.parent / "pyproject.toml"
pyproject = tomllib.loads(pyproject_path.read_text())


# Add any Sphinx extension module names here, as strings. They can be
Expand Down Expand Up @@ -106,8 +108,8 @@ def setup(app):
# these
nitpick_ignore = [
# needed for building the docs with python 3.11 locally.
# we use the lowest supported version on readthedocs, so that is what we use the intersphinx
# link above
# we use the lowest supported version on readthedocs,
# so that is what we use in the intersphinx link above
("py:class", "enum.StrEnum"),
# these are coming from traitlets:
("py:class", "t.Union"),
Expand Down Expand Up @@ -201,12 +203,12 @@ def setup(app):

# General information about the project.

project = setup_metadata["name"]
author = setup_metadata["author"]
project = pyproject["project"]["name"]
author = pyproject["project"]["authors"][0]["name"]
copyright = "{}. Last updated {}".format(
setup_metadata["author"], datetime.datetime.now().strftime("%d %b %Y %H:%M")
author, datetime.datetime.now().strftime("%d %b %Y %H:%M")
)
python_requires = setup_options["python_requires"]
python_requires = pyproject["project"]["requires-python"]

# make some variables available to each page
rst_epilog = f"""
Expand Down Expand Up @@ -303,7 +305,7 @@ def setup(app):
"name": "CTA Observatory",
"url": "https://www.cta-observatory.org/",
"type": "url",
"icon": "https://www.cta-observatory.org/wp-content/themes/ctao/favicon.ico",
"icon": "https://www.cta-observatory.org/wp-content/themes/ctao/favicon.ico", # noqa: E501
},
],
"announcement": """
Expand Down
126 changes: 126 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,129 @@
requires = ["setuptools>=64", "setuptools_scm[toml]>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "ctapipe"
description = "Event reconstruction framework for Imaging Atmospheric Cherenkov Telescopes developed for CTAO."
readme = "README.rst"
authors = [
{name = "ctapipe developers"},
]
maintainers = [
{name = "Karl Kosack", email = "karl.kosack@cea.fr"},
{name = "Maximilian Linhoff", email = "maximilian.linhoff@tu-dortmund.de"},
]
license = {text = "BSD-3-Clause"}
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Astronomy",
"Development Status :: 3 - Alpha",
]

dynamic = ["version"]
requires-python = ">=3.9"

dependencies = [
"astropy >=5.3,<7.0.0a0",
"bokeh ~=2.0",
"docutils",
"eventio >=1.9.1, <2.0.0a0",
"iminuit >=2",
"importlib_metadata; python_version < '3.10'",
"joblib",
"matplotlib ~=3.0",
"numba >=0.56",
"numpy ~=1.16",
"psutil",
"pyyaml >=5.1",
"requests",
"scikit-learn <1.4",
"scipy ~=1.2",
"tables ~=3.4",
"tqdm >=4.32",
"traitlets ~=5.6",
"zstandard",
]

[project.optional-dependencies]
tests = [
"h5py",
"pandas",
"pytest >= 7.0",
"pytest-cov",
"pytest-xdist",
"pytest_astropy_header",
"tomli",
]

docs = [
"sphinx",
"pydata_sphinx_theme",
"sphinx_automodapi",
"nbsphinx",
"numpydoc",
"sphinx-design",
"sphinx-gallery",
"jupyter",
"notebook",
"graphviz",
"pandas",
"ipython",
"ffmpeg-python",
"pypandoc",
"tomli; python_version < '3.11'",
]

dev = [
"pre-commit",
"setuptools_scm[toml]",
]

all = [
# self-reference with all extras to simplify
"ctapipe[tests,docs,dev]",
]

[project.scripts]
ctapipe-info = "ctapipe.tools.info:main"
ctapipe-dump-instrument = "ctapipe.tools.dump_instrument:main"
ctapipe-display-dl1 = "ctapipe.tools.display_dl1:main"
ctapipe-process = "ctapipe.tools.process:main"
ctapipe-merge = "ctapipe.tools.merge:main"
ctapipe-fileinfo = "ctapipe.tools.fileinfo:main"
ctapipe-quickstart = "ctapipe.tools.quickstart:main"
ctapipe-train-energy-regressor = "ctapipe.tools.train_energy_regressor:main"
ctapipe-train-particle-classifier = "ctapipe.tools.train_particle_classifier:main"
ctapipe-train-disp-reconstructor = "ctapipe.tools.train_disp_reconstructor:main"
ctapipe-apply-models = "ctapipe.tools.apply_models:main"

[project.entry-points.ctapipe_io]
HDF5EventSource = "ctapipe.io.hdf5eventsource:HDF5EventSource"
SimTelEventSource = "ctapipe.io.simteleventsource:SimTelEventSource"


[project.entry-points.ctapipe_reco]
DispReconstructor = "ctapipe.reco.sklearn.DispReconstructor"
HillasIntersection = "ctapipe.reco.hillas_intersection.HillasIntersection"
HillasReconstructor = "ctapipe.reco.hillas_reconstructor.HillasReconstructor"
EnergyRegressor = "ctapipe.reco.sklearn.EnergyRegressor"
ParticleClassifier = "ctapipe.reco.sklearn.ParticleClassifier"

[project.urls]
repository = "https://github.com/cta-observatory/ctapipe/"
documentation = "https://ctapipe.readthedocs.io/"


[tool.setuptools.packages.find]
where = ["src"]
exclude = ["ctapipe._dev_version"]

[tool.setuptools_scm]
write_to = "src/ctapipe/_version.py"

Expand All @@ -28,18 +151,21 @@ minversion = "7"
testpaths = ["src"]
log_cli_level = "INFO"
xfail_strict = true
astropy_header = true

# print summar of failed tests, force errors if settings are misspelled
addopts = ["-ra", "--strict-config", "--strict-markers"]

filterwarnings = [
"error::astropy.utils.exceptions.AstropyDeprecationWarning",
"error::ctapipe.utils.deprecation.CTAPipeDeprecationWarning",
"ignore:`np.MachAr` is deprecated:DeprecationWarning",
]
norecursedirs = [
".git",
"_build",
"auto_examples",
"build",
]

[tool.towncrier]
Expand Down
147 changes: 0 additions & 147 deletions setup.cfg

This file was deleted.