Skip to content

Commit

Permalink
initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
perrygreenfield committed Feb 11, 2021
1 parent e1e52a9 commit 403f6b5
Show file tree
Hide file tree
Showing 15 changed files with 912 additions and 0 deletions.
138 changes: 138 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
Empty file added CHANGES.rst
Empty file.
Empty file added CODE_OF_CONDUCT.md
Empty file.
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Please open a new issue or new pull request for bugs, feedback, or new features you would like to see. If there is an issue you would like to work on, please leave a comment and we will be happy to assist. New contributions and contributors are very welcome!

The main development work is done on the "master" branch. The "stable" branch is protected and used for official releases. The rest of the branches are for release maintenance and should not be used normally. Unless otherwise told by a maintainer, pull requests should be made and submitted to the "master" branch.

New to GitHub or open source projects? If you are unsure about where to start or haven't used GitHub before, please feel free to contact the package maintainers.

Feedback and feature requests? Is there something missing you would like to see? Please open an issue or send an email to the maintainers. This package follows the Spacetelescope [Code of Conduct](CODE_OF_CONDUCT.md) strives to provide a welcoming community to all of our users and contributors.
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Copyright (C) 2020 Association of Universities for Research in Astronomy (AURA)

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

3. The name of AURA and its representatives may not be used to
endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
28 changes: 28 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Copyright (C) 2020 Association of Universities for Research in Astronomy (AURA)

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

3. The name of AURA and its representatives may not be used to
endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
65 changes: 65 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[metadata]
name = roman_datamodels
description = TODO
long_description = TODO
author = TODO
license = BSD-3-Clause
url = https://github.com/spacetelescope/roman_datamodels
project_urls =
Bug Tracker = https://github.com/spacetelescope/roman_datamodels/issues
Source Code = https://github.com/spacetelescope/roman_datamodels
classifiers =
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Astronomy
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3

[options]
zip_safe = True
python_requires = >=3.6
setup_requires =
setuptools_scm
install_requires =
jsonschema>=3.0.2
asdf>=2.7.1
psutil>=5.7.2
numpy>=1.16
astropy>=4.0
package_dir =
=src
packages = find:

[options.entry_points]
asdf.extensions =
roman_datamodels = roman_datamodels.integration:get_extensions
# asdf.resource_mappings =
# roman_datamodels = roman_datamodels.integration:get_resource_mappings

[options.package_data]
roman_datamodels.resources = manifests/*.yaml, schemas/*.yaml, schemas/**/*.yaml

[options.packages.find]
where = src

[options.extras_require]
test =
pytest>=4.6.0
pytest-doctestplus
pytest-openfiles>=0.5.0
aws =
stsci-aws-utils>=0.1.2

[flake8]
select = F, W, E101, E111, E112, E113, E401, E402, E501, E711, E722
# We should set max line length to 88 eventually
max-line-length = 130
exclude =
docs,
ignore = E203, W503, W504, W605

[tool:pytest]
minversion = 4.6
doctest_plus = true
doctest_rst = true
text_file_format = rst
addopts = --show-capture=no --open-files
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python3
from setuptools import setup

setup(use_scm_version=True)
Empty file.
18 changes: 18 additions & 0 deletions src/roman_datamodels/extensions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from asdf.extension import ManifestExtension
from .stnode import (
ExposureConverter,
WfiScienceRawConverter,
WfiModeConverter,
)

DATAMODEL_CONVERTERS = [
ExposureConverter(),
WfiModeConverter(),
WfiScienceRawConverter(),
]

DATAMODEL_EXTENSIONS = [
ManifestExtension.from_uri(
"http://stsci.edu/asdf/datamodels/roman/manifests/datamodels-1.0",
converters=DATAMODEL_CONVERTERS)
]
41 changes: 41 additions & 0 deletions src/roman_datamodels/integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import sys

from asdf.resource import DirectoryResourceMapping

if sys.version_info < (3, 9):
import importlib_resources
else:
import importlib.resources as importlib_resources


# def get_resource_mappings():
# """
# Get the resource mapping instances for the datamodel schemas
# and manifests. This method is registered with the
# asdf.resource_mappings entry point.

# Returns
# -------
# list of collections.abc.Mapping
# """
# from . import resources
# resources_root = importlib_resources.files(resources)

# return [
# DirectoryResourceMapping(resources_root / "schemas", "http://stsci.edu/schemas/datamodels", recursive=True),
# DirectoryResourceMapping(resources_root / "manifests", "http://stsci.edu/asdf/datamodels/manifests"),
# ]


def get_extensions():
"""
Get the extension instances for the various astropy
extensions. This method is registered with the
asdf.extensions entry point.
Returns
-------
list of asdf.extension.Extension
"""
from . import extensions
return extensions.DATAMODEL_EXTENSIONS
Loading

0 comments on commit 403f6b5

Please sign in to comment.