Skip to content

Commit

Permalink
First version of PPDB classes and CLI tools.
Browse files Browse the repository at this point in the history
The main purpose of this package id to implement management tools for
PDDB, including tools for migration of APDB data to PPDB. Regular clients
will access PDDB either via SQL or using TAP services.

What is implemented on thi ticket:
- Added base Ppdb class with factory methods, and its SQL implementation.
- Two CLI tools - `ppdb-cli` for general commands and `ppdb-replication`
  for replication-related stuff.
- Efficient bulk insert methods for Postgres.
  • Loading branch information
andy-slac committed Apr 16, 2024
1 parent b78bfa5 commit af6e00a
Show file tree
Hide file tree
Showing 34 changed files with 2,064 additions and 27 deletions.
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

on:
push:
branches:
- main
pull_request:

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

on:
- push
- pull_request
push:
branches:
- main
pull_request:

jobs:
lint:
call-workflow:
uses: lsst/rubin_workflows/.github/workflows/lint.yaml@main
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install
run: pip install -r <(curl https://raw.githubusercontent.com/lsst/linting/main/requirements.txt)

- name: Run linter
run: flake8
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
11 changes: 11 additions & 0 deletions .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Run mypy

on:
push:
branches:
- main
pull_request:

jobs:
call-workflow:
uses: lsst/rubin_workflows/.github/workflows/mypy.yaml@main
1 change: 0 additions & 1 deletion .github/workflows/rebase_checker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: Check that 'main' is not merged into the development branch

on: pull_request
Expand Down
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

on:
push:
branches:
- main
pull_request:

jobs:
call-workflow:
uses: lsst/rubin_workflows/.github/workflows/yamllint.yaml@main
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
args:
- "--unsafe"
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.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.11
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.1
hooks:
- id: ruff
18 changes: 18 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
extends: default
rules:
document-start:
present: false
ignore: |
/tests/config/schema.yaml
line-length:
max: 132
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
ignore: |
/.github/workflows/lint.yaml
truthy:
# "on" as a key in workflows confuses things
ignore: |
/.github/workflows/
indentation:
indent-sequences: consistent
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
dax_ppdb
########


``dax_ppdb`` is a package in the `LSST Science Pipelines <https://pipelines.lsst.io>`_.

.. Add a brief (few sentence) description of what this package provides.
1 change: 1 addition & 0 deletions bin.src/SConscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- python -*-
from lsst.sconsUtils import scripts

scripts.BasicSConscript.shebang()
6 changes: 6 additions & 0 deletions bin.src/ppdb-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python

from lsst.dax.ppdb.cli import ppdb_cli

if __name__ == "__main__":
ppdb_cli.main()
6 changes: 6 additions & 0 deletions bin.src/ppdb-replication
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python

from lsst.dax.ppdb.cli import ppdb_replication

if __name__ == "__main__":
ppdb_replication.main()
28 changes: 28 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[mypy]
ignore_errors = False
warn_unused_configs = True
warn_redundant_casts = True
ignore_missing_imports = False
disallow_untyped_defs = True
disallow_incomplete_defs = True

[mypy-astropy.*]
ignore_missing_imports = True

[mypy-lsst.daf.*]
ignore_missing_imports = True

[mypy-lsst.sphgeom]
ignore_missing_imports = True

[mypy-lsst.dax.ppdb.*]
ignore_missing_imports = False
ignore_errors = False
disallow_untyped_defs = True
disallow_incomplete_defs = True
strict_equality = True
warn_unreachable = True
warn_unused_ignores = True

[mypy-lsst.dax.ppdb.version]
ignore_errors = True
109 changes: 109 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
[build-system]
requires = ["setuptools", "lsst-versions >= 1.3.0"]
build-backend = "setuptools.build_meta"

[project]
name = "lsst-dax-ppdb"
description = "Prompt Products Database for LSST AP pipeline."
license = {text = "GPLv3+ License"}
readme = "README.md"
authors = [
{name="Rubin Observatory Data Management", email="[email protected]"},
]
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Astronomy",
]
keywords = ["lsst"]
dependencies = [
"astropy",
"pyyaml >= 5.1",
"sqlalchemy",
"lsst-felis",
"lsst-utils",
"lsst-resources",
"lsst-dax-apdb",
]
dynamic = ["version"]

[project.urls]
"Homepage" = "https://github.com/lsst/dax_ppdb"

[project.optional-dependencies]
test = [
"pytest >= 3.2",
"pytest-openfiles >= 0.5.0"
]

[tool.setuptools.packages.find]
where = ["python"]

[tool.setuptools]
zip-safe = true
license-files = ["COPYRIGHT", "LICENSE"]

[tool.setuptools.package-data]
"lsst.dax.ppdb" = ["py.typed"]

[tool.setuptools.dynamic]
version = { attr = "lsst_versions.get_lsst_version" }

[tool.black]
line-length = 110
target-version = ["py311"]

[tool.isort]
profile = "black"
line_length = 110

[tool.lsst_versions]
write_to = "python/lsst/dax/ppdb/version.py"

[tool.ruff]
exclude = [
"__init__.py",
"doc/conf.py",
]
line-length = 110
target-version = "py311"

[tool.ruff.lint]
ignore = [
"N802",
"N803",
"N806",
"N812",
"N815",
"N816",
"N999",
"D107",
"D105",
"D102",
"D104",
"D100",
"D200",
"D205",
"D400",
]
select = [
"E", # pycodestyle
"F", # pycodestyle
"N", # pep8-naming
"W", # pycodestyle
"D", # pydocstyle
]
extend-select = [
"RUF100", # Warn about unused noqa
]

[tool.ruff.lint.pycodestyle]
max-doc-length = 79

[tool.ruff.lint.pydocstyle]
convention = "numpy"
1 change: 1 addition & 0 deletions python/lsst/dax/ppdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
# 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 .ppdb import *
from .version import * # Generated by sconsUtils
Loading

0 comments on commit af6e00a

Please sign in to comment.