Skip to content

Commit

Permalink
Merge branch 'release-v0.2.30'
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgee committed Jan 14, 2021
2 parents 65d90ed + 988819f commit 3794292
Show file tree
Hide file tree
Showing 60 changed files with 360 additions and 5,321 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/pythontest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,18 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build panoptes-utils image
run: |
INCLUDE_BASE=true scripts/setup-local-environment.sh
- name: Test with pytest in panoptes-utils container
- name: Build and test panoptes-utils in container
run: |
docker build -t panoptes-utils:testing -f tests/Dockerfile .
mkdir -p logs && chmod -R 777 logs
PANLOG="${PWD}/logs" SLEEP_TIME=0 scripts/testing/test-software.sh
mkdir -p build && chmod -R 777 build
docker run --rm -i -v "${PWD}/build:/var/panoptes/panoptes-utils/build" -v "${PWD}/logs:/var/panoptes/logs" panoptes-utils:testing
- name: Upload coverage report to codecov.io
uses: codecov/codecov-action@v1
if: success()
with:
name: codecov-upload
file: logs/coverage.xml
file: build/coverage.xml
fail_ci_if_error: true
- name: Create log file artifact
uses: actions/upload-artifact@v1
Expand Down
10 changes: 7 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ version: 2
sphinx:
configuration: docs/conf.py

formats: all
formats: htmlzip

python:
version: 3.8
version: 3.7
install:
- requirements: docs/requirements.txt
- method: pip
path: .
extras_requirements:
- config
- docs
- images
- social
system_packages: true
47 changes: 43 additions & 4 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,47 @@
Changelog
=========

0.2.29dev
---------
0.2.30 - 2021-01-14
-------------------

Added
^^^^^

* Conda environment file (@wtgee #260)
* A cli script for ``panoptes-utils``. This will eventually take over the ``panoptes-config-server`` and any other simple commands needed. For now can use ``panoptes-utils tests run`` for building and running tests.

Changed
^^^^^^^

* Updated testing to use specific docker image. Updated run script for more specific options on starting testing config server. (@wtgee #260)
* Different ``extras`` install options: ``config``, ``docs``, ``images``, ``testing``, and ``social``. (@wtgee #260)
* Use ``loguru`` for logging directly in all files, rather than needless import. (@wtgee #260)
* Make the ``CountdownTimer.sleep()`` less noisy. (#259)

Fixed
^^^^^

* Plate solving extras option parsing correctly. (@wtgee #260)
* Explicit imports for some of the utils. (@wtgee #260)

Removed
^^^^^^^

* Remove Docker services except for testing. (@wtgee #260)
* Removed unused files: (@wtgee #260)


* Example data fetching notebook removed.
* Hotspot script removed.
* Data (astrometry index and IERS) download removed.
* ``wait-for-it.sh`` script removed.
* TheSkyX utils moving to POCS directly.
* Removed ``moving_average``.
* Removed pipeline functions for getting ``image_id`` and ``sequence_id``.


0.2.29 - 2020-10-21
-------------------

Added
^^^^^
Expand Down Expand Up @@ -93,7 +132,7 @@ Changed
* ``stop`` command added that sets ``config_server.running=False`` to break loop.


* Testing (@wtgee #241):
* Testing (@wtgee #241):

* All testing is started from ``scripts/test-software.sh``.
* The ``panoptes-config-server`` is started as an external service, not in the pytest conf.
Expand Down Expand Up @@ -348,7 +387,7 @@ Changed
* Allow for different RA/Dec column names.
* Better catalog match function.
* ``sextractor`` param changes. (#194)
* **Breaking** ``panoptes.utils.logger`` -> ``panoptes.utils.logger`` so we can ``from panoptes.utils.logging import logger`` (#197)
* **Breaking** ``panoptes.utils.logger`` -> ``panoptes.utils.logger`` so we can ``from panoptes.utils import logger`` (#197)
* **Breaking** The ``panoptes.utils.data.assets`` module was removed and the
``Downloader`` class is placed directly within the ``scripts/download-data.py`` file. (#197)
* The ``panopes-utils`` module is not installed in editable mode in the ``latest`` docker image. (#197)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ instead of `My File.py`.
than using a directory relative imports such as:
```python
from panoptes.utils.base import PanBase
from panoptes.utils.utils import current_time
from panoptes.utils.time import current_time
```
Import from the top-down instead:
```python
from pocs.base import PanBase
from panoptes.utils import current_time
from panoptes.utils.time import current_time
```
The same applies to code inside of `peas`.
- Test imports are slightly different because `pocs/tests` and `peas/tests` are not Python
Expand Down
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PANOPTES Utilities
==================

<p align="center">
<img src="https://projectpanoptes.org/uploads/2018/12/16/pan-logo.png" alt="PANOPTES logo" />
<img src="https://projectpanoptes.org/uploads/2018/12/16/pan-logo.png" alt="PANOPTES logo" />
</p>
<br>

Expand All @@ -12,6 +12,28 @@ Utility functions for use within the [Project PANOPTES](https://projectpanoptes.

This library defines a number of modules that contain useful functions as well as a few services.

Dependencies
------------

There are a few system dependencies depending on what functionality you will be using.

In particular, the plate solving requires `astrometry.net` and the appropriate index files.

Use the following on a debian-based system (e.g. Ubuntu) to install all dependencies:

```bash
apt-get update

apt-get install --no-install-recommends --yes \
wait-for-it \
bzip2 ca-certificates gcc pkg-config \
libffi-dev libssl-dev \
astrometry.net astrometry-data-tycho2-08 astrometry-data-tycho2 \
dcraw exiftool libcfitsio-dev libcfitsio-bin \
libfreetype6-dev libpng-dev libjpeg-dev libffi-dev \
git
```

Install
-------

Expand All @@ -20,5 +42,11 @@ To install type:
```bash
pip install panoptes-utils
```


Full options for local install:

```bash
pip install -e ".[config,docs,images,testing,social]"
```

See the full documentation at: https://panoptes-utils.readthedocs.io
39 changes: 20 additions & 19 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
import numpy as np
import pytest
from _pytest.logging import caplog as _caplog # noqa
from loguru import logger
from matplotlib import pyplot as plt
from panoptes.utils.config.server import config_server
from panoptes.utils.database import PanDB
from panoptes.utils.logging import logger

_all_databases = ['file', 'memory']

Expand All @@ -21,10 +22,11 @@
"<light-blue>{time:MM-DD HH:mm:ss.ss!UTC}</>" \
"<blue>({time:HH:mm:ss.ss})</> " \
"| <c>{name} {function}:{line}</c> | " \
"<lvl>{message}</lvl>\n"
"<lvl>{message}</lvl>"

# Put the log file in the tmp dir.
log_file_path = os.path.expandvars('${PANLOG}/panoptes-testing.log')
log_dir = os.getenv('PANLOG', '/var/panoptes/logs')
log_file_path = os.path.realpath(f'{log_dir}/panoptes-testing.log')
startup_message = f' STARTING NEW PYTEST RUN - LOGS: {log_file_path} '
logger.add(log_file_path,
enqueue=True, # multiprocessing
Expand All @@ -40,6 +42,21 @@
logger.log('testing', '*' * 25 + startup_message + '*' * 25)


def pytest_configure(config):
"""Set up the testing."""
logger.info('Setting up the config server.')
config_file = 'tests/testing.yaml'

host = 'localhost'
port = '8765'

os.environ['PANOPTES_CONFIG_HOST'] = host
os.environ['PANOPTES_CONFIG_PORT'] = port

config_server(config_file, host='localhost', port=8765, load_local=False, save_local=False)
logger.success('Config server set up')


def pytest_addoption(parser):
db_names = ",".join(_all_databases) + ' (or all for all databases)'
group = parser.getgroup("PANOPTES pytest options")
Expand All @@ -48,11 +65,6 @@ def pytest_addoption(parser):
action="store_true",
default=False,
help="If tests that require solving should be run")
group.addoption(
"--theskyx",
action="store_true",
default=False,
help="If running tests alongside a running TheSkyX program.")
group.addoption(
"--test-databases",
nargs="+",
Expand All @@ -61,16 +73,6 @@ def pytest_addoption(parser):
". Note that travis-ci will test all of them by default."))


@pytest.fixture(scope='session')
def config_host():
return os.getenv('PANOPTES_CONFIG_HOST', 'localhost')


@pytest.fixture(scope='session')
def config_port():
return os.getenv('PANOPTES_CONFIG_PORT', 6563)


@pytest.fixture(scope='session')
def config_path():
return os.getenv('PANOPTES_CONFIG_FILE', '/var/panoptes/panoptes-utils/tests/testing.yaml')
Expand All @@ -92,7 +94,6 @@ def db_type(request):

@pytest.fixture(scope='function')
def db(db_type):
# TODO don't hardcode the db name.
return PanDB(db_type=db_type, db_name='panoptes_testing', storage_dir='testing', connect=True)


Expand Down
36 changes: 0 additions & 36 deletions docker/Dockerfile

This file was deleted.

56 changes: 0 additions & 56 deletions docker/README.md

This file was deleted.

Loading

0 comments on commit 3794292

Please sign in to comment.