Skip to content

Commit

Permalink
Renaming the package to be AstrodbKit (astrodbtoolkit#82)
Browse files Browse the repository at this point in the history
* Renaming package to be AstrodbKit

* Updating readme

* Updating tests

* updating manifest

* Updating github actions
  • Loading branch information
dr-rodriguez authored Sep 11, 2024
1 parent 4043a64 commit fb00c4b
Show file tree
Hide file tree
Showing 21 changed files with 94 additions and 96 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test Astrodbkit2
name: Test Astrodbkit

on:
push:
Expand All @@ -18,9 +18,9 @@ jobs:
python-version: [3.8, 3.9, '3.10', 3.11]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -31,9 +31,9 @@ jobs:
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
ruff check astrodbkit2 --select=E9,F63,F7,F82 --statistics
ruff check astrodbkit --select=E9,F63,F7,F82 --statistics
# exit-zero treats all errors as warnings.
ruff check astrodbkit2 --config=pyproject.toml --exit-zero
ruff check astrodbkit --config=pyproject.toml --exit-zero
- name: Test with pytest
run: |
pytest --cov --cov-config=setup.cfg --cov-report=term --cov-report=xml:coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include setup.cfg
include LICENSE.rst
include pyproject.toml

recursive-include astrodbkit2 *.pyx *.c *.pxd
recursive-include astrodbkit *.pyx *.c *.pxd
recursive-include docs *
recursive-include licenses *
recursive-include scripts *
Expand Down
16 changes: 8 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ Astronomical database handler code
:target: http://www.astropy.org
:alt: Powered by Astropy Badge

.. image:: https://github.com/astrodbtoolkit/AstrodbKit2/workflows/Test%20Astrodbkit2/badge.svg?branch=main
:target: https://github.com/astrodbtoolkit/AstrodbKit2/actions
.. image:: https://github.com/astrodbtoolkit/AstrodbKit/workflows/Test%20Astrodbkit/badge.svg?branch=main
:target: https://github.com/astrodbtoolkit/AstrodbKit/actions

.. image:: https://codecov.io/gh/astrodbtoolkit/AstrodbKit2/graph/badge.svg?token=LMKVN65D82
:target: https://codecov.io/gh/astrodbtoolkit/AstrodbKit2
.. image:: https://codecov.io/gh/astrodbtoolkit/AstrodbKit/graph/badge.svg?token=LMKVN65D82
:target: https://codecov.io/gh/astrodbtoolkit/AstrodbKit

AstrodbKit2 is an astronomical database handler code built on top of SQLAlchemy.
AstrodbKit is an astronomical database handler code built on top of SQLAlchemy.
This is built to work with the `SIMPLE database <https://github.com/SIMPLE-AstroDB/SIMPLE-db>`_, though
similarly constructed databases will work.

Documentation is available at `https://astrodbkit2.readthedocs.io/en/latest/ <https://astrodbkit2.readthedocs.io/en/latest/>`_
Documentation is available at `https://astrodbkit.readthedocs.io/en/latest/ <https://astrodbkit.readthedocs.io/en/latest/>`_

License
-------
Expand All @@ -30,7 +30,7 @@ more information.
Contributing
------------

We love contributions! `AstrodbKit2 <https://astrodbkit2.readthedocs.io/en/latest/>`_ is open source,
We love contributions! `AstrodbKit <https://astrodbkit.readthedocs.io/en/latest/>`_ is open source,
built on open source, and we'd love to have you hang out in our community.

**Imposter syndrome disclaimer**: We want your help. No, really.
Expand All @@ -56,5 +56,5 @@ the errors and assumptions that seasoned contributors have glossed over.
Note: This disclaimer was originally written by
`Adrienne Lowe <https://github.com/adriennefriend>`_ for a
`PyCon talk <https://www.youtube.com/watch?v=6Uj746j9Heo>`_, and was adapted by
AstrodbKit2 based on its use in the README file for the
AstrodbKit based on its use in the README file for the
`MetPy project <https://github.com/Unidata/MetPy>`_.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from sqlalchemy import Boolean, Column, Enum, Float, ForeignKey, String
from sqlalchemy.orm import validates

from astrodbkit2.astrodb import Base
from astrodbkit2.views import view
from astrodbkit.astrodb import Base
from astrodbkit.views import view


# -------------------------------------------------------------------------------------------------------------------
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from astropy.units.quantity import Quantity
from sqlalchemy.exc import IntegrityError

from astrodbkit2.astrodb import Database, copy_database_schema, create_database
from astrodbkit2.schema_example import *
from astrodbkit2.views import view
from astrodbkit.astrodb import Database, copy_database_schema, create_database
from astrodbkit.schema_example import *
from astrodbkit.views import view

try:
import mock
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_query_data(db):
assert db.query(db.Sources.c.source).limit(1).all()[0][0] == '2MASS J13571237+1428398'


@mock.patch('astrodbkit2.astrodb.get_simbad_names', return_value=['fake'])
@mock.patch('astrodbkit.astrodb.get_simbad_names', return_value=['fake'])
def test_search_object(mock_simbad, db):
# Use the search_object method to do partial string searching

Expand Down Expand Up @@ -310,7 +310,7 @@ def test_query_formats(db):
assert isinstance(t, pd.DataFrame)


@mock.patch('astrodbkit2.astrodb.load_spectrum')
@mock.patch('astrodbkit.astrodb.load_spectrum')
def test_query_spectra(mock_spectrum, db):
# Test special conversions in query methods
def fake_loader(x, spectra_format=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from astropy.io import fits
from astropy.units import Unit

from astrodbkit2.spectra import (
from astrodbkit.spectra import (
_identify_spex,
identify_spex_prism,
identify_wcs1d_multispec,
Expand Down Expand Up @@ -85,7 +85,7 @@ def alt_wcs1dmultispec():
return fits.HDUList([hdu1])


@mock.patch("astrodbkit2.spectra.fits.open")
@mock.patch("astrodbkit.spectra.fits.open")
def test_identify_spex_prism(mock_fits_open, good_spex_file):
mock_fits_open.return_value = good_spex_file

Expand All @@ -95,15 +95,15 @@ def test_identify_spex_prism(mock_fits_open, good_spex_file):
assert not identify_spex_prism("read", filename)


@mock.patch("astrodbkit2.spectra.fits.open")
@mock.patch("astrodbkit.spectra.fits.open")
def test_identify_spex(mock_fits_open, good_spex_file, bad_spex_file):
mock_fits_open.return_value = good_spex_file
assert _identify_spex("filename")
mock_fits_open.return_value = bad_spex_file
assert not _identify_spex("filename")


@mock.patch("astrodbkit2.spectra.fits.open")
@mock.patch("astrodbkit.spectra.fits.open")
def test_load_spex_prism(mock_fits_open, good_spex_file, bad_spex_file):
# Test good example
mock_fits_open.return_value = good_spex_file
Expand All @@ -115,15 +115,15 @@ def test_load_spex_prism(mock_fits_open, good_spex_file, bad_spex_file):
assert spectrum.unit == Unit("erg")


@mock.patch("astrodbkit2.spectra.read_fileobj_or_hdulist")
@mock.patch("astrodbkit.spectra.read_fileobj_or_hdulist")
def test_identify_wcs1d_multispec(mock_fits_open, good_wcs1dmultispec):
mock_fits_open.return_value = good_wcs1dmultispec

filename = "https://s3.amazonaws.com/bdnyc/optical_spectra/U10929.fits"
assert identify_wcs1d_multispec("read", filename)


@mock.patch("astrodbkit2.spectra.read_fileobj_or_hdulist")
@mock.patch("astrodbkit.spectra.read_fileobj_or_hdulist")
def test_wcs1d_multispec_loader(mock_fits_open, good_wcs1dmultispec, alt_wcs1dmultispec):
mock_fits_open.return_value = good_wcs1dmultispec

Expand All @@ -142,7 +142,7 @@ def test_wcs1d_multispec_loader(mock_fits_open, good_wcs1dmultispec, alt_wcs1dmu
assert spectrum.wavelength.unit == Unit("Angstrom")


@mock.patch("astrodbkit2.spectra.Spectrum1D.read")
@mock.patch("astrodbkit.spectra.Spectrum1D.read")
def test_load_spectrum(mock_spectrum1d, monkeypatch):
_ = load_spectrum("fake_file.txt")
mock_spectrum1d.assert_called_with("fake_file.txt")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
from astropy.table import Table

from astrodbkit2.utils import _name_formatter, datetime_json_parser, get_simbad_names, json_serializer
from astrodbkit.utils import _name_formatter, datetime_json_parser, get_simbad_names, json_serializer

try:
import mock
Expand Down Expand Up @@ -51,7 +51,7 @@ def test_datetime_json_parser():
assert isinstance(new_dict['number'], float)


@mock.patch('astrodbkit2.utils.Simbad.query_objectids')
@mock.patch('astrodbkit.utils.Simbad.query_objectids')
def test_get_simbad_names(mock_simbad):
mock_simbad.return_value = Table({'ID': ['name 1', 'name 2', 'V* name 3', 'HIDDEN name']})
t = get_simbad_names('twa 27')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sqlalchemy as sa
from sqlalchemy.orm import Session, declarative_base

from astrodbkit2.views import *
from astrodbkit.views import *


def test_views():
Expand Down
2 changes: 1 addition & 1 deletion astrodbkit2/utils.py → astrodbkit/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Utility functions for Astrodbkit2"""
"""Utility functions for Astrodbkit"""

import functools
import re
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/astrodb.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
astrodb module
==============

.. automodule:: astrodbkit2.astrodb
.. automodule:: astrodbkit.astrodb
:members:
:ignore-module-all:
:undoc-members:
Expand Down
Loading

0 comments on commit fb00c4b

Please sign in to comment.