Skip to content

Commit

Permalink
Merge pull request #71 from lsst/tickets/DM-42636
Browse files Browse the repository at this point in the history
DM-42636: Add ObservationInfo.observing_day_offset
  • Loading branch information
timj committed Feb 29, 2024
2 parents b8aeb2f + 5c1496b commit 6935484
Show file tree
Hide file tree
Showing 31 changed files with 677 additions and 322 deletions.
42 changes: 26 additions & 16 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,66 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
with:
# Need to clone everything to determine version from git.
fetch-depth: 0
cache: "pip"
cache-dependency-path: "setup.cfg"

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

- name: Install packages
- name: Install debian packages
run: sudo apt-get install graphviz

- name: Set the VIRTUAL_ENV variable for uv to work
run: |
echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
- name: Install uv
run: |
python -m pip install --upgrade pip
pip install uv
# We have two cores so we can speed up the testing with xdist
- name: Install xdist and openfiles
run: pip install pytest-xdist pytest-openfiles pytest-cov
run: uv pip install pytest-xdist pytest-cov

- name: Install dependencies
run: pip install -r requirements.txt
run: uv pip install -r requirements.txt

- name: Build and install
run: pip install -v .
run: uv pip install -v --no-deps -e .

- name: Run tests
run: pytest -r a -v -n 3 --open-files --cov=astro_metadata_translator --cov=tests --cov-report=xml --cov-report=term --cov-branch
run: pytest -r a -v -n 3 --cov=astro_metadata_translator --cov=tests --cov-report=xml --cov-report=term --cov-branch

- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml

- name: Install documenteer
run: pip install -r doc/requirements.txt
run: uv pip install -r doc/requirements.txt

- name: Build documentation
if: ${{ matrix.python-version == '3.10' }}
if: ${{ matrix.python-version == '3.11' }}
run: package-docs build -n -W

- name: Landing page upload
if: ${{ github.event_name == 'push' && matrix.python-version == '3.10' }}
env:
LTD_PASSWORD: ${{ secrets.LTD_PASSWORD }}
LTD_USERNAME: ${{ secrets.LTD_USERNAME }}
run: |
ltd upload --gh --product "astro-metadata-translator" --dir doc/_build/html
if: ${{ github.event_name == 'push' && matrix.python-version == '3.11' }}
uses: lsst-sqre/ltd-upload@v1
with:
project: 'astro-metadata-translator'
dir: 'doc/_build/html'
password: ${{ secrets.LTD_PASSWORD }}
username: ${{ secrets.LTD_USERNAME }}

pypi:

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/docstyle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run docstyle

on:
push:
branches:
- main
pull_request:

jobs:
call-workflow:
uses: lsst/rubin_workflows/.github/workflows/docstyle.yaml@main
with:
args: "python/"
numpydoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4

- name: Install numpydoc
run: |
python -m pip install --upgrade pip
python -m pip install numpydoc
- name: Validate docstrings
run: |
python -m numpydoc.hooks.validate_docstrings $(find python -name "*.py")
python -m numpydoc.hooks.validate_docstrings $(find tests -name "*.py")
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
17 changes: 11 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.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
rev: 24.2.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
Expand All @@ -17,11 +17,16 @@ repos:
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.10
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.1
hooks:
- id: flake8
- id: ruff
- repo: https://github.com/numpy/numpydoc
rev: "v1.6.0"
hooks:
- id: numpydoc-validation
19 changes: 0 additions & 19 deletions bin.src/translate_header.py

This file was deleted.

2 changes: 0 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ Python API reference

.. automodapi:: astro_metadata_translator

.. automodapi:: astro_metadata_translator.bin.translateheader

.. automodapi:: astro_metadata_translator.indexing

.. automodapi:: astro_metadata_translator.file_helpers
71 changes: 70 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,59 @@
[build-system]
requires = ["lsst-versions"]
requires = ["setuptools", "lsst-versions"]
build-backend = "setuptools.build_meta"

[project]
name = "astro-metadata-translator"
requires-python = ">=3.9.0"
description = "A translator for astronomical metadata."
license = {text = "BSD 3-Clause License"}
authors = [
{name="Rubin Observatory Data Management", email="dm-admin@lists.lsst.org"},
]
readme = "README.md"
classifiers = [
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Astronomy",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.9",
]
keywords = ["lsst"]
dynamic = ["version"]
dependencies = [
"astropy >=3.0.5",
"pyyaml >=3.13",
"click >= 8"
]

[project.optional-dependencies]
test = [
"pytest"
]

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

[project.scripts]
astrometadata = "astro_metadata_translator.cli.astrometadata:main"

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

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

[tool.setuptools.package-data]
astro_metadata_translator = ["corrections/*/*.yaml", "corrections/*/*.md", "py.typed"]

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

[tool.black]
line-length = 110
target-version = ["py38"]
Expand Down Expand Up @@ -58,3 +110,20 @@ max-doc-length = 79

[tool.ruff.pydocstyle]
convention = "numpy"

[tool.numpydoc_validation]
checks = [
"all", # All except the rules listed below.
"SA01", # See Also section.
"EX01", # Example section.
"SS06", # Summary can go into second line.
"GL01", # Summary text can start on same line as """
"GL08", # Do not require docstring.
"ES01", # No extended summary required.
"RT01", # Unfortunately our @property trigger this.
"RT02", # Does not want named return value. DM style says we do.
"SS05", # pydocstyle is better at finding infinitive verb.
]
exclude = [
'^astrometadata\.' # CLI does not conform to numpydoc
]

0 comments on commit 6935484

Please sign in to comment.