Skip to content

Commit

Permalink
Merge pull request #26 from larrybradley/min-deps
Browse files Browse the repository at this point in the history
Update minimum versions of dependencies
  • Loading branch information
larrybradley authored Aug 5, 2024
2 parents 86d032d + 318bbc0 commit 347c1cb
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 80 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Keep dependencies updated with Dependabot version updates
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: ".github/workflows/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"
42 changes: 24 additions & 18 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,69 +31,75 @@ jobs:
matrix:
include:
- os: ubuntu-latest
python: '3.9'
tox_env: 'py39-test-alldeps'
python: '3.10'
tox_env: 'py310-test-alldeps'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.10'
tox_env: 'py310-test-alldeps'
python: '3.11'
tox_env: 'py311-test-alldeps'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.11'
tox_env: 'py311-test-alldeps-cov'
python: '3.12'
tox_env: 'py312-test-alldeps-cov'
toxposargs: --remote-data=any
allow_failure: false
prefix: ''

- os: macos-latest
python: '3.11'
tox_env: 'py311-test-alldeps'
python: '3.12'
tox_env: 'py312-test-alldeps'
allow_failure: false
prefix: ''

- os: macos-14
python: '3.12'
tox_env: 'py312-test-alldeps'
allow_failure: false
prefix: 'M1'

- os: windows-latest
python: '3.11'
tox_env: 'py311-test-alldeps'
python: '3.12'
tox_env: 'py312-test-alldeps'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.11'
tox_env: 'py311-test'
python: '3.12'
tox_env: 'py312-test'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.11'
python: '3.12'
tox_env: 'linkcheck'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.11'
python: '3.12'
tox_env: 'codestyle'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.11'
python: '3.12'
tox_env: 'pep517'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.11'
python: '3.12'
tox_env: 'bandit'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.9'
tox_env: 'py39-test-oldestdeps'
python: '3.10'
tox_env: 'py310-test-oldestdeps'
allow_failure: false
prefix: ''

Expand Down
29 changes: 24 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
# Prevent giant files from being committed.
Expand All @@ -29,6 +29,8 @@ repos:
# source.
- id: detect-private-key
# Checks for the existence of private keys.
- id: double-quote-string-fixer
# Replace double-quoted strings with single-quoted strings.
- id: end-of-file-fixer
# Makes sure files end in a newline and only a newline.
exclude: ".*(svg.*|extern.*|_templates.*)$"
Expand All @@ -52,21 +54,26 @@ repos:
# Enforce that all noqa annotations always occur with specific codes.

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.17.0
hooks:
- id: pyupgrade
args: ["--py39-plus"]
exclude: ".*(extern.*)$"

- repo: https://github.com/scientific-python/cookie
rev: 2024.04.23
hooks:
- id: sp-repo-review

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
additional_dependencies: [toml]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.1
hooks:
- id: flake8
args: ["--ignore", "E501,W503"]
Expand All @@ -77,13 +84,25 @@ repos:
- id: yesqa

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: ["--write-changes"]
additional_dependencies:
- tomli

- repo: https://github.com/numpy/numpydoc
rev: v1.8.0rc2
hooks:
- id: numpydoc-validation

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--in-place, --config, ./pyproject.toml]

