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 v6.2.0 #276

Merged
merged 29 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3429a07
Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12
dependabot[bot] Feb 28, 2024
861a676
Drop verify step for PyPI distribution
jhkennedy Feb 28, 2024
7564709
Merge pull request #265 from ASFHyP3/jhkennedy-patch-1
jtherrmann Feb 28, 2024
d054d3d
Merge pull request #263 from ASFHyP3/dependabot/github_actions/pypa/g…
jtherrmann Feb 29, 2024
8da85d5
Bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14
dependabot[bot] Mar 8, 2024
c574d91
Merge pull request #267 from ASFHyP3/dependabot/github_actions/pypa/g…
jhkennedy Mar 8, 2024
1712171
add priority
jtherrmann Apr 22, 2024
df8ef8c
update tests
jtherrmann Apr 22, 2024
0acf3a1
changelog
jtherrmann Apr 22, 2024
91e70bc
Update dependabot.yml to weekly
asjohnston-asf Apr 30, 2024
6b7b7a7
Merge pull request #273 from ASFHyP3/asjohnston-asf-patch-1
asjohnston-asf May 2, 2024
3527ebc
first commit
jacquelynsmale May 13, 2024
aecdf92
add in check_app_status test
jacquelynsmale May 14, 2024
bf0befd
fixed tests to work with _check_application_status
AndrewPlayer3 May 14, 2024
2d83008
flake8
AndrewPlayer3 May 14, 2024
0984f6a
added hyp3 instance as fixture
AndrewPlayer3 May 14, 2024
24ec80a
flake8
AndrewPlayer3 May 14, 2024
d77bfbe
flake8
AndrewPlayer3 May 14, 2024
2e324d0
removed unused function definitions
AndrewPlayer3 May 14, 2024
cf1607d
update CHANGELOG and add url
jacquelynsmale May 15, 2024
8d23ec6
add in exceptions
jacquelynsmale May 15, 2024
1bc4d4e
fix logic and add test
jacquelynsmale May 15, 2024
4162490
fix blank space
jacquelynsmale May 15, 2024
55e2617
Update src/hyp3_sdk/hyp3.py
forrestfwilliams May 16, 2024
33fb8f0
Merge pull request #275 from ASFHyP3/check-whitelist
forrestfwilliams May 16, 2024
e70fcb6
Merge branch 'develop' into priority
forrestfwilliams May 16, 2024
0d65f70
Merge pull request #271 from ASFHyP3/priority
forrestfwilliams May 16, 2024
aa1fbb5
remove extra space
jtherrmann May 17, 2024
edded00
Merge pull request #277 from ASFHyP3/remove-space
jtherrmann May 17, 2024
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
13 changes: 9 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: github-actions
directory: /
schedule:
interval: "daily"
interval: weekly
labels:
- "bumpless"
- bumpless
21 changes: 1 addition & 20 deletions .github/workflows/distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,7 @@ jobs:
python -m build

- name: upload to PyPI.org
uses: pypa/[email protected].11
uses: pypa/[email protected].14
with:
user: __token__
password: ${{ secrets.TOOLS_PYPI_PAK }}

verify-distribution:
runs-on: ubuntu-latest
needs:
- call-version-info-workflow
- distribute
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4

- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml

- name: Ensure hyp3_sdk v${{ needs.call-version-info-workflow.outputs.version }}} is pip installable
run: |
python -m pip install hyp3_sdk==${{ needs.call-version-info-workflow.outputs.version_tag }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.2.0]

### Added
* `Job.priority` attribute
* Unapproved `hyp3-sdk` users receive an error message when connecting to `HyP3`

## [6.1.0]

### Added
Expand Down
14 changes: 14 additions & 0 deletions src/hyp3_sdk/hyp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ def __init__(self, api_url: str = PROD_API, username: Optional[str] = None, pass

self.session = hyp3_sdk.util.get_authenticated_session(username, password)
self.session.headers.update({'User-Agent': f'{hyp3_sdk.__name__}/{hyp3_sdk.__version__}'})
self._check_application_status()

def _check_application_status(self) -> None:
help_url = 'https://hyp3-docs.asf.alaska.edu/using/requesting_access'
info = self.my_info()
if info['application_status'] == 'NOT_STARTED':
warnings.warn(f'User {info["user_id"]} has not yet applied for a monthly credit allotment.'
f' Please visit {help_url} to submit your application.')
if info['application_status'] == 'PENDING':
warnings.warn(f'User {info["user_id"]}\'s request for access is pending review. For more information, '
f'visit {help_url}')
if info['application_status'] == 'REJECTED':
warnings.warn(f'{info["user_id"]}\'s request for access has been rejected. For more information, '
f'visit {help_url}')

def find_jobs(self,
start: Optional[datetime] = None,
Expand Down
3 changes: 3 additions & 0 deletions src/hyp3_sdk/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(
expiration_time: Optional[datetime] = None,
processing_times: Optional[List[float]] = None,
credit_cost: Optional[float] = None,
priority: Optional[int] = None,
):
self.job_id = job_id
self.job_type = job_type
Expand All @@ -47,6 +48,7 @@ def __init__(
self.expiration_time = expiration_time
self.processing_times = processing_times
self.credit_cost = credit_cost
self.priority = priority

def __repr__(self):
return f'Job.from_dict({self.to_dict()})'
Expand Down Expand Up @@ -75,6 +77,7 @@ def from_dict(input_dict: dict):
expiration_time=expiration_time,
processing_times=input_dict.get('processing_times'),
credit_cost=input_dict.get('credit_cost'),
priority=input_dict.get('priority'),
)

def to_dict(self, for_resubmit: bool = False):
Expand Down
19 changes: 19 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
import shutil
from datetime import datetime
from pathlib import Path
from unittest.mock import patch
from uuid import uuid4

import pytest
import requests

from hyp3_sdk import Job
from hyp3_sdk.hyp3 import HyP3


@pytest.fixture(autouse=True)
jtherrmann marked this conversation as resolved.
Show resolved Hide resolved
def get_mock_hyp3():
def mock_my_info(self):
return {'application_status': 'APPROVED'}

def mock_get_authenticated_session(username, password):
return requests.Session()

def default_hyp3():
with patch('hyp3_sdk.hyp3.HyP3.my_info', mock_my_info):
with patch('hyp3_sdk.util.get_authenticated_session', mock_get_authenticated_session):
return HyP3()
return default_hyp3


@pytest.fixture(autouse=True)
Expand All @@ -22,6 +40,7 @@ def default_job(
thumbnail_images=None,
expiration_time=None,
credit_cost=None,
priority=None,
):
if job_parameters is None:
job_parameters = {'param1': 'value1'}
Expand Down
Loading
Loading