Skip to content

Commit

Permalink
Merge pull request #70 from ASFHyP3/deprecate_python38
Browse files Browse the repository at this point in the history
Remove Support for Python 3.8
  • Loading branch information
AndrewPlayer3 authored Jul 1, 2024
2 parents fa73053 + ee2c605 commit 6bf1204
Show file tree
Hide file tree
Showing 27 changed files with 156 additions and 105 deletions.
37 changes: 0 additions & 37 deletions .github/PULL_REQUEST_TEMPLATE/release.md

This file was deleted.

19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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: pip
directory: /
schedule:
interval: weekly
labels:
- bumpless
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
labels:
- bumpless
8 changes: 0 additions & 8 deletions .github/pull_request_template.md

This file was deleted.

4 changes: 1 addition & 3 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ on:

jobs:
call-changelog-check-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@main
secrets:
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ASFHyP3/actions/.github/workflows/[email protected]
15 changes: 15 additions & 0 deletions .github/workflows/create-jira-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Create Jira issue

on:
issues:
types: [labeled]

jobs:
call-create-jira-issue-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected]
secrets:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }}
JIRA_FIELDS: ${{ secrets.JIRA_FIELDS }}
11 changes: 5 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Deploy to AWS

on:
Expand Down Expand Up @@ -44,14 +43,14 @@ jobs:

- uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.12

- name: install dependencies and render templates
run: |
python -m pip install --upgrade pip
python -m pip install -r find_new/requirements.txt -t find_new/src
python -m pip install -r api/requirements.txt -t api/src
python -m pip install -r harvest_products/requirements.txt -t harvest_products/src
python -m pip install -r requirements-find-new.txt -t find_new/src
python -m pip install -r requirements-api.txt -t api/src
python -m pip install -r requirements-harvest-products.txt -t harvest_products/src
- name: Package and deploy
run: |
Expand All @@ -73,6 +72,6 @@ jobs:
call-bump-version-workflow:
if: github.ref == 'refs/heads/main'
needs: deploy
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@main
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.11.2
secrets:
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
15 changes: 15 additions & 0 deletions .github/workflows/labeled-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Is PR labeled?

on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize
branches:
- main

jobs:
call-labeled-pr-check-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected]
14 changes: 14 additions & 0 deletions .github/workflows/release-template-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
pull_request:
types:
- opened
branches:
- main

jobs:
call-release-checklist-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected]
permissions:
pull-requests: write
secrets:
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@main
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.11.2
with:
release_prefix: HyP3 Event Monitoring
secrets:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ on: push

jobs:
call-flake8-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-flake8.yml@main
uses: ASFHyP3/actions/.github/workflows/reusable-flake8.yml@v0.11.2
with:
local_package_names: api,database,find_new,harvest_products

cfn-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: scottbrenner/cfn-lint-action@master
- uses: actions/[email protected]
- uses: actions/setup-python@v5
with:
args: "--ignore-checks W3002 --template cloudformation.yml **/cloudformation.yml"
python-version: 3.12
- run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-all.txt
- run: |
cfn-lint --info --ignore-checks W3002 --template cloudformation.yml **/cloudformation.yml
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

- uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.12

- run: |
python -m pip install --upgrade pip
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ 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).

## [0.1.0]
### Removed
- Support for Python 3.8 has been removed. Python 3.12 is now supported.

## [0.0.13]
### Changed
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ Review the parameters in [cloudformation.yml](cloudformation.yml) for deploy tim

### Deploy with CloudFormation

- Install dependencies for each component (requires pip for python 3.8)
- Install dependencies for each component (requires pip for python 3.12)

```sh
python -m pip install -r find_new/requirements.txt -t find_new/src
python -m pip install -r api/requirements.txt -t api/src
python -m pip install -r harvest_products/requirements.txt -t harvest_products/src
python -m pip install -r requirements-find-new.txt -t find_new/src
python -m pip install -r requirements-api.txt -t api/src
python -m pip install -r requirements-harvest-products.txt -t harvest_products/src
```

- Package the CloudFormation template
Expand Down
5 changes: 0 additions & 5 deletions api/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion api/src/api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from datetime import datetime, timedelta, timezone
from decimal import Decimal
from json import JSONEncoder