# - repo: https://github.com/MarcoGorelli/absolufy-imports
# rev: v0.3.1
# hooks:
Expand Down
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ General
- The ``lacosmic.test`` function has been removed. Instead use the
``pytest --pyarg lacosmic`` command. [#25]

- The minimum required Python version is 3.10. [#26]

- The minimum required Numpy version is 1.24. [#26]

- The minimum required Scipy version is 1.10. [#26]

- The minimum required Matplotlib version is 3.6. [#26]

- The minimum required Astropy version is 5.1. [#26]


1.1.0 (2023-11-16)
------------------
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2023, Larry Bradley
Copyright (c) 2014-2024, Larry Bradley
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
43 changes: 21 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Documentation build configuration file.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# file.
#
# All configuration values have a default. Some values are defined in
# the global Astropy configuration which is loaded here before anything
# else. See astropy.sphinx.conf for which values are set there.
"""
Documentation build configuration file.
This file is execfile()d with the current directory set to its
containing dir.
Note that not all possible configuration values are present in this
file.
All configuration values have a default. Some values are defined in the
global Astropy configuration which is loaded here before anything else.
See astropy.sphinx.conf for which values are set there.
"""

import os
import sys
from datetime import datetime, timezone
from importlib import metadata
from pathlib import Path

if sys.version_info < (3, 11):
Expand Down Expand Up @@ -51,8 +53,6 @@
# directories to ignore when looking for source files.
# exclude_patterns.append('_templates')

plot_formats = ['png', 'hires.png', 'pdf', 'svg']

# This is added to the end of RST files - a good place to put
# substitutions to be used globally.
rst_epilog = """
Expand All @@ -65,18 +65,18 @@
# -- Project information ------------------------------------------------------
project = project_meta['name']
author = project_meta['authors'][0]['name']
copyright = f'2014-{datetime.now(tz=timezone.utc).year}, {author}'
project_copyright = f'2014-{datetime.now(tz=timezone.utc).year}, {author}'
github_project = 'larrybradley/lacosmic'

# The version info for the project you're documenting, acts as
# replacement for |version| and |release|, also used in various other
# places throughout the built documents.
__import__(project)
package = sys.modules[project]

# The short X.Y version.
version = package.__version__.split('-', 1)[0]
# The full version, including alpha/beta/rc tags.
release = package.__version__
release = metadata.version(project)
# The short X.Y version.
version = '.'.join(release.split('.')[:2])
dev = 'dev' in release

# -- Options for HTML output --------------------------------------------------
# The global astropy configuration uses a custom theme,
Expand Down Expand Up @@ -138,7 +138,6 @@
[author], 1)]

# -- Resolving issue number to links in changelog -----------------------------
github_project = conf['tool']['build-sphinx']['github_project']
github_issues_url = f'https://github.com/{github_project}/issues/'

# -- Turn on nitpicky mode for sphinx (to warn about references not found) ----
Expand All @@ -161,7 +160,7 @@
nitpick_filename = 'nitpick-exceptions.txt'
if os.path.isfile(nitpick_filename):
for line in open(nitpick_filename):
if line.strip() == "" or line.startswith("#"):
if line.strip() == '' or line.startswith('#'):
continue
dtype, target = line.split(None, 1)
target = target.strip()
Expand Down
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Requirements

``lacosmic`` has the following requirements:

* `Python <https://www.python.org/>`_ 3.9 or later
* `Python <https://www.python.org/>`_ 3.10 or later

* `NumPy <https://numpy.org/>`_ 1.22 or later
* `NumPy <https://numpy.org/>`_ 1.24 or later

* `Scipy <https://scipy.org/>`_ 1.7.2 or later
* `Scipy <https://scipy.org/>`_ 1.10 or later

* `Astropy`_ 5.0 or later
* `Astropy`_ 5.1 or later


Installation
Expand Down
4 changes: 2 additions & 2 deletions lacosmic/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
ASTROPY_HEADER = False

# do not remove until we drop support for NumPy < 2.0
if minversion(np, "2.0.0.dev0+git20230726"):
if minversion(np, '2.0.0.dev0+git20230726'):
np.set_printoptions(legacy='1.25')


Expand All @@ -26,7 +26,7 @@ def pytest_configure(config):
# list of packages for which version numbers are displayed when
# running the tests.
PYTEST_HEADER_MODULES.clear()
deps = ['NumPy', 'SciPy', 'Matplotlib']
deps = ['NumPy', 'SciPy', 'Matplotlib', 'Astropy']
for dep in deps:
PYTEST_HEADER_MODULES[dep] = dep.lower()

Expand Down
24 changes: 18 additions & 6 deletions lacosmic/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,45 @@ class TestLACosmic:
"""

def test_lacosmic(self):
"""Test basic lacosmic."""
"""
Test basic lacosmic.
"""
crclean_img, crmask_img = lacosmic(CR_IMG, 1, 40, 50, error=ERROR)
assert_allclose(crclean_img, IMG, atol=2.)
assert_array_equal(crmask_img, MASK_REF)

def test_background_scalar(self):
"""Test lacosmic with a background scalar."""
"""
Test lacosmic with a background scalar.
"""
crclean_img, crmask_img = lacosmic(CR_IMG, 1, 40, 50, error=ERROR,
background=10)
assert_allclose(crclean_img, IMG, atol=2.)
assert_array_equal(crmask_img, MASK_REF)

def test_background_maxiter(self):
"""Test lacosmic with a background scalar."""
"""
Test lacosmic with a background scalar.
"""
crclean_img, crmask_img = lacosmic(CR_IMG, 1, 40, 50, error=ERROR,
background=10, maxiter=1)
assert_allclose(crclean_img, IMG, atol=2.)
assert_array_equal(crmask_img, MASK_REF)

def test_background_image(self):
"""Test lacosmic with a 2D background image."""
"""
Test lacosmic with a 2D background image.
"""
bkgrd_img = np.ones(IMG.shape) * 10.
crclean_img, crmask_img = lacosmic(CR_IMG, 1, 40, 50, error=ERROR,
background=bkgrd_img)
assert_allclose(crclean_img, IMG, atol=2.)
assert_array_equal(crmask_img, MASK_REF)

def test_mask_image(self):
"""Test lacosmic with an input mask image."""
"""
Test lacosmic with an input mask image.
"""
mask = MASK_REF.copy()
mask[0:10, 0:10] = False
mask_ref2 = np.logical_and(MASK_REF, ~mask)
Expand All @@ -66,7 +76,9 @@ def test_mask_image(self):
assert_array_equal(crmask_img, mask_ref2)

def test_large_cosmics(self):
"""Test lacosmic cleaning with large cosmic rays."""
"""
Test lacosmic cleaning with large cosmic rays.
"""
test_img = np.ones((7, 7))
test_img[1:6, 1:6] = 100.
mask_ref2 = np.zeros((7, 7), dtype=bool)
Expand Down
Loading

0 comments on commit 347c1cb

Please sign in to comment.