-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from lsst/tickets/DM-46273
DM-46273: Add Python packaging with ResourcePath support
- Loading branch information
Showing
8 changed files
with
783 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Copyright 2010-2024 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory | ||
Copyright 2010-2024 Association of Universities for Research in Astronomy, Inc. (AURA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[build-system] | ||
requires = ["setuptools", "lsst-versions >= 1.3.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "lsst-sdm-schemas" | ||
description = "Science Data Model (SDM) Schemas for Rubin Observatory" | ||
license = {text = "GNU General Public License v3 or later (GPLv3+)"} | ||
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.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Scientific/Engineering :: Astronomy" | ||
] | ||
keywords = ["lsst"] | ||
dependencies = [ | ||
"lsst-felis @ git+http://github.com/lsst/felis.git@main", | ||
"click", | ||
"pyyaml", | ||
"psycopg2", | ||
"pymysql", | ||
"cryptography" | ||
] | ||
requires-python = ">=3.11.0" | ||
dynamic = ["version"] | ||
|
||
[project.urls] | ||
Homepage = "https://sdm-schemas.lsst.io" | ||
Source = "https://github.com/lsst/sdm_schemas" | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"pytest >= 3.2" | ||
] | ||
|
||
[tool.setuptools] | ||
zip-safe = true | ||
license-files = ["COPYRIGHT", "LICENSE"] | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["python"] | ||
|
||
[tool.setuptools.package-data] | ||
"lsst.sdm_schemas" = ["schemas/*.yaml"] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../yml/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This file is part of sdm_schemas. | ||
# | ||
# 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/>. | ||
|
||
import unittest | ||
import importlib.resources | ||
import yaml | ||
|
||
from felis.datamodel import Schema | ||
|
||
|
||
class SchemaResourceTestCase(unittest.TestCase): | ||
"""Test reading of schema data from a resource.""" | ||
|
||
def test_read_resource(self) -> None: | ||
"""Test that schema data can be read from a resource.""" | ||
resource = importlib.resources.files("lsst.sdm_schemas.schemas").joinpath( | ||
"dp02_dc2.yaml" | ||
) | ||
raw_data = resource.read_text() | ||
data = yaml.safe_load(raw_data) | ||
Schema.model_validate(data) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |