Skip to content

Add logging, reorg, classes, pre-commit #5

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ jobs:
- name: Run Tests
run: |
python -m unittest discover -s tests -v

- name: Lint code
if: ${{ matrix.python-version == 3.11 }}
run: |
python -m pip install pre-commit
pre-commit run --all-files
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
repos:
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
args:
- --ignore=E501,E712,W503
- repo: https://github.com/timothycrosley/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
exclude: /tests/
# --strict
args:
[
--no-strict-optional,
--ignore-missing-imports,
--implicit-reexport,
--explicit-package-bases,
]
additional_dependencies:
["types-attrs", "types-requests", "types-setuptools", "types-PyYAML"]
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added `verify` command to cli with accompanying script to ensure that the Merkle tree verification json produced by the `compute` command matches [#3](https://github.com/stacchain/stac-merkle-tree-cli/pull/3)
- Logging to cli tool and associated scripts [#5](https://github.com/stacchain/stac-merkle-tree-cli/pull/5)
- `verify` command to cli with accompanying script to ensure that the Merkle tree verification json produced by the `compute` command matches [#3](https://github.com/stacchain/stac-merkle-tree-cli/pull/3)

### Changed

- Moved compute and verifcation logic into classes for better oop functionality [#5](https://github.com/stacchain/stac-merkle-tree-cli/pull/5)

## [v0.3.0] - 2024-11-20

Expand Down
88 changes: 44 additions & 44 deletions example_catalog/merkle_tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,114 +11,107 @@
"merkle:root": "aa7f89b29cb339032ec86d81d4090bdbd52199152fb657f50b08eec1b3234ee2",
"children": [
{
"node_id": "DEM1_SAR_DGE_30_20101215T103647_20130405T103047_ADS_000000_oCX9",
"node_id": "DEM1_SAR_DGE_30_20101212T230244_20140325T230302_ADS_000000_1jTi",
"type": "Item",
"merkle:object_hash": "22a31ab988181f280a0bfc6872556ad1d670373bd997f711389d057e1b1f531a"
"merkle:object_hash": "ce9f56e695ab1751b8f0c8d9ef1f1ecedaf04574ec3077e70e7426ec9fc61ea4"
},
{
"node_id": "DEM1_SAR_DGE_30_20101212T230244_20140329T113710_ADS_000000_eAmG",
"type": "Item",
"merkle:object_hash": "ac66e07717b56e8421c8fec00b2b300afd49d30a8ec9c6d505df3b0568de9c77"
},
{
"node_id": "DEM1_SAR_DGE_30_20101215T103647_20130405T103047_ADS_000000_RHJx",
"type": "Item",
"merkle:object_hash": "39969fd5f4a3a170ff39df8f2c13ebca66aab40890275a94ce798e281b85d54d"
},
{
"node_id": "DEM1_SAR_DTE_90_20101213T034716_20130408T035028_ADS_000000_5033",
"node_id": "DEM1_SAR_DGE_30_20101215T103647_20130405T103047_ADS_000000_oCX9",
"type": "Item",
"merkle:object_hash": "c1511bd4889e8078010287a820d3fcc216cad1ab48374e324fb7098fd1c3f882"
"merkle:object_hash": "22a31ab988181f280a0bfc6872556ad1d670373bd997f711389d057e1b1f531a"
},
{
"node_id": "DEM1_SAR_DGE_30_20101215T203649_20140913T090954_ADS_000000_4KBA",
"type": "Item",
"merkle:object_hash": "3c22648957e7c76f75a9fbfdf7c164e7d745d9e4ebe809db15d2474e01be4764"
},
{
"node_id": "DEM1_SAR_DGE_30_20101216T005027_20130411T005216_ADS_000000_Hbh2",
"node_id": "DEM1_SAR_DGE_30_20101215T203649_20140913T090954_ADS_000000_Quqd",
"type": "Item",
"merkle:object_hash": "176a6f0026a763a85909d64d3eeac37873cd7c970fae685a6f37bd16d806b3fe"
"merkle:object_hash": "6d16f23e2fe2849ce0316c012e9284b413f7c086a11d6de421c0582b397f513e"
},
{
"node_id": "DEM1_SAR_DTE_30_20101217T200231_20140802T083458_ADS_000000_tFcK",
"node_id": "DEM1_SAR_DGE_30_20101215T203914_20121226T204852_ADS_000000_Yjwo",
"type": "Item",
"merkle:object_hash": "d0114075968ff1a3860eaf90d85317304f96757d6313f396eb556546a9c95006"
"merkle:object_hash": "ed99b4348ede45959a9cf471490f0f2c6a106bb4337a46d07d4fc4b4988f099f"
},
{
"node_id": "DEM1_SAR_DGE_30_20101216T005027_20130331T005208_ADS_000000_J3m5",
"type": "Item",
"merkle:object_hash": "90a0e5265d02fd58ab81437d14ef1c318ec1b86167ac935d6abb598602798690"
},
{
"node_id": "DEM1_SAR_DGE_30_20101215T203649_20140913T090954_ADS_000000_Quqd",
"type": "Item",
"merkle:object_hash": "6d16f23e2fe2849ce0316c012e9284b413f7c086a11d6de421c0582b397f513e"
},
{
"node_id": "DEM1_SAR_DTE_90_20101212T084914_20140212T212323_ADS_000000_1370",
"type": "Item",
"merkle:object_hash": "c4a241c5917f7fcb82bedca10127ad22504b3462c0d3704d76a5f549e2c24010"
},
{
"node_id": "DEM1_SAR_DGE_30_20101212T230244_20140329T113710_ADS_000000_eAmG",
"node_id": "DEM1_SAR_DGE_30_20101216T005027_20130411T005216_ADS_000000_Hbh2",
"type": "Item",
"merkle:object_hash": "ac66e07717b56e8421c8fec00b2b300afd49d30a8ec9c6d505df3b0568de9c77"
"merkle:object_hash": "176a6f0026a763a85909d64d3eeac37873cd7c970fae685a6f37bd16d806b3fe"
},
{
"node_id": "DEM1_SAR_DGE_90_20101212T102356_20130709T103701_ADS_000000_6275",
"type": "Item",
"merkle:object_hash": "ffaee98a244aaad0f970100f0f3b11bf3ffd3f5de74fa473ed86cc851c73dbc9"
},
{
"node_id": "DEM1_SAR_DGE_30_20101215T203914_20121226T204852_ADS_000000_Yjwo",
"type": "Item",
"merkle:object_hash": "ed99b4348ede45959a9cf471490f0f2c6a106bb4337a46d07d4fc4b4988f099f"
},
{
"node_id": "DEM1_SAR_DGE_90_20101212T102356_20130709T103701_ADS_000000_8521",
"type": "Item",
"merkle:object_hash": "6d7dca89eec5da5e31023b7e24b9527e33a021099c8e74791ecda860f96091ab"
},
{
"node_id": "DEM1_SAR_DTE_90_20101212T084914_20130418T085214_ADS_000000_5545",
"node_id": "DEM1_SAR_DTE_30_20101215T203649_20140913T090954_ADS_000000_kipX",
"type": "Item",
"merkle:object_hash": "7611aa1e37ee256bb346d0405c210c9e2256c43e7ed9854b4a91ef75caf59d09"
"merkle:object_hash": "88f4d9bb5b1512f214f1ca60e6ff2bac28640fd0a00339d01c453b6db9fd7f88"
},
{
"node_id": "DEM1_SAR_DTE_90_20101217T224141_20140127T121413_ADS_000000_0611",
"node_id": "DEM1_SAR_DTE_30_20101215T203914_20130404T204908_ADS_000000_CURF",
"type": "Item",
"merkle:object_hash": "9c33c4c49913483588fb7e2aa8084e675649ed253083ab62ac1ebebcfc16a944"
"merkle:object_hash": "457aa1fbc4005627077b55cd673a4457f2afc8a15ef3b776af8df60e60e8e1ab"
},
{
"node_id": "DEM1_SAR_DTE_30_20101215T203914_20130404T204908_ADS_000000_CURF",
"node_id": "DEM1_SAR_DTE_30_20101216T100443_20140415T214254_ADS_000000_9Wqx",
"type": "Item",
"merkle:object_hash": "457aa1fbc4005627077b55cd673a4457f2afc8a15ef3b776af8df60e60e8e1ab"
"merkle:object_hash": "e7b65b76ed20f947d8a2b4ae126b832d9f07fb18822863556c9fa0ac40dae873"
},
{
"node_id": "DEM1_SAR_DTE_30_20101215T203649_20140913T090954_ADS_000000_kipX",
"node_id": "DEM1_SAR_DTE_30_20101217T200231_20140802T083458_ADS_000000_tFcK",
"type": "Item",
"merkle:object_hash": "88f4d9bb5b1512f214f1ca60e6ff2bac28640fd0a00339d01c453b6db9fd7f88"
"merkle:object_hash": "d0114075968ff1a3860eaf90d85317304f96757d6313f396eb556546a9c95006"
},
{
"node_id": "DEM1_SAR_DTE_30_20101216T100443_20140415T214254_ADS_000000_9Wqx",
"node_id": "DEM1_SAR_DTE_90_20101212T084914_20130418T085214_ADS_000000_5545",
"type": "Item",
"merkle:object_hash": "e7b65b76ed20f947d8a2b4ae126b832d9f07fb18822863556c9fa0ac40dae873"
"merkle:object_hash": "7611aa1e37ee256bb346d0405c210c9e2256c43e7ed9854b4a91ef75caf59d09"
},
{
"node_id": "DEM1_SAR_DGE_30_20101212T230244_20140325T230302_ADS_000000_1jTi",
"node_id": "DEM1_SAR_DTE_90_20101212T084914_20140212T212323_ADS_000000_1370",
"type": "Item",
"merkle:object_hash": "ce9f56e695ab1751b8f0c8d9ef1f1ecedaf04574ec3077e70e7426ec9fc61ea4"
"merkle:object_hash": "c4a241c5917f7fcb82bedca10127ad22504b3462c0d3704d76a5f549e2c24010"
},
{
"node_id": "DEM1_SAR_DTE_90_20101212T102356_20130628T103333_ADS_000000_1705",
"type": "Item",
"merkle:object_hash": "ae063aa10078d5316f36718b92f966c9f96f63f621839bd031730eb068c1c265"
},
{
"node_id": "DEM1_SAR_DTE_90_20101213T034716_20130408T035028_ADS_000000_5033",
"type": "Item",
"merkle:object_hash": "c1511bd4889e8078010287a820d3fcc216cad1ab48374e324fb7098fd1c3f882"
},
{
"node_id": "DEM1_SAR_DTE_90_20101217T224141_20140127T121413_ADS_000000_0611",
"type": "Item",
"merkle:object_hash": "9c33c4c49913483588fb7e2aa8084e675649ed253083ab62ac1ebebcfc16a944"
}
]
},
{
"node_id": "TERRAAQUA",
"type": "Collection",
"merkle:object_hash": "6ae6f97edd2994b632b415ff810af38639faa84544aa8a33a88bdf867a649374",
"merkle:root": "6ae6f97edd2994b632b415ff810af38639faa84544aa8a33a88bdf867a649374",
"children": []
},
{
"node_id": "S2GLC",
"type": "Collection",
Expand All @@ -131,6 +124,13 @@
"merkle:object_hash": "3a3803a0dae5dbaf9561aeb4cce2770bf38b5da4b71ca67398fb24d48c43a68f"
}
]
},
{
"node_id": "TERRAAQUA",
"type": "Collection",
"merkle:object_hash": "6ae6f97edd2994b632b415ff810af38639faa84544aa8a33a88bdf867a649374",
"merkle:root": "6ae6f97edd2994b632b415ff810af38639faa84544aa8a33a88bdf867a649374",
"children": []
}
]
}
32 changes: 16 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup

setup(
name='stac_merkle_tree_cli',
version='0.3.0',
author='Jonathan Healy',
author_email='[email protected]',
description='A CLI tool for computing and adding Merkle Tree information to STAC catalogs, collections, or items.',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
url='https://github.com/stacchain/stac-merkle-tree-cli',
name="stac_merkle_tree_cli",
version="0.3.0",
author="Jonathan Healy",
author_email="[email protected]",
description="A CLI tool for computing and adding Merkle Tree information to STAC catalogs, collections, or items.",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
url="https://github.com/stacchain/stac-merkle-tree-cli",
packages=find_packages(),
include_package_data=True,
install_requires=[
'click>=8.0.0',
"click>=8.0.0",
],
entry_points={
'console_scripts': [
'stac-merkle-tree-cli=stac_merkle_tree_cli.cli:cli',
"console_scripts": [
"stac-merkle-tree-cli=stac_merkle_tree_cli.cli:cli",
],
},
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
python_requires=">=3.6",
)
Loading
Loading