From ac8e2b9cb17c04ae858e69d4173a770f63133ce3 Mon Sep 17 00:00:00 2001 From: Pey Lian Lim <2090236+pllim@users.noreply.github.com> Date: Tue, 27 Dec 2022 16:31:57 -0500 Subject: [PATCH 1/3] TST: Unpin tox --- .github/workflows/ci_workflows.yml | 3 +-- .github/workflows/predeps_workflow.yml | 3 +-- tox.ini | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 733bcc1..1d6eb09 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -112,8 +112,7 @@ jobs: python-version: ${{ matrix.python }} - name: Install Python dependencies run: | - python -m pip install --upgrade pip - python -m pip install "tox<4" + python -m pip install --upgrade pip tox - name: Run tests run: tox -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }} - name: Upload coverage to codecov diff --git a/.github/workflows/predeps_workflow.yml b/.github/workflows/predeps_workflow.yml index 85fae24..4f82683 100644 --- a/.github/workflows/predeps_workflow.yml +++ b/.github/workflows/predeps_workflow.yml @@ -46,7 +46,6 @@ jobs: python-version: ${{ matrix.python }} - name: Install Python dependencies run: | - python -m pip install --upgrade pip - python -m pip install "tox<4" + python -m pip install --upgrade pip tox - name: Run tests run: tox -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }} diff --git a/tox.ini b/tox.ini index c8ea5b8..0a304ca 100644 --- a/tox.ini +++ b/tox.ini @@ -8,13 +8,11 @@ envlist = requires = setuptools >= 30.3.0 pip >= 19.3.1 - tox < 4 -isolated_build = true [testenv] # Pass through the following environemnt variables which are needed for the CI -passenv = HOME WINDIR CC CI +passenv = HOME,WINDIR,CC,CI # Run the tests in a temporary directory to make sure that we don't import # package from the source tree @@ -97,6 +95,7 @@ commands = changedir = docs description = check the links in the HTML docs extras = docs +allowlist_externals = make commands = pip freeze make linkcheck From c4d958d745e72d756bb71d517eea835e410aaafb Mon Sep 17 00:00:00 2001 From: Pey Lian Lim <2090236+pllim@users.noreply.github.com> Date: Tue, 27 Dec 2022 16:53:02 -0500 Subject: [PATCH 2/3] replace relative import and more CI stuff --- .github/workflows/ci_workflows.yml | 2 +- synphot/binning.py | 4 ++-- synphot/blackbody.py | 2 +- synphot/models.py | 8 ++++---- synphot/observation.py | 6 +++--- synphot/reddening.py | 10 +++++----- synphot/specio.py | 3 +-- synphot/spectrum.py | 8 ++++---- synphot/thermal.py | 6 +++--- synphot/units.py | 4 ++-- synphot/utils.py | 4 ++-- tox.ini | 2 +- 12 files changed, 29 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 1d6eb09..d97779e 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -83,7 +83,7 @@ jobs: toxposargs: --open-files - name: Test with old dependencies - os: ubuntu-18.04 + os: ubuntu-20.04 python: 3.8 toxenv: py38-test-oldestdeps toxposargs: --open-files diff --git a/synphot/binning.py b/synphot/binning.py index cca5313..9577064 100644 --- a/synphot/binning.py +++ b/synphot/binning.py @@ -8,7 +8,7 @@ from astropy import units as u # LOCAL -from . import exceptions +from synphot import exceptions __all__ = ['calculate_bin_edges', 'calculate_bin_widths', 'calculate_bin_centers', 'wave_range', 'pixel_range'] @@ -41,7 +41,7 @@ def _slow_calcbinflux(len_binwave, i_beg, i_end, avflux, deltaw): # Try to import the C version of calcbinflux, otherwise fall back # to the Python implementation above. try: - from . import synphot_utils + from synphot import synphot_utils except ImportError: calcbinflux = _slow_calcbinflux else: diff --git a/synphot/blackbody.py b/synphot/blackbody.py index d8bc5fe..ec45ec9 100644 --- a/synphot/blackbody.py +++ b/synphot/blackbody.py @@ -22,7 +22,7 @@ from astropy.modeling.parameters import Parameter from astropy.utils.exceptions import AstropyUserWarning -from .units import FNU, FLAM +from synphot.units import FNU, FLAM __all__ = ['BlackBody1D', 'blackbody_nu', 'blackbody_lambda'] diff --git a/synphot/models.py b/synphot/models.py index a2a3b00..f121bbe 100644 --- a/synphot/models.py +++ b/synphot/models.py @@ -22,10 +22,10 @@ from astropy.utils.exceptions import AstropyUserWarning # LOCAL -from . import units -from .compat import ASTROPY_LT_5_0 -from .exceptions import SynphotError -from .utils import merge_wavelengths +from synphot import units +from synphot.compat import ASTROPY_LT_5_0 +from synphot.exceptions import SynphotError +from synphot.utils import merge_wavelengths __all__ = ['BlackBody1D', 'BlackBodyNorm1D', 'Box1D', 'ConstFlux1D', 'Empirical1D', 'Gaussian1D', 'GaussianAbsorption1D', diff --git a/synphot/observation.py b/synphot/observation.py index 14e4477..73ecd04 100644 --- a/synphot/observation.py +++ b/synphot/observation.py @@ -18,9 +18,9 @@ AstropyDeprecationWarning) # LOCAL -from . import binning, exceptions, units, utils -from .models import Empirical1D -from .spectrum import BaseSourceSpectrum, SourceSpectrum, SpectralElement +from synphot import binning, exceptions, units, utils +from synphot.models import Empirical1D +from synphot.spectrum import BaseSourceSpectrum, SourceSpectrum, SpectralElement __all__ = ['Observation'] diff --git a/synphot/reddening.py b/synphot/reddening.py index 81c055c..6ee9b9f 100644 --- a/synphot/reddening.py +++ b/synphot/reddening.py @@ -9,11 +9,11 @@ from astropy import units as u # LOCAL -from . import exceptions, specio, units -from .compat import HAS_DUST_EXTINCTION -from .config import Conf -from .models import Empirical1D -from .spectrum import BaseUnitlessSpectrum +from synphot import exceptions, specio, units +from synphot.compat import HAS_DUST_EXTINCTION +from synphot.config import Conf +from synphot.models import Empirical1D +from synphot.spectrum import BaseUnitlessSpectrum __all__ = ['ExtinctionModel1D', 'ReddeningLaw', 'ExtinctionCurve', 'etau_madau'] diff --git a/synphot/specio.py b/synphot/specio.py index 8d93aa9..925f98b 100644 --- a/synphot/specio.py +++ b/synphot/specio.py @@ -16,8 +16,7 @@ from astropy.utils.exceptions import AstropyUserWarning # LOCAL -from . import exceptions, units -from synphot import __version__ +from synphot import __version__, exceptions, units __all__ = ['read_remote_spec', 'read_spec', 'read_ascii_spec', 'read_fits_spec', 'write_fits_spec'] diff --git a/synphot/spectrum.py b/synphot/spectrum.py index 75057d5..4a895c3 100644 --- a/synphot/spectrum.py +++ b/synphot/spectrum.py @@ -20,9 +20,9 @@ from astropy.utils import metadata # LOCAL -from . import exceptions, specio, units, utils -from .config import Conf, conf -from .models import ConstFlux1D, Empirical1D, get_waveset, get_metadata +from synphot import exceptions, specio, units, utils +from synphot.config import Conf, conf +from synphot.models import ConstFlux1D, Empirical1D, get_waveset, get_metadata __all__ = ['BaseSpectrum', 'BaseSourceSpectrum', 'SourceSpectrum', 'BaseUnitlessSpectrum', 'SpectralElement'] @@ -874,7 +874,7 @@ def to_spectrum1d(self, wavelengths=None, **kwargs): ``specutils`` is not installed. """ - from .compat import HAS_SPECUTILS + from synphot.compat import HAS_SPECUTILS if not HAS_SPECUTILS: # pragma: no cover raise ImportError('specutils must be installed to use this method') diff --git a/synphot/thermal.py b/synphot/thermal.py index 2ccb1e2..093d412 100644 --- a/synphot/thermal.py +++ b/synphot/thermal.py @@ -6,9 +6,9 @@ from astropy.io import fits # LOCAL -from . import exceptions, specio, units -from .models import BlackBody1D, Empirical1D -from .spectrum import BaseUnitlessSpectrum, SourceSpectrum +from synphot import exceptions, specio, units +from synphot.models import BlackBody1D, Empirical1D +from synphot.spectrum import BaseUnitlessSpectrum, SourceSpectrum __all__ = ['ThermalSpectralElement'] diff --git a/synphot/units.py b/synphot/units.py index e9ba208..e3c4f9f 100644 --- a/synphot/units.py +++ b/synphot/units.py @@ -106,7 +106,7 @@ def spectral_density_count(wav, area): List of equivalencies. """ - from .binning import calculate_bin_widths, calculate_bin_edges + from synphot.binning import calculate_bin_widths, calculate_bin_edges wav = wav.to(u.AA, equivalencies=u.spectral()) area = area.to(AREA) @@ -221,7 +221,7 @@ def _convert_flux(wavelengths, fluxes, out_flux_unit, area=None, # VEGAMAG if VEGAMAG.to_string() in flux_unit_names: - from .spectrum import SourceSpectrum + from synphot.spectrum import SourceSpectrum if not isinstance(vegaspec, SourceSpectrum): raise exceptions.SynphotError('Vega spectrum is missing.') diff --git a/synphot/utils.py b/synphot/utils.py index dae512c..99cb398 100644 --- a/synphot/utils.py +++ b/synphot/utils.py @@ -14,7 +14,7 @@ from astropy.utils.data import download_file # LOCAL -from . import exceptions, units +from synphot import exceptions, units __all__ = ['overlap_status', 'validate_totalflux', 'validate_wavelengths', 'generate_wavelengths', 'merge_wavelengths', 'download_data'] @@ -289,7 +289,7 @@ def download_data(path_root, verbose=True, dry_run=False): A list of downloaded files. """ - from .config import conf # Avoid potential circular import + from synphot.config import conf # Avoid potential circular import BASE_HOST = 'https://ssb.stsci.edu/trds/' if path_root is not None: diff --git a/tox.ini b/tox.ini index 0a304ca..b26058a 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,6 @@ deps = # The devdeps factor is intended to be used to install the latest developer version # or nightly wheel of key dependencies. - devdeps: git+https://github.com/astropy/astropy.git@main#egg=astropy devdeps: git+https://github.com/astropy/specutils.git@main#egg=specutils cov: pytest-cov @@ -54,6 +53,7 @@ extras = alldeps: all commands = + devdeps: pip install -U -i https://pypi.anaconda.org/astropy/simple astropy --pre pip freeze !cov: pytest --pyargs synphot {toxinidir}/docs {posargs} cov: pytest --pyargs synphot {toxinidir}/docs --cov synphot --cov-config={toxinidir}/setup.cfg {posargs} From 5d95783106ab0dc989cc4079a6cf6e01f98fbc9f Mon Sep 17 00:00:00 2001 From: Pey Lian Lim <2090236+pllim@users.noreply.github.com> Date: Tue, 27 Dec 2022 16:55:47 -0500 Subject: [PATCH 3/3] Fix line too long --- synphot/observation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/synphot/observation.py b/synphot/observation.py index 73ecd04..b90546b 100644 --- a/synphot/observation.py +++ b/synphot/observation.py @@ -20,7 +20,8 @@ # LOCAL from synphot import binning, exceptions, units, utils from synphot.models import Empirical1D -from synphot.spectrum import BaseSourceSpectrum, SourceSpectrum, SpectralElement +from synphot.spectrum import (BaseSourceSpectrum, SourceSpectrum, + SpectralElement) __all__ = ['Observation']