from flask import Flask, abort, jsonify
from flask.json import JSONEncoder
from flask_api.status import HTTP_404_NOT_FOUND
from flask_cors import CORS
from serverless_wsgi import handle_request
Expand Down
32 changes: 30 additions & 2 deletions cloudformation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,39 @@ Parameters:

Resources:
LogBucket:
Type: AWS::S3::Bucket
Type: "AWS::S3::Bucket"
Properties:
AccessControl: LogDeliveryWrite
PublicAccessBlockConfiguration:
BlockPublicAcls: True
IgnorePublicAcls: True
BlockPublicPolicy: True
RestrictPublicBuckets: True
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
BucketKeyEnabled: true
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced

LogBucketPolicy:
Type: "AWS::S3::BucketPolicy"
Properties:
Bucket: !Ref LogBucket
PolicyDocument:
Version: 2012-10-17
Statement:
- Action: "s3:PutObject"
Effect: Allow
Principal:
Service: logging.s3.amazonaws.com
Resource: !Sub "${LogBucket.Arn}/*"
Condition:
ArnLike:
"aws:SourceArn": !GetAtt ProductBucket.Arn
StringEquals:
"aws:SourceAccount": !Sub "${AWS::AccountId}"

ProductBucket:
Type: AWS::S3::Bucket
Expand Down Expand Up @@ -55,6 +80,9 @@ Resources:
- HEAD
AllowedOrigins:
- "*.asf.alaska.edu"
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced

BucketPolicy:
Type: AWS::S3::BucketPolicy
Expand Down
2 changes: 1 addition & 1 deletion database/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
license='BSD',
include_package_data=True,

python_requires='~=3.8',
python_requires='~=3.12',

packages=find_packages(),
)
2 changes: 1 addition & 1 deletion find_new/cloudformation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Resources:
Handler: find_new.lambda_handler
MemorySize: 128
Role: !GetAtt Role.Arn
Runtime: python3.8
Runtime: python3.12
Timeout: 900

EventInvokeConfig:
Expand Down
5 changes: 0 additions & 5 deletions find_new/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion harvest_products/cloudformation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Resources:
Handler: harvest_products.lambda_handler
MemorySize: 2048
Role: !GetAtt Role.Arn
Runtime: python3.8
Runtime: python3.12
Timeout: 900

EventInvokeConfig:
Expand Down
3 changes: 0 additions & 3 deletions harvest_products/requirements.txt

This file was deleted.

26 changes: 13 additions & 13 deletions requirements-all.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
boto3
cfn-lint
flake8
flake8-blind-except
flake8-builtins
flake8-import-order
pytest
moto>=1.3.17dev240
responses>=0.12.1
pyYAML
-r find_new/requirements.txt
-r api/requirements.txt
-r harvest_products/requirements.txt
boto3==1.34.135
cfn-lint==1.4.2
flake8==7.1.0
flake8-blind-except==0.2.1
flake8-builtins==2.5.0
flake8-import-order==0.18.2
pytest==8.2.2
moto==5.0.10.dev36
responses==0.25.3
pyYAML==6.0.1
-r requirements-find-new.txt
-r requirements-api.txt
-r requirements-harvest-products.txt
6 changes: 6 additions & 0 deletions requirements-api.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
flask==2.3.3
flask_api==3.1
werkzeug==2.3.8
Flask-Cors==4.0.1
serverless_wsgi==3.0.4
./database
5 changes: 5 additions & 0 deletions requirements-find-new.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
asf-search==3.1.3
hyp3-sdk==6.1.0
python-dateutil==2.9.0.post0
requests==2.32.3
./database
3 changes: 3 additions & 0 deletions requirements-harvest-products.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hyp3-sdk==6.1.0
requests==2.32.3
./database
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
import yaml
from botocore.stub import Stubber
from moto import mock_dynamodb2
from moto import mock_aws

import api
import harvest_products
Expand All @@ -23,7 +23,7 @@ def get_table_properties_from_template(resource_name):

@pytest.fixture
def tables():
with mock_dynamodb2():
with mock_aws():
database.DB = boto3.resource('dynamodb')

class Tables:
Expand Down
Loading

0 comments on commit 6bf1204

Please sign in to comment.