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

Release 1.21.0 #643

Merged
merged 8 commits into from
Feb 18, 2025
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
3 changes: 2 additions & 1 deletion .github/workflows/conda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ jobs:
run: |
conda install conda-build
mkdir dist
conda build --output-folder dist \
conda build --package-format=tar.bz2 \
--output-folder dist \
--label ${{ env.LABEL }} \
recipes

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
tags="${tags},${version}"
version=${version%.*}
done
# Remove any unwanted double quotes from tags
tags=$(echo $tags | sed 's/"//g')
echo "VERSION=${version}" >> $GITHUB_ENV
echo "TAGS=${tags}" >> $GITHUB_ENV
elif [ "$BRANCH" == "develop" ]; then
Expand All @@ -61,6 +63,10 @@ jobs:
echo "TAGS=${BRANCH}" >> $GITHUB_ENV
fi

# debug TAGS
- name: Debug TAGS
run: echo "TAGS=${{ env.TAGS }}"

# build image
- name: Build image
uses: elgohr/[email protected]
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.21.0] - 2025-02-12

### Changed
- Enable internal network names for each service [#638](https://github.com/IN-CORE/pyincore/issues/638)
- Update production URL references to tools.in-core.org and dev to dev.in-core.org [#634](https://github.com/IN-CORE/pyincore/issues/634)

### Fixed
- Documentation container tagging error by github action [#631](https://github.com/IN-CORE/pyincore/issues/631)
- Updated rasterio dependency to the latest to fetch correct GDAL version [#636](https://github.com/IN-CORE/pyincore/issues/636)


## [1.20.1] - 2024-11-01

### Fixed
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To update **pyIncore**, run
conda update -c in-core pyincore

You can find detail information at the
`Installation <https://incore.ncsa.illinois.edu/doc/incore/pyincore/install_pyincore.html>`__
`Installation <https://tools.in-core.org/doc/incore/pyincore/install_pyincore.html>`__
section at IN-CORE manual.

Installation with pip
Expand Down Expand Up @@ -61,17 +61,17 @@ Testing and Running
-------------------

Please read the `Testing and
Running <https://incore.ncsa.illinois.edu/doc/incore/pyincore/running.html>`__
Running <https://tools.in-core.org/doc/incore/pyincore/running.html>`__
section at IN-CORE manual.

Documentation
-------------

**pyIncore** documentation can be found at
https://incore.ncsa.illinois.edu/doc/incore/pyincore.html
https://tools.in-core.org/doc/incore/pyincore.html

**pyIncore** technical reference (API) can be found at
https://incore.ncsa.illinois.edu/doc/pyincore/.
https://tools.in-core.org/doc/pyincore/.

Acknowledgement
---------------
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
author = ""

# The short X.Y version
version = "1.20"
version = "1.21"
# The full version, including alpha/beta/rc tags
release = "1.20.1"
release = "1.21.0"

# -- General configuration ---------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions docs/source/refs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ References

<embed>
<ul>
<li><a href="https://incore.ncsa.illinois.edu/doc/incore/" target="_blank">IN-CORE</a> Manual</li>
<li><a href="https://incore.ncsa.illinois.edu/doc/pyincore_viz/" target="_blank">pyIncore-viz</a> Reference</li>
<li><a href="https://incore.ncsa.illinois.edu/doc/pyincore_data/" target="_blank">pyIncore-data</a> Reference</li>
<li><a href="https://incore.ncsa.illinois.edu/doc/api/" target="_blank">IN-CORE Web Services API</a> specifications</li>
<li><a href="https://tools.in-core.org/doc/incore/" target="_blank">IN-CORE</a> Manual</li>
<li><a href="https://tools.in-core.org/doc/pyincore_viz/" target="_blank">pyIncore-viz</a> Reference</li>
<li><a href="https://tools.in-core.org/doc/pyincore_data/" target="_blank">pyIncore-data</a> Reference</li>
<li><a href="https://tools.in-core.org/doc/api/" target="_blank">IN-CORE Web Services API</a> specifications</li>
</ul>
</embed>
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
- pyproj>=3.6.1
- pytest>=3.9.0
- python-jose>=3.0
- rasterio>=1.3.9
- rasterio>=1.4.2
- requests>=2.31.0
- rtree>=1.1.0
- scipy>=1.11.3
Expand Down
22 changes: 19 additions & 3 deletions pyincore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def __init__(
username: str = None,
usergroups: list = None,
internal: bool = False,
local: bool = False,
offline: bool = False,
):
"""
Expand All @@ -183,12 +184,13 @@ def __init__(
super().__init__()
self.offline = offline
self.internal = internal
self.local = local

if not offline:
if service_url is None or len(service_url.strip()) == 0:
service_url = pyglobals.INCORE_API_PROD_URL
if internal:
service_url = pyglobals.INCORE_INTERNAL_API_URL
if local:
service_url = pyglobals.INCORE_LOCAL_API_URL

self.service_url = service_url
self.token_url = urllib.parse.urljoin(
Expand All @@ -211,7 +213,7 @@ def __init__(
if not os.path.exists(self.hashed_svc_data_dir):
os.makedirs(self.hashed_svc_data_dir)

if internal:
if internal or local:
# Constructing the headers
self.session.headers["x-auth-userinfo"] = json.dumps(
{"preferred_username": username}
Expand Down Expand Up @@ -262,6 +264,9 @@ def login(self):
if self.internal is True:
logger.warning("Internal mode does not have login method.")
return False
if self.local is True:
logger.warning("Local mode does not have login method.")
return False

for attempt in range(pyglobals.MAX_LOGIN_ATTEMPTS):
try:
Expand Down Expand Up @@ -312,6 +317,11 @@ def store_authorization_in_file(self, authorization: str):
"Internal mode does not have store_authorization_in_file method."
)
return
if self.local is True:
logger.warning(
"Local mode does not have store_authorization_in_file method."
)
return
try:
with open(self.token_file, "w") as f:
f.write(authorization)
Expand All @@ -330,6 +340,9 @@ def is_token_expired(self, token):
if self.internal is True:
logger.warning("Internal mode does not have is_token_expired method.")
return
if self.local is True:
logger.warning("Local mode does not have is_token_expired method.")
return

# Split the token to get payload
_, payload_encoded, _ = token.split(".")
Expand Down Expand Up @@ -361,6 +374,9 @@ def retrieve_token_from_file(self):
"Internal mode does not have retrieve_token_from_file method."
)
return
if self.local is True:
logger.warning("Local mode does not have retrieve_token_from_file method.")
return

if not os.path.isfile(self.token_file):
return None
Expand Down
27 changes: 21 additions & 6 deletions pyincore/dataservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,27 @@ class DataService:

def __init__(self, client: IncoreClient):
self.client = client
self.base_url = urljoin(client.service_url, "data/api/datasets/")
self.files_url = urljoin(client.service_url, "data/api/files/")
self.base_earthquake_url = urljoin(
client.service_url, "hazard/api/earthquakes/"
)
self.base_tornado_url = urljoin(client.service_url, "hazard/api/tornadoes/")

if self.client.internal:
self.base_url = urljoin(
pyglobals.INCORE_INTERNAL_DATA_API_URL, "data/api/datasets/"
)
self.base_earthquake_url = urljoin(
pyglobals.INCORE_INTERNAL_HAZARD_API_URL, "hazard/api/earthquakes/"
)
self.base_tornado_url = urljoin(
pyglobals.INCORE_INTERNAL_HAZARD_API_URL, "hazard/api/tornadoes/"
)
self.files_url = urljoin(
pyglobals.INCORE_INTERNAL_DATA_API_URL, "data/api/files/"
)
else:
self.base_url = urljoin(client.service_url, "data/api/datasets/")
self.base_earthquake_url = urljoin(
client.service_url, "hazard/api/earthquakes/"
)
self.base_tornado_url = urljoin(client.service_url, "hazard/api/tornadoes/")
self.files_url = urljoin(client.service_url, "data/api/files/")

@forbid_offline
def get_dataset_metadata(self, dataset_id: str, timeout=(30, 600), **kwargs):
Expand Down
7 changes: 6 additions & 1 deletion pyincore/dfr3service.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ class Dfr3Service:

def __init__(self, client: IncoreClient):
self.client = client
self.base_mapping_url = urljoin(client.service_url, "dfr3/api/mappings/")
if self.client.internal:
self.base_mapping_url = urljoin(
pyglobals.INCORE_INTERNAL_DFR3_API_URL, "dfr3/api/mappings/"
)
else:
self.base_mapping_url = urljoin(client.service_url, "dfr3/api/mappings/")

@forbid_offline
def get_dfr3_set(self, dfr3_id: str, timeout=(30, 600), **kwargs):
Expand Down
12 changes: 9 additions & 3 deletions pyincore/fragilityservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pyincore.decorators import forbid_offline
from pyincore.dfr3service import Dfr3Service
from pyincore.utils import return_http_response
import pyincore.globals as pyglobals


class FragilityService(Dfr3Service):
Expand All @@ -23,9 +24,14 @@ class FragilityService(Dfr3Service):

def __init__(self, client: IncoreClient):
self.client = client
self.base_dfr3_url = urllib.parse.urljoin(
client.service_url, "dfr3/api/fragilities/"
)
if self.client.internal:
self.base_dfr3_url = urllib.parse.urljoin(
pyglobals.INCORE_INTERNAL_DFR3_API_URL, "dfr3/api/fragilities/"
)
else:
self.base_dfr3_url = urllib.parse.urljoin(
client.service_url, "dfr3/api/fragilities/"
)

super(FragilityService, self).__init__(client)

Expand Down
18 changes: 12 additions & 6 deletions pyincore/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
import os
import shutil

PACKAGE_VERSION = "1.20.1"

INCORE_API_PROD_URL = "https://incore.ncsa.illinois.edu"
INCORE_API_DEV_URL = "https://incore-dev.ncsa.illinois.edu"

INCORE_INTERNAL_API_URL = "http://localhost:8080"
PACKAGE_VERSION = "1.21.0"

INCORE_API_PROD_URL = "https://tools.in-core.org"
INCORE_API_DEV_URL = "https://dev.in-core.org"

INCORE_LOCAL_API_URL = "http://localhost:8080"
INCORE_INTERNAL_DFR3_API_URL = "http://incore-svc-dfr3:8888"
INCORE_INTERNAL_DATA_API_URL = "http://incore-svc-data:8888"
INCORE_INTERNAL_HAZARD_API_URL = "http://incore-svc-hazard:8888"
INCORE_INTERNAL_SEMANTIC_API_URL = "http://incore-svc-sema:8888"
INCORE_INTERNAL_SPACE_API_URL = "http://incore-svc-space:8888"
INCORE_INTERNAL_PROJECT_API_URL = "http://incore-svc-project:8888"

KEYCLOAK_AUTH_PATH = "/auth/realms/In-core/protocol/openid-connect/token"
KEYCLOAK_USERINFO_PATH = "/auth/realms/In-core/protocol/openid-connect/userinfo"
Expand Down
43 changes: 33 additions & 10 deletions pyincore/hazardservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,39 @@ class HazardService:
def __init__(self, client: IncoreClient):
self.client = client

self.base_earthquake_url = urljoin(
client.service_url, "hazard/api/earthquakes/"
)
self.base_tornado_url = urljoin(client.service_url, "hazard/api/tornadoes/")
self.base_tsunami_url = urljoin(client.service_url, "hazard/api/tsunamis/")
self.base_hurricane_url = urljoin(client.service_url, "hazard/api/hurricanes/")
self.base_hurricanewf_url = urljoin(
client.service_url, "hazard/api/hurricaneWindfields/"
)
self.base_flood_url = urljoin(client.service_url, "hazard/api/floods/")
if self.client.internal:
self.base_earthquake_url = urljoin(
pyglobals.INCORE_INTERNAL_HAZARD_API_URL, "hazard/api/earthquakes/"
)
self.base_tornado_url = urljoin(
pyglobals.INCORE_INTERNAL_HAZARD_API_URL, "hazard/api/tornadoes/"
)
self.base_tsunami_url = urljoin(
pyglobals.INCORE_INTERNAL_HAZARD_API_URL, "hazard/api/tsunamis/"
)
self.base_hurricane_url = urljoin(
pyglobals.INCORE_INTERNAL_HAZARD_API_URL, "hazard/api/hurricanes/"
)
self.base_hurricanewf_url = urljoin(
pyglobals.INCORE_INTERNAL_HAZARD_API_URL,
"hazard/api/hurricaneWindfields/",
)
self.base_flood_url = urljoin(
pyglobals.INCORE_INTERNAL_HAZARD_API_URL, "hazard/api/floods/"
)
else:
self.base_earthquake_url = urljoin(
client.service_url, "hazard/api/earthquakes/"
)
self.base_tornado_url = urljoin(client.service_url, "hazard/api/tornadoes/")
self.base_tsunami_url = urljoin(client.service_url, "hazard/api/tsunamis/")
self.base_hurricane_url = urljoin(
client.service_url, "hazard/api/hurricanes/"
)
self.base_hurricanewf_url = urljoin(
client.service_url, "hazard/api/hurricaneWindfields/"
)
self.base_flood_url = urljoin(client.service_url, "hazard/api/floods/")

@forbid_offline
def get_earthquake_hazard_metadata_list(
Expand Down
12 changes: 9 additions & 3 deletions pyincore/repairservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pyincore import IncoreClient
from pyincore.decorators import forbid_offline
from pyincore.dfr3service import Dfr3Service
import pyincore.globals as pyglobals


class RepairService(Dfr3Service):
Expand All @@ -22,9 +23,14 @@ class RepairService(Dfr3Service):

def __init__(self, client: IncoreClient):
self.client = client
self.base_dfr3_url = urllib.parse.urljoin(
client.service_url, "dfr3/api/repairs/"
)
if self.client.internal:
self.base_dfr3_url = urllib.parse.urljoin(
pyglobals.INCORE_INTERNAL_DFR3_API_URL, "dfr3/api/repairs/"
)
else:
self.base_dfr3_url = urllib.parse.urljoin(
client.service_url, "dfr3/api/repairs/"
)

super(RepairService, self).__init__(client)

Expand Down
8 changes: 7 additions & 1 deletion pyincore/restorationservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pyincore.decorators import forbid_offline
from pyincore.dfr3service import Dfr3Service
from pyincore.utils import return_http_response
import pyincore.globals as pyglobals


class RestorationService(Dfr3Service):
Expand All @@ -21,7 +22,12 @@ class RestorationService(Dfr3Service):

def __init__(self, client: IncoreClient):
self.client = client
self.base_dfr3_url = urljoin(client.service_url, "dfr3/api/restorations/")
if self.client.internal:
self.base_dfr3_url = urljoin(
pyglobals.INCORE_INTERNAL_DFR3_API_URL, "dfr3/api/restorations/"
)
else:
self.base_dfr3_url = urljoin(client.service_url, "dfr3/api/restorations/")

super(RestorationService, self).__init__(client)

Expand Down
7 changes: 6 additions & 1 deletion pyincore/semanticservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ class SemanticService:

def __init__(self, client: IncoreClient):
self.client = client
self.base_url = urljoin(client.service_url, "semantics/api/types")
if self.client.internal:
self.base_url = urljoin(
pyglobals.INCORE_INTERNAL_SEMANTIC_API_URL, "semantics/api/types"
)
else:
self.base_url = urljoin(client.service_url, "semantics/api/types")

@forbid_offline
def get_all_semantic_types(
Expand Down
Loading
Loading