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

DM-43097: Initial support for APDB-to-PPDB replication. #1

Merged
merged 4 commits into from
Apr 16, 2024
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
67 changes: 67 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: build_and_test

on:
push:
branches:
- main
pull_request:

jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v3
with:
# Need to clone everything for the git tags.
fetch-depth: 0

- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: strict
show-channel-urls: true
miniforge-variant: Mambaforge
use-mamba: true

- name: Update pip/wheel infrastructure
shell: bash -l {0}
run: |
mamba install -y -q pip wheel
pip install uv

- name: Install dependencies
shell: bash -l {0}
run: |
uv pip install -r requirements.txt

# We have two cores so we can speed up the testing with xdist
- name: Install pytest packages
shell: bash -l {0}
run: |
uv pip install \
pytest pytest-xdist pytest-cov

- name: List installed packages
shell: bash -l {0}
run: |
conda list
pip list -v

- name: Build and install
shell: bash -l {0}
run: |
uv pip install -v --no-deps -e .

- name: Run tests
shell: bash -l {0}
run: |
pytest -r a -v -n 3 --cov=lsst.dax.ppdb --cov=tests --cov-report=xml --cov-report=term --cov-branch
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
41 changes: 41 additions & 0 deletions .github/workflows/do_not_merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Check commits can be merged"
on:
push:
branches:
- main
pull_request:

jobs:
do-not-merge-checker:
runs-on: ubuntu-latest

steps:
- name: Check that there are no commits that should not be merged
uses: gsactions/commit-message-checker@v2
with:
excludeDescription: "true" # optional: this excludes the description body of a pull request
excludeTitle: "true" # optional: this excludes the title of a pull request
checkAllCommitMessages: "true" # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
# Check for message indicating that there is a commit that should
# not be merged.
pattern: ^(?!DO NOT MERGE)
flags: "i"
error: |
"This step failed because there is a commit containing the text
'DO NOT MERGE'. Remove this commit from the branch before merging
or change the commit summary."

- uses: actions/checkout@v4

- name: Check requirements.txt for branches
shell: bash
run: |
FILE="requirements.txt"
MATCH=tickets/DM-
if grep -q $MATCH $FILE
then
echo "Ticket branches found in $FILE:"
grep -n $MATCH $FILE
exit 1
fi
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"
Loading
Loading