Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
rename cirruslib to cirrus.lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeifer committed Dec 22, 2021
1 parent 45926b7 commit e36253d
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 24 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import os.path

from setuptools import setup, find_packages
from setuptools import setup, find_namespace_packages


HERE = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -33,7 +33,7 @@
'Programming Language :: Python :: 3.8'
],
keywords='',
packages=find_packages('src'),
packages=find_namespace_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
install_requires=install_requires,
Expand Down
Empty file added src/cirrus/lib/__init__.py
Empty file.
22 changes: 11 additions & 11 deletions src/cirruslib/catalog.py → src/cirrus/lib/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from typing import Dict, Optional, List

from boto3utils import s3
from cirruslib.statedb import StateDB
from cirruslib.logging import get_task_logger
from cirruslib.transfer import get_s3_session
from cirruslib.utils import get_path, property_match
from cirrus.lib.statedb import StateDB
from cirrus.lib.logging import get_task_logger
from cirrus.lib.transfer import get_s3_session
from cirrus.lib.utils import get_path, property_match

# envvars
CATALOG_BUCKET = os.getenv('CIRRUS_CATALOG_BUCKET', None)
Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(self, *args, update=False, state_item=None, **kwargs):
assert(len(self['features']) > 0)
for item in self['features']:
if 'links' not in item:
item['links'] = []
item['links'] = []

# update collection IDs of member Items
self.assign_collections()
Expand Down Expand Up @@ -101,14 +101,14 @@ def from_payload(cls, payload: Dict, **kwargs) -> Catalog:

def update(self):
if 'collections' in self['process']:
# allow overriding of collections name
# allow overriding of collections name
collections_str = self['process']['collections']
else:
# otherwise, get from items
cols = sorted(list(set([i['collection'] for i in self['features'] if 'collection' in i])))
input_collections = cols if len(cols) != 0 else 'none'
collections_str = '/'.join(input_collections)

items_str = '/'.join(sorted(list([i['id'] for i in self['features']])))
if 'id' not in self:
self['id'] = f"{collections_str}/workflow-{self['process']['workflow']}/{items_str}"
Expand Down Expand Up @@ -218,7 +218,7 @@ def publish_to_s3(self, bucket, public=False) -> List:

# publish to bucket
headers = opts.get('headers', {})

extra = {'ContentType': 'application/json'}
extra.update(headers)
s3session.upload_json(item, url, public=public, extra=extra)
Expand Down Expand Up @@ -261,7 +261,7 @@ def sns_attributes(self, item) -> Dict:
'bbox.ur_lat': {
'DataType': 'Number',
'StringValue': str(item['bbox'][3])
}
}
}
if 'eo:cloud_cover' in item['properties']:
attr['cloud_cover'] = {
Expand All @@ -288,7 +288,7 @@ def publish_to_sns(self, topic_arn=PUBLISH_TOPIC_ARN):
"""
for item in self['features']:
response = snsclient.publish(TopicArn=topic_arn, Message=json.dumps(item),
MessageAttributes=self.sns_attributes(item))
MessageAttributes=self.sns_attributes(item))
self.logger.debug(f"Published item to {topic_arn}")

def process(self) -> str:
Expand Down Expand Up @@ -425,7 +425,7 @@ def process(self, replace=False):
catalog (Dict): A Cirrus Input Catalog
"""
catids = []
# check existing states
# check existing states
states = self.get_states()
for cat in self.catalogs:
_replace = replace or cat['process'].get('replace', False)
Expand Down
2 changes: 1 addition & 1 deletion src/cirruslib/errors.py → src/cirrus/lib/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ class InvalidInput(Exception):
Args:
Exception (Exception): Base class
"""
pass
pass
2 changes: 1 addition & 1 deletion src/cirruslib/logging.py → src/cirrus/lib/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"handlers": ["standard"],
"level": getenv('CIRRUS_LOG_LEVEL', 'DEBUG')
},
"cirruslib": {
"cirrus.lib": {
"handlers": ["standard"],
"level": getenv('CIRRUS_LOG_LEVEL', 'DEBUG')
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/cirruslib/transfer.py → src/cirrus/lib/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from copy import deepcopy
from dateutil.parser import parse as dateparse
from os import getenv, path as op
from cirruslib.utils import get_path
from cirrus.lib.utils import get_path

from typing import Dict, Optional, List

Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions src/cirruslib/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion src/cirruslib/version.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import unittest

from cirruslib import Catalog
from cirrus.lib.catalog import Catalog

testpath = os.path.dirname(__file__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_statedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from copy import deepcopy
from datetime import datetime
from decimal import Decimal
from cirruslib.statedb import StateDB, STATES
from cirrus.lib.statedb import StateDB, STATES

## fixtures
testpath = os.path.dirname(__file__)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import unittest

from boto3utils import s3
from cirruslib import transfer
from cirrus.lib import transfer
from shutil import rmtree

testpath = f"{os.path.dirname(__file__)}/test_transfer"
Expand Down

0 comments on commit e36253d

Please sign in to comment.