Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITCOM-1042: Add initial python code #1

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Checklist

- [ ] ran Jenkins
- [ ] added a release note for user-visible changes to `doc/changes`
55 changes: 55 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build_and_test

Check warning on line 1 in .github/workflows/build.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

1:1 [document-start] missing document start "---"

on:
push:
branches:
- main
tags:
- "*"
pull_request:

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Need to clone everything for the git tags.
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "setup.cfg"

- name: Install yaml
run: sudo apt-get install libyaml-dev

- name: Install prereqs for setuptools
run: pip install wheel

# We have two cores so we can speed up the testing with xdist
- name: Install xdist, openfiles and flake8 for pytest
run: >
pip install pytest-xdist pytest-openfiles pytest-flake8
pytest-cov "flake8<5"

- name: Build and install
run: pip install -v -e .

- name: Install documenteer
run: pip install 'documenteer[pipelines]<0.7'

- name: Run tests
run: >
pytest -r a -v -n 3 --open-files --cov=tests
--cov=lsst.rubintv.analysis.service
--cov-report=xml --cov-report=term
--doctest-modules --doctest-glob="*.rst"

- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
41 changes: 41 additions & 0 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: docs

on:
push:
branches:
- main
pull_request:

jobs:
build_sphinx_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Need to clone everything for the git tags.
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "setup.cfg"

- name: Update pip/wheel infrastructure
run: |
python -m pip install --upgrade pip
pip install wheel

- name: Build and install
run: pip install -v -e .

- name: Show compiled files
run: ls python/lsst/rubintv/analysis/service

- name: Install documenteer
run: pip install 'documenteer[pipelines]<0.7'

- name: Build documentation
working-directory: ./doc
run: package-docs build
11 changes: 11 additions & 0 deletions .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Check Python formatting

Check warning on line 1 in .github/workflows/formatting.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/formatting.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

3:1 [truthy] truthy value should be one of [false, true]
push:
branches:
- main
pull_request:

jobs:
call-workflow:
uses: lsst/rubin_workflows/.github/workflows/formatting.yaml@main
11 changes: 11 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: lint

Check warning on line 1 in .github/workflows/lint.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/lint.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

3:1 [truthy] truthy value should be one of [false, true]
push:
branches:
- main
pull_request:

jobs:
call-workflow:
uses: lsst/rubin_workflows/.github/workflows/lint.yaml@main
11 changes: 11 additions & 0 deletions .github/workflows/yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Lint YAML Files

Check warning on line 1 in .github/workflows/yamllint.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/yamllint.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

3:1 [truthy] truthy value should be one of [false, true]
push:
branches:
- main
pull_request:

jobs:
call-workflow:
uses: lsst/rubin_workflows/.github/workflows/yamllint.yaml@main
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
repos:

Check warning on line 1 in .pre-commit-config.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

1:1 [document-start] missing document start "---"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
args:
- "--unsafe"
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
# It is recommended to specify the latest version of Python

# supported by your project here, or alternatively use

# pre-commit's default_language_version, see

# https://pre-commit.com/#top_level-default_language_version

language_version: python3.10
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
10 changes: 10 additions & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Doxygen products
html
xml
*.tag
*.inc
doxygen.conf

# Sphinx products
_build
py-api
3 changes: 3 additions & 0 deletions doc/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- python -*-
from lsst.sconsUtils import scripts
scripts.BasicSConscript.doc()
12 changes: 12 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Sphinx configuration file for an LSST stack package.
This configuration only affects single-package Sphinx documentation builds.
For more information, see:
https://developer.lsst.io/stack/building-single-package-docs.html
"""

from documenteer.conf.pipelinespkg import *

project = "rubintv_analysis_service"
html_theme_options["logotext"] = project
html_title = project
html_short_title = project
Empty file added doc/doxygen.conf.in
Empty file.
12 changes: 12 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
##############################################
rubintv_analysis_service documentation preview
##############################################

.. This page is for local development only. It isn't published to pipelines.lsst.io.

.. Link the index pages of package and module documentation directions (listed in manifest.yaml).

.. toctree::
:maxdepth: 1

lsst.rubintv.analysis.service/index
40 changes: 40 additions & 0 deletions doc/lsst.rubintv.analysis.service/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.. py:currentmodule:: lsst.rubintv.analysis.service

.. _lsst.rubintv.analysis.service:

#############################
lsst.rubintv.analysis.service
#############################

.. Paragraph that describes what this Python module does and links to related modules and frameworks.

.. _lsst.rubintv.analysis.service-using:

Using lsst.rubintv.analysis.service
=======================

toctree linking to topics related to using the module's APIs.

.. toctree::
:maxdepth: 2

.. _lsst.rubintv.analysis.service-contributing:

Contributing
============

``lsst.rubintv.analysis.service`` is developed at https://github.com/lsst-ts/rubintv_analysis_service.

.. If there are topics related to developing this module (rather than using it), link to this from a toctree placed here.

.. .. toctree::
.. :maxdepth: 2

.. _lsst.rubintv.analysis.service-pyapi:

Python API reference
====================

.. automodapi:: lsst.rubintv.analysis.service
:no-main-docstr:
:no-inheritance-diagram:
12 changes: 12 additions & 0 deletions doc/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Documentation manifest.

# List of names of Python modules in this package.
# For each module there is a corresponding module doc subdirectory.
modules:

Check warning on line 5 in doc/manifest.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

5:1 [document-start] missing document start "---"
- "lsst.rubintv.analysis.service"

# Name of the static content directories (subdirectories of `_static`).
# Static content directories are usually named after the package.
# Most packages do not need a static content directory (leave commented out).
# statics:
# - "_static/example_standalone"
22 changes: 22 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[mypy]
warn_unused_configs = True
warn_redundant_casts = True
plugins = pydantic.mypy

[mypy-astropy.*]
ignore_missing_imports = True

[mypy-matplotlib.*]
ignore_missing_imports = True

[mypy-numpy.*]
ignore_missing_imports = True

[mypy-scipy.*]
ignore_missing_imports = True

[mypy-sqlalchemy.*]
ignore_missing_imports = True

[mypy-yaml.*]
ignore_missing_imports = True
13 changes: 8 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ dependencies = [
"scipy",
"matplotlib",
"pydantic",
"pyyaml"
"pyyaml",
"sqlalchemy",
"astropy",
"websocket-client",
"lsst-daf-butler",
# temporary dependency for testing
"tornado",
]
#dynamic = ["version"]

[project.urls]
"Homepage" = "https://github.com/lsst/rubintv_analysis_service"
"Homepage" = "https://github.com/lsst-ts/rubintv_analysis_service"

[project.optional-dependencies]
test = [
Expand Down Expand Up @@ -65,9 +71,6 @@ line_length = 110
[tool.lsst_versions]
write_to = "python/lsst/rubintv/analysis/service/version.py"

[tool.pytest.ini_options]
addopts = "--flake8"
flake8-ignore = ["W503", "E203"]
# The matplotlib test may not release font files.
open_files_ignore = ["*.ttf"]

Expand Down
2 changes: 1 addition & 1 deletion python/lsst/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
__path__ = pkgutil.extend_path(__path__, __name__)
2 changes: 1 addition & 1 deletion python/lsst/rubintv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
__path__ = pkgutil.extend_path(__path__, __name__)
2 changes: 1 addition & 1 deletion python/lsst/rubintv/analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
__path__ = pkgutil.extend_path(__path__, __name__)
1 change: 1 addition & 0 deletions python/lsst/rubintv/analysis/service/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import command, database, query, utils
29 changes: 29 additions & 0 deletions python/lsst/rubintv/analysis/service/butler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file is part of lsst_rubintv_analysis_service.
#
# Developed for the LSST Data Management System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from dataclasses import dataclass

from .command import BaseCommand


@dataclass
class ExampleButlerCommand(BaseCommand):
pass
Loading
Loading