Skip to content

Commit

Permalink
move build configuration into pyproject.toml (spacetelescope#216)
Browse files Browse the repository at this point in the history
* move build configuration into `pyproject.toml`

* fix dependencies

* remove unused imports

* add `setuptools_scm` configuration
  • Loading branch information
zacharyburnett committed Feb 10, 2023
1 parent 7d86cba commit 9af631f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 64 deletions.
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# flake8 does not support pyproject.toml (https://github.com/PyCQA/flake8/issues/234)

[flake8]
# E265: block comment should start with '#'
# F821 undefined name
extend-ignore = E265,F821,F841
extend-exclude = setup.py,__init__.py
73 changes: 71 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,77 @@
[project]
name = "calcos"
description = "Calibration software for COS (Cosmic Origins Spectrograph)"
requires-python = ">=3.8"
authors = [
{ name = "Phil Hodge" },
{ name = "Robert Jedrzejewski" },
]
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: C",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"astropy>=5.0.4",
"numpy",
"scipy",
"stsci.tools>=4.0.0",
]
dynamic = [
"version",
]

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.scripts]
calcos = "calcos:main"

[project.optional-dependencies]
docs = [
"sphinx",
]
test = [
"ci-watson",
"pytest",
"pytest-cov",
"codecov",
]

[build-system]
requires = [
"setuptools>=42.0",
"setuptools>=61.2",
"setuptools_scm[toml]>=3.4",
"wheel",
"oldest-supported-numpy",
]
build-backend = 'setuptools.build_meta'
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = false

[tool.setuptools.packages.find]
namespaces = false

[tool.setuptools.package-data]
calcos = [
"pars/*",
"*.help",
]

[tool.setuptools_scm]
write_to = 'calcos/version.py'

[tool.pytest.ini_options]
minversion = "3.0"
norecursedirs = [
"build",
"doc/build",
"src",
]
junit_family = "xunit2"

13 changes: 0 additions & 13 deletions setup.cfg

This file was deleted.

52 changes: 3 additions & 49 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import os
from fnmatch import fnmatch
from setuptools import setup, find_packages, Extension

from numpy import get_include as numpy_includes
from setuptools import setup, Extension


def c_sources(parent):
sources = []
Expand All @@ -30,60 +32,12 @@ def c_includes(parent, depth=1):
SOURCES = c_sources('src')
INCLUDES = c_includes('src') + [numpy_includes()]


setup(
name=PACKAGENAME,
use_scm_version={'write_to': 'calcos/version.py'},
setup_requires=['setuptools_scm'],
install_requires=[
'astropy>=5.0.4',
'numpy',
'scipy',
'stsci.tools>=4.0.0',
],
extras_require={
'docs': [
'sphinx',
],
'test': [
'ci-watson',
'pytest',
'pytest-cov',
'codecov',
],
},
packages=find_packages(),
package_data={
PACKAGENAME: [
'pars/*',
'*.help',
],
},
ext_modules=[
Extension(
PACKAGENAME + '.ccos',
sources=SOURCES,
include_dirs=INCLUDES,
),
],
entry_points={
'console_scripts': {
'calcos = calcos:main',
},
},
author='Phil Hodge, Robert Jedrzejewski',
author_email='help@stsci.edu',
description='Calibration software for COS (Cosmic Origins Spectrograph)',
long_description='README.md',
long_description_content_type='text/x-rst',
url='https://github.com/spacetelescope/calcos',
license='BSD',
classifiers=[
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: C',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)

0 comments on commit 9af631f

Please sign in to comment.