diff --git a/.abcli/hubble.sh b/.abcli/hubble.sh index 04797f2..2260632 100755 --- a/.abcli/hubble.sh +++ b/.abcli/hubble.sh @@ -12,6 +12,11 @@ function abcli_hubble() { abcli_hubble_list "$@" abcli_hubble_select "$@" + local task + for task in pylint pytest test; do + abcli_hubble $task "$@" + done + if [ "$(abcli_keyword_is $2 verbose)" == true ]; then python3 -m hubble --help fi diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000..f2edf7d --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,23 @@ +name: Pylint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + - name: Analysing the code with pylint + run: | + pylint -d W1203,C0103,C0111,C0114,C0115,C0116,C0411,W0404,W0237,C0209,C0415,W0621,W0702,W0102,W1202,E0401,W1514,C3002,W0401,W0611,C0413,C0412,W0603,R0911,E1101,W0622,R1721,W0718,R1728,C3001,R0801,R0401,R0914,R0913,R0915,W0123,R0912,C0301,W0511,W0105,W0613,R0902,R0903,R1735,W1401,W3101,W1308,E1102 $(git ls-files '*.py') diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..3a69b2d --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,25 @@ +name: pytest + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + pip install pytest + pip install -r requirements.txt + - name: Run tests + run: | + pytest diff --git a/hubble/__init__.py b/hubble/__init__.py index 241cbd6..6e58415 100644 --- a/hubble/__init__.py +++ b/hubble/__init__.py @@ -1,8 +1,7 @@ NAME = "hubble" -VERSION = "3.298.1" +ICON = "🔭" -DESCRIPTION = "🔭 tools to access and process Hubble Space Telescope imagery and other datasets on AWS Open Data Registry." +DESCRIPTION = f"{ICON} tools to access and process Hubble Space Telescope imagery and other datasets on AWS Open Data Registry." -from hubble.datasets import * -from hubble.fits import * +VERSION = "3.299.1" diff --git a/hubble/__main__.py b/hubble/__main__.py index ccd2825..4c64ac8 100644 --- a/hubble/__main__.py +++ b/hubble/__main__.py @@ -2,10 +2,7 @@ from hubble.datasets import get from hubble.ingest import ingest from hubble import NAME, VERSION, DESCRIPTION -from abcli import logging -import logging - -logger = logging.getLogger(__name__) +from hubble.logger import logger parser = argparse.ArgumentParser(NAME, description=f"{NAME}-{VERSION}") parser.add_argument( diff --git a/hubble/datasets.py b/hubble/datasets.py index 424ef59..d532cae 100644 --- a/hubble/datasets.py +++ b/hubble/datasets.py @@ -2,10 +2,7 @@ from abcli import env, file from typing import Any from abcli import string -from abcli import logging -import logging - -logger = logging.getLogger(__name__) +from hubble.logger import logger # https://registry.opendata.aws/hst/ diff --git a/hubble/ingest.py b/hubble/ingest.py index 67816b6..316ca81 100644 --- a/hubble/ingest.py +++ b/hubble/ingest.py @@ -3,10 +3,7 @@ from abcli import file from hubble.fits import load_fit_file from abcli.modules import objects -from abcli import logging -import logging - -logger = logging.getLogger(__name__) +from hubble.logger import logger def ingest( diff --git a/hubble/logger.py b/hubble/logger.py new file mode 100644 index 0000000..28f6b4d --- /dev/null +++ b/hubble/logger.py @@ -0,0 +1,4 @@ +from abcli.logger import logging +from hubble import ICON + +logger = logging.getLogger(f"{ICON} ") diff --git a/notebooks/hst.ipynb b/notebooks/hst.ipynb index 07c5fef..86a4def 100644 --- a/notebooks/hst.ipynb +++ b/notebooks/hst.ipynb @@ -33,11 +33,7 @@ "from abcli.plugins import seed\n", "from hubble import NAME, VERSION\n", "from hubble.ingest import ingest\n", - "\n", - "import abcli.logging\n", - "import logging\n", - "\n", - "logger = logging.getLogger()\n", + "from abcli.logger import logger\n", "\n", "logger.info(f\"{NAME}.{VERSION}.{fullname()}, built on {string.pretty_date()}\")" ]