Skip to content

Commit

Permalink
Merge bde53eb into 5691803
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed May 12, 2023
2 parents 5691803 + bde53eb commit 88543bb
Show file tree
Hide file tree
Showing 276 changed files with 24,896 additions and 16,765 deletions.
3 changes: 3 additions & 0 deletions .bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[bandit]
skips: B506
exclude: uwsift/tests
7 changes: 3 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -73,10 +73,10 @@ jobs:
# XXX: We don't currently have OpenGL installation on other platforms
#os: ["windows-latest", "ubuntu-latest", "macos-latest"]
os: ["ubuntu-latest"]
python-version: ["3.7", "3.10"]
python-version: ["3.8", "3.10"]
experimental: [false]
include:
- python-version: "3.9"
- python-version: "3.10"
os: "ubuntu-latest"
experimental: true

Expand Down Expand Up @@ -159,4 +159,3 @@ jobs:
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ jobs:
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.UWSIFT_PYPI_TOKEN }}
password: ${{ secrets.UWSIFT_PYPI_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,9 @@ venv.bak/

# mypy
.mypy_cache/

# CMake build system
CMakeCache.txt
cmake_install.cmake
CMakeFiles/
Makefile
57 changes: 44 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,50 @@
exclude: '^$'
fail_fast: false
repos:
#- repo: https://github.com/psf/black
# rev: 20.8b1 # Replace by any tag/version: https://github.com/psf/black/tags
# hooks:
# - id: black
# language_version: python3 # Should be a command that runs python3.6+
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
language_version: python3
args:
- --target-version=py38
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
language_version: python3
additional_dependencies: [flake8-docstrings, flake8-debugger, flake8-bugbear]
#- repo: https://github.com/pycqa/isort
# rev: 5.8.0
# hooks:
# - id: isort
# language_version: python3
additional_dependencies: [flake8-docstrings, flake8-debugger, flake8-bugbear, mccabe]
args: [--max-complexity, "10"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
# conda-recipes use jinja templating which isn't valid YAML syntax
exclude: conda-recipe\/
- repo: https://github.com/PyCQA/bandit
rev: '1.7.4'
hooks:
- id: bandit
args: [--ini, .bandit]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.991' # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies:
- types-docutils
- types-pkg-resources
- types-PyYAML
- types-requests
- types-python-dateutil
ci:
# To trigger manually, comment on a pull request with "pre-commit.ci autofix"
autofix_prs: false
skip: [bandit, mypy]
6 changes: 6 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ The following people have made contributions to this project:
- [Jordan Gerth (jgerth)](https://github.com/jgerth)
- [David Hoese (djhoese)](https://github.com/djhoese)
- [Sauli Joro (sjoro)](https://github.com/sjoro)
- [Nicolai Kellerer (nbke)](https://github.com/nbke)
- [Max Kreischer (MaxKreischer)](https://github.com/MaxKreischer)
- [Alexandra Melzer (armelzer)](https://github.com/armelzer)
- [Andrea Meraner (ameraner)](https://github.com/ameraner)
- [Coda Phillips (CodaP)](https://github.com/CodaP)
- [Alexander Rettig (arcanerr)](https://github.com/arcanerr)
- [William Roberts (wroberts4)](https://github.com/wroberts4)
- [Eva Schiffer (evas-ssec)](https://github.com/evas-ssec)
- [Johan Strandgren (strandgren)](https://github.com/strandgren)
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,3 @@ In this release 1 pull request was closed.


## Version 1.0.0 (2018/10/25)

157 changes: 157 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
#
# Build System to create Conda and PyInstaller Packages for SIFT
#
#
# Author: Alexander Rettig
cmake_minimum_required( VERSION 3.10 ) # May be relaxed to allow older CMake versions but not below 3.8 because we use COMMAND_EXPAND_LISTS

# 'LANGUAGES' might be changed to Python when a Python toolchain becomes available
project( sift LANGUAGES NONE )

#-------------------------------------------------------------------------------------------------
# Global Settings
#-------------------------------------------------------------------------------------------------

list( APPEND CMAKE_MODULE_PATH "cmake/" )

set( PYTHON_VERSION 3.10 CACHE STRING "Version of Python to setup/build SIFT for." )

#-------------------------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------------------------

# Building packages is only supported from within a conda environment (for now)
find_package( Conda REQUIRED )

#-------------------------------------------------------------------------------------------------
# Common Packaging Settings
#-------------------------------------------------------------------------------------------------

if( NOT ${PROJECT_NAME}_CONDA_ENVIRONMENT )
set( ${PROJECT_NAME}_CONDA_ENVIRONMENT "devel-${PYTHON_VERSION}" CACHE STRING "Name (or absolute path) of conda environment in which ${PROJECT_NAME} is build/packaged" )
endif()

if( "${${PROJECT_NAME}_CONDA_ENVIRONMENT}" STREQUAL "base" )
set( ${PROJECT_NAME}_CONDA_ENVIRONMENT "devel-${PYTHON_VERSION}" CACHE STRING "Name (or absolute path) of conda environment in which ${PROJECT_NAME} is build/packaged" FORCE )
message( FATAL_ERROR "${PROJECT_NAME} project must not be set up in a Conda 'base' environment. Resetting to sensible default." )
endif()

set( ${PROJECT_NAME}_DEPENDENCIES_CHANNEL "conda-forge" CACHE STRING "Conda channel which provides dependencies of ${PROJECT_NAME}." )

#-------------------------------------------------------------------------------------------------
# Convenience Target 'devel-bootstrap'
#-------------------------------------------------------------------------------------------------

# Support bootstrap a development environment
# Prerequisite: Anaconda3 is installed, environment (base) activated

if( ${Conda_EXECUTABLE} MATCHES .*/?mamba )
set( XRIT_DEFAULT ON )
else()
set( XRIT_DEFAULT OFF )
endif()
option( WITH_xRITDecompress "If set, integrate xRITDecompress in the development environment" ${XRIT_DEFAULT} )

add_custom_target( devel-bootstrap
COMMAND ${Conda_EXECUTABLE} create --name ${${PROJECT_NAME}_CONDA_ENVIRONMENT} --channel conda-forge --strict-channel-priority python=${PYTHON_VERSION}
COMMAND ${Conda_EXECUTABLE} install --name ${${PROJECT_NAME}_CONDA_ENVIRONMENT} --channel conda-forge --strict-channel-priority --file conda-envs/sift-devel-minimal.pkgs

COMMAND ${CMAKE_COMMAND} -E $<IF:$<BOOL:${WITH_xRITDecompress}>,env,true> ${Conda_EXECUTABLE} install --name ${${PROJECT_NAME}_CONDA_ENVIRONMENT} --channel eumetsat --strict-channel-priority public-decomp-wt
COMMAND echo "You may want to run the following commands manually:"
COMMAND echo " conda activate ${${PROJECT_NAME}_CONDA_ENVIRONMENT}"
COMMAND echo " conda config --env --add channels conda-forge"
COMMAND echo " conda config --env --set channel_priority strict"
COMMAND echo " ${CMAKE_COMMAND} ."
COMMAND echo "To make sure that GRIB and BUFR readers work correctly, run the following commands manually:"
COMMAND echo " pip install ecmwflibs"
COMMAND echo " pip install eccodes"
COMMAND echo " pip install cfgrib"
VERBATIM
COMMAND_EXPAND_LISTS
COMMENT "Setting up conda environment for development ..."
)

#-------------------------------------------------------------------------------------------------
# Check: make sure the current environment is the one the build system was set up in.
#-------------------------------------------------------------------------------------------------

if( NOT "${Conda_ENVIRONMENT}" STREQUAL "${${PROJECT_NAME}_CONDA_ENVIRONMENT}" )
message( WARNING
"Current Conda environment '${Conda_ENVIRONMENT}' doesn't match the configured build environment '${${PROJECT_NAME}_CONDA_ENVIRONMENT}'!\n"
"Please run\n"
" ${CMAKE_MAKE_PROGRAM} devel-bootstrap\n"
"to set up an initial development environment '${${PROJECT_NAME}_CONDA_ENVIRONMENT}'\n"
"or if it already exists:\n"
" conda activate ${${PROJECT_NAME}_CONDA_ENVIRONMENT}\n"
"in your working shell\n"
"or synchronize the value of ${PROJECT_NAME}_CONDA_ENVIRONMENT in the CMake configuration.\n"
)
return()
endif()

#-------------------------------------------------------------------------------------------------
# Conda Packaging
#-------------------------------------------------------------------------------------------------

option( DIST_Conda "If set, a target for building installers with Conda is created" ON )
if( DIST_Conda )

set( ${PROJECT_NAME}_CONDA_RECIPE "${PROJECT_NAME}" ) # Name of the Conda recipe, i.e. the directory name to look for 'meta.yaml' in
set( ${PROJECT_NAME}_CONDA_DIST_DIR "$ENV{HOME}/conda-channels/uwsift" CACHE STRING "Path to local conda packages directory." )

add_custom_target( conda-packages
COMMAND ${Conda_EXECUTABLE} build -c ${${PROJECT_NAME}_DEPENDENCIES_CHANNEL} --python ${PYTHON_VERSION} --prefix-length 30 --output-folder "${${PROJECT_NAME}_CONDA_DIST_DIR}" "conda-recipe/${${PROJECT_NAME}_CONDA_RECIPE}"
VERBATIM
COMMENT "Building conda package for distribution to end users ..."
)

endif( DIST_Conda )

#-------------------------------------------------------------------------------------------------
# PyInstaller Packaging
#-------------------------------------------------------------------------------------------------

option( DIST_PyInstaller "If set, a target for building installers with PyInstaller is created" ON )
if( DIST_PyInstaller )

find_package( PyInstaller REQUIRED )
find_package( SelfPackers )
if( NOT SELF_PACKER_FOR_EXECUTABLE )
message( "PyInstaller packaging: Consider to install UPX (https://upx.github.io/) to get a smaller package." )
endif()

#-------------------------------------------------------------------------

set( ${PROJECT_NAME}_PYINSTALLER_BASE_DIR "${CMAKE_BINARY_DIR}/../pyinstaller" CACHE STRING
"Path to where PyInstaller shall put its artefacts.\n
CAUTION: The directory must be outside the source tree to avoid that PyInstaller artefacts interfere with Conda packaging.\n
WARNING: The directory is *owned* by the build system, it will be removed and recreated by the target 'pyinstaller-package'!" )
message( WARNING "Please consider carefully: "
" The directory configured as ${PROJECT_NAME}_PYINSTALLER_BASE_DIR='${${PROJECT_NAME}_PYINSTALLER_BASE_DIR}'"
" is *owned* by the build system, it will be removed and recreated by the target 'pyinstaller-package'!" )

message( "Creating target 'pyinstaller-package'" )
set( _pyi_dir_ ${${PROJECT_NAME}_PYINSTALLER_BASE_DIR} )
add_custom_command(OUTPUT pyinstaller-build
COMMAND ${CMAKE_COMMAND} -E remove_directory "${_pyi_dir_}"
COMMAND pip install -e .
COMMAND ${PyInstaller_EXECUTABLE} --distpath "${_pyi_dir_}/package" --workpath "${_pyi_dir_}/work" --clean -y ${PROJECT_NAME}-pyinstaller-package.spec
COMMAND ${CMAKE_COMMAND} -E make_directory "${_pyi_dir_}/dist/${PROJECT_NAME}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${_pyi_dir_}/dist/${PROJECT_NAME}/logs"
COMMAND ${CMAKE_COMMAND} -E rename "${_pyi_dir_}/package/${PROJECT_NAME}/resources/bin" "${_pyi_dir_}/dist/${PROJECT_NAME}/bin"
COMMAND ${CMAKE_COMMAND} -E rename "${_pyi_dir_}/package/${PROJECT_NAME}/etc" "${_pyi_dir_}/dist/${PROJECT_NAME}/etc"
COMMAND ${CMAKE_COMMAND} -E rename "${_pyi_dir_}/package/${PROJECT_NAME}" "${_pyi_dir_}/dist/${PROJECT_NAME}/lib"
BYPRODUCTS "${_pyi_dir_}/dist/${PROJECT_NAME}/lib/${PROJECT_NAME}"
VERBATIM
COMMENT "Building PyInstaller package in '${_pyi_dir_}/dist/${PROJECT_NAME}/lib'"
)
add_custom_target( pyinstaller-package
COMMAND ${CMAKE_COMMAND} -E tar "cf" "${PROJECT_NAME}.zip" --format=zip "${PROJECT_NAME}"
DEPENDS pyinstaller-build
BYPRODUCTS "${_pyi_dir_}/dist/${PROJECT_NAME}.zip"
WORKING_DIRECTORY "${_pyi_dir_}/dist"
VERBATIM
COMMENT "Package PyInstaller output for SIFT"
)

endif( DIST_PyInstaller )
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ How to Contribute
=================

Information on contributing to SIFT can be found on our
[GitHub Wiki](https://github.com/ssec/sift/wiki/Contributing).
[GitHub Wiki](https://github.com/ssec/sift/wiki/Contributing).
2 changes: 1 addition & 1 deletion INSTALLER_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Configuration files for the application are stored in the user's
The downloaded tarball `.tar.gz` can be extracted by running:

tar -xf SIFT_X.Y.Z.tar.gz

SIFT can then be started by running the `SIFT/SIFT` executable. Run
`SIFT/SIFT -h` for available command line options.

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
![CI](https://github.com/ssec/sift/actions/workflows/ci.yaml/badge.svg)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2587907.svg)](https://doi.org/10.5281/zenodo.2587907)
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/gitterHQ/gitter)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ssec/sift/master.svg)](https://results.pre-commit.ci/latest/github/ssec/sift/master)


Satellite Information Familiarization Tool (SIFT) was designed by the Space
Expand All @@ -28,6 +29,21 @@ also be found on GitHub: https://github.com/ssec/sift/wiki

Developer documentation can be found on https://sift.readthedocs.io/en/latest/.

## History

SIFT was originally created and designed at [SSEC/CIMSS at the University of
Wisconsin - Madison](https://cimss.ssec.wisc.edu/) as a training tool for US
NWS forecasters. Later, [EUMETSAT, European Organization for the Exploitation
of Meteorological Satellites](https://www.eumetsat.int/),
joined the project contributing many new features and refactoring various
portions of the project to support instrument calibration/validation workflows
as well as additional scientific analysis. CIMSS and EUMETSAT now work on the
project together as well as accepting contributions from users outside these
groups.

EUMETSAT contributions, leading up to SIFT 2.0, were carried out by
[ask – Innovative Visualisierungslösungen GmbH](https://askvisual.de/).

## Data Access and Reading

SIFT uses the open source python library Satpy to read input data. By using
Expand Down
1 change: 0 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ See [semver.org](http://semver.org/) on how to write a version number.
7. Create a release of the package on
[github](https://github.com/ssec/sift/releases) by drafting a new release
and copying the release notes from the changelog (see above).

0 comments on commit 88543bb

Please sign in to comment.