Skip to content

Commit

Permalink
updated versioning system and moved configuration to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
simontorres committed Sep 24, 2024
1 parent 034c558 commit 5f23813
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 216 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ build/*
*__pycache__*
*.egg-info/*
.tox/*
/coverage.xml
/.tox/
/.coverage*
/goodman_focus/version.py
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: goodman_focus
dependencies:
- python=3.8
- python=3.12
- astropy
- matplotlib
- numpy
Expand Down
2 changes: 0 additions & 2 deletions goodman_focus/version.py

This file was deleted.

73 changes: 69 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,72 @@
[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

requires = ["setuptools",
"setuptools_scm",
"wheel"]
[project]
name = "goodman_focus"
dynamic = ["version"]
description = "Finds best focus for Goodman HTS based on a series of images obtained with different focus values"
readme = "README.md"
requires-python = ">=3.8"
license = {file = "LICENSE"}
keywords = [
"soar",
"pipelines",
"astronomy",
"images",
"spectroscopy",
"focus"
]

build-backend = 'setuptools.build_meta'
authors = [
{name = "Simón Torres", email = "[email protected]"}
]
maintainers = [
{name = "Simón Torres", email = "[email protected]"}
]

classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Operating System :: POSIX :: Other',
'Operating System :: MacOS :: MacOS X',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development :: Libraries :: Python Modules',
]

dependencies = [
"astropy",
"ccdproc",
"matplotlib",
"numpy",
"packaging",
"pandas",
"scipy",
]

[project.urls]
"Homepage" = "https://soardocs.readthedocs.io/projects/goodmanfocus/en/latest/"
"Bug Reports" = "https://github.com/soar-telescope/goodman_focus/issues"
"Source" = "https://github.com/soar-telescope/goodman_focus"

[project.scripts]
goodman-focus = "goodman_focus:run_goodman_focus"

[tool.setuptools]
[tool.setuptools.packages.find]
where = ["goodman_focus"]

[tool.setuptools_scm]
version_file = "goodman_focus/version.py"
22 changes: 0 additions & 22 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,3 @@ build_dir = docs/_build
[upload_docs]
upload_dir = docs/_build/html
show_response = 1

[metadata]
package_name = goodman_focus
description = Finds best focus for Goodman HTS based on a series of images obtained with different focus values
long_description = Standalone app to get the best focus.
author = Simon Torres
author_email = [email protected]
license = BSD-3-Clause
# url =
edit_on_github = False
github_project = soar-telescope/goodman_focus
install_requires =
astropy
matplotlib
numpy
pandas
scipy
ccdproc
sphinx

# version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440)
version = 2.0.3
92 changes: 1 addition & 91 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,93 +1,3 @@
import os

from codecs import open
from setuptools import setup

try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser

CONF = ConfigParser()

HERE = os.path.abspath(os.path.dirname(__file__))


def create_version_py(packagename, version, source_dir='.'):
package_dir = os.path.join(source_dir, packagename)
version_py = os.path.join(package_dir, 'version.py')

version_str = "# This is an automatic generated file please do not edit\n" \
"__version__ = '{:s}'".format(version)

with open(version_py, 'w') as f:
f.write(version_str)


# read content from README.md
with open(os.path.join(HERE, 'README.md')) as f:
long_description = f.read()

CONF.read([os.path.join(os.path.dirname(__file__), 'setup.cfg')])

metadata = dict(CONF.items('metadata'))

PACKAGENAME = metadata['package_name']

VERSION = metadata['version']

LICENSE = metadata['license']

DESCRIPTION = metadata['description']

LONG_DESCRIPTION = long_description

LONG_DESCRIPTION_CONTENT_TYPE = 'text/markdown'

AUTHOR = metadata['author']

AUTHOR_EMAIL = metadata['author_email']

INSTALL_REQUIRES = metadata['install_requires'].split()

# freezes version information in version.py
create_version_py(PACKAGENAME, VERSION)


setup(
name=metadata['package_name'],

version=VERSION,

description=DESCRIPTION,

long_description=LONG_DESCRIPTION,

long_description_content_type=LONG_DESCRIPTION_CONTENT_TYPE,

# The project's main homepage.
url='https://github.com/soar-telescope/goodman_focus',

# Author details
author=u'Simon Torres R., ',

author_email='[email protected]',

# Choose your license
license=LICENSE,

packages=['goodman_focus'],

package_dir={'goodman_focus': 'goodman_focus'},

python_requires=">=3.6",

install_requires=INSTALL_REQUIRES,

entry_points={
'console_scripts': [
'goodman-focus=goodman_focus:run_goodman_focus',
]
}

)
setup()
108 changes: 12 additions & 96 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,103 +1,19 @@
[tox]
envlist =
py{36,37,38}-test{,-alldeps,-devdeps}{,-cov}
py{36,37,38}-test-numpy{116,117,118}
py{36,37,38}-test-astropy{30,40,lts}
py{36,37,38}-test-external
build_docs
linkcheck
codestyle
requires =
setuptools >= 30.3.0
pip >= 19.3.1
isolated_build = true
indexserver =
NIGHTLY = https://pypi.anaconda.org/scipy-wheels-nightly/simple
env_list =
py{38, 39, 310, 311, 312}-test{,-cov}
minversion = 4.4.12

[testenv]
# Suppress display of matplotlib plots generated during docs build
setenv =
MPLBACKEND=agg
# Disable the accelerate linear algebra library when running on macos as
# latest numpy versions do not work with it
NPY_BLAS_ORDER=
NPY_LAPACK_ORDER=
description = run the tests with pytest
package = wheel
wheel_build_env = .pkg

# Pass through the following environment variables which may be needed for the CI
passenv = HOME,WINDIR,LC_ALL,LC_CTYPE,CC,CI,TRAVIS

# Run the tests in a temporary directory to make sure that we don't import
# this package from the source tree
changedir = .tmp/{envname}

# tox environments are constructed with so-called 'factors' (or terms)
# separated by hyphens, e.g. test-devdeps-cov. Lines below starting with factor:
# will only take effect if that factor is included in the environment name. To
# see a list of example environments that can be run, along with a description,
# run:
#
# tox -l -v
#
description =
run tests
alldeps: with all optional dependencies
devdeps: with the latest developer version of key dependencies
oldestdeps: with the oldest supported version of key dependencies
cov: and test coverage
numpy116: with numpy 1.16.*
numpy117: with numpy 1.17.*
numpy118: with numpy 1.18.*
astropy30: with astropy 3.0.*
astropy40: with astropy 4.0.*
astropylts: with the latest astropy LTS
external: with outside packages as dependencies

# The following provides some specific pinnings for key packages
deps =
pytest>=6
cov: pytest-cov

numpy116: numpy==1.16.*
numpy117: numpy==1.17.*
numpy118: numpy==1.18.*

astropy30: astropy==3.0.*
astropy40: astropy==4.0.*
astropylts: astropy==4.0.*

devdeps: :NIGHTLY:numpy
devdeps: git+https://github.com/astropy/astropy.git#egg=astropy

external: asdf
external: git+https://github.com/spacetelescope/jwst@stable

# The following indicates which extras_require from setup.cfg will be installed
extras =
test
alldeps: all

commands =
pip freeze
!cov: pytest --pyargs specutils {toxinidir}/docs {posargs}
cov: pytest --pyargs specutils {toxinidir}/docs --cov specutils --cov-config={toxinidir}/setup.cfg {posargs}

[testenv:build_docs]
changedir = docs
description = invoke sphinx-build to build the HTML docs
extras = docs
commands =
pip freeze
sphinx-build -W -b html . _build/html

[testenv:linkcheck]
changedir = docs
description = check the links in the HTML docs
extras = docs
commands =
pip freeze
sphinx-build -W -b linkcheck . _build/html

[testenv:codestyle]
skip_install = true
changedir = .
description = check code style, e.g. with flake8
deps = flake8
commands = flake8 specutils --count --max-line-length=100 --select=E101,W191,W291,W292,W293,W391,E111,E112,E113,E502,E722,E901,E902
pytest {tty:--color=yes} {posargs}
cov: pytest {tty:--color=yes} --cov goodman_focus {posargs}
cov: coverage xml -o '{toxinidir}/coverage.xml'
html: coverage html -d .coverage_html

0 comments on commit 5f23813

Please sign in to comment.