Skip to content

Commit 44e7ee5

Browse files
CodyCBakerPhDCodyCBakerPhDpre-commit-ci[bot]
authored
Minor updates for EMBER support (#143)
* fix some imports and upgrade to rich click * some updates to parsing manifest * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix minimal imports; add minimal import test; add email notifications * fix secret passing; fix gawk compile; expose api_url to internal helpers * expose --api-url to CLI * generalize tests * add pytest marks; temporarily suppress DANDI in CI; debug relative path * debugging cross-platform * debugging cross-platform * debugging cross-platform * debugging cross-platform * properly mark remote tests * fix passing of api URL * allow missing zarr subdir * add changelog --------- Co-authored-by: CodyCBakerPhD <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fcc0d8c commit 44e7ee5

21 files changed

+211
-148
lines changed

.github/workflows/dailies.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy daily tests
2+
3+
on:
4+
schedule:
5+
- cron: "0 6 * * *" # Daily at 2am EST
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
14+
DailyTests:
15+
uses: ./.github/workflows/testing.yml
16+
secrets:
17+
CODECOV_CREDENTIALS: ${{ secrets.CODECOV_CREDENTIALS }}
18+
19+
NotifyOnFailure:
20+
runs-on: ubuntu-latest
21+
needs: [ DailyTests ]
22+
if: ${{ always() && needs.DailyTests.result == 'failure' }}
23+
steps:
24+
- uses: dawidd6/action-send-mail@v3
25+
with:
26+
server_address: smtp.gmail.com
27+
server_port: 465
28+
username: ${{ secrets.MAIL_USERNAME }}
29+
password: ${{ secrets.MAIL_PASSWORD }}
30+
subject: "CI Failure: nwb2bids Daily Tests"
31+
to: [email protected] # Add more with comma separation (no spaces)
32+
from: s3-log-extraction
33+
body: "The daily test workflow failed, please check status at https://github.com/dandi/s3-log-extraction/actions/workflows/dailies.yml"
34+
35+
# LiveServices:
36+
# uses: ./.github/workflows/testing_live_services.yml
37+
# secrets:
38+
# IP_HASH_SALT: ${{ secrets.IP_HASH_SALT }}
39+
# IPINFO_API_KEY: ${{ secrets.IPINFO_API_KEY }}
40+
# CODECOV_CREDENTIALS: ${{ secrets.CODECOV_CREDENTIALS }}

.github/workflows/deploy_daily_tests.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/testing.yml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
name: Dev tests
1+
name: Primary testing workflow
22
on:
33
workflow_call:
44
secrets:
55
CODECOV_CREDENTIALS:
66
required: true
77

8+
env:
9+
S3_LOG_EXTRACTION_PASSWORD: ${{ secrets.S3_LOG_EXTRACTION_PASSWORD }}
10+
811
jobs:
912

1013
run:
@@ -13,8 +16,6 @@ jobs:
1316
# Requirement settings identified as 'DevTests / ubuntu'
1417
name: ubuntu
1518
runs-on: ubuntu-latest
16-
strategy:
17-
fail-fast: false
1819

1920
steps:
2021
- uses: actions/checkout@v4
@@ -25,11 +26,18 @@ jobs:
2526
python-version: "3.13"
2627

2728
- name: Global Setup
28-
run: |
29-
python -m pip install -U pip
30-
pip install pytest-cov
29+
run: python -m pip install -U pip
30+
31+
- name: Minimal local installation
32+
run: pip install --no-cache-dir .
33+
34+
- name: Display installed packages and their sources for debugging
35+
run: pip list
3136

32-
- name: Install local checkout
37+
- name: Test basic import
38+
run: python -c "import s3_log_extraction"
39+
40+
- name: Full installation
3341
run: pip install --no-cache-dir .[all] --group all
3442

3543
- name: Display installed packages and their sources for debugging
@@ -38,17 +46,17 @@ jobs:
3846
- name: Test basic import
3947
run: python -c "import s3_log_extraction"
4048

41-
# - name: Run pytest with coverage and printout coverage for debugging
42-
# run: |
43-
# pytest tests -vv -rsx --cov=s3_log_extraction --cov-report xml:./coverage.xml
44-
# cat ./coverage.xml
45-
#
46-
# - name: Upload coverage to Codecov
47-
# uses: codecov/codecov-action@v4
48-
# with:
49-
# token: ${{ secrets.CODECOV_CREDENTIALS }}
50-
# file: ./coverage.xml
51-
# flags: unittests
52-
# name: codecov-umbrella
53-
# fail_ci_if_error: true
54-
# verbose: true
49+
- name: Run pytest with coverage and printout coverage for debugging
50+
run: |
51+
pytest tests -m "not dandi and not remote" -vv -rsx --cov=s3_log_extraction --cov-report xml:./coverage.xml
52+
cat ./coverage.xml
53+
54+
- name: Upload coverage to Codecov
55+
uses: codecov/codecov-action@v4
56+
with:
57+
token: ${{ secrets.CODECOV_CREDENTIALS }}
58+
file: ./coverage.xml
59+
flags: unittests
60+
name: codecov-umbrella
61+
fail_ci_if_error: true
62+
verbose: true

.github/workflows/testing_live_services.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
# Requirement settings identified as 'DevTests / ubuntu'
2222
name: ubuntu
2323
runs-on: ubuntu-latest
24-
strategy:
25-
fail-fast: false
2624

2725
steps:
2826
- uses: actions/checkout@v4
@@ -36,7 +34,7 @@ jobs:
3634
run: python -m pip install -U pip
3735

3836
- name: Install local checkout
39-
run: pip install --no-cache-dir .[dev]
37+
run: pip install --no-cache-dir .[all] --group all
4038

4139
- name: Display installed packages and their sources for debugging
4240
run: pip list
@@ -55,12 +53,12 @@ jobs:
5553
name: Ensure caching is working
5654
run: |
5755
ls ~
58-
ls ~/.dandi_s3_log_parser
59-
cat ~/.dandi_s3_log_parser/ip_hash_to_region.yaml
56+
ls ~/.s3_log_extraction
57+
cat ~/.s3_log_extraction/ip_hash_to_region.yaml
6058
6159
- name: Run pytest with coverage and printout coverage for debugging
6260
run: |
63-
pytest test_live_services -vv -rsx --cov=dandi_s3_log_parser --cov-report xml:./coverage.xml
61+
pytest -m "remote" -vv -rsx --cov=s3_log_extraction --cov-report xml:./coverage.xml
6462
cat ./coverage.xml
6563
6664
- name: Upload coverage to Codecov

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44

55

66

7+
# v1.2.0
8+
9+
## Features
10+
11+
Support for child instances of DANDI has been added by way of an `--api-url` flag on the CLI for `s3logextraction update summaries` and an `api_url` parameter for the corresponding API methods.
12+
13+
## Improvements
14+
15+
Upgraded CLI to use `rich_click` for better formatting.
16+
17+
## Fixes
18+
19+
Moved some exposed imports to local levels to allow successful import of package under minimal installation conditions.
20+
21+
22+
723
# v1.1.3
824

925
## Features
@@ -17,7 +33,7 @@ Now tracks 'unassociated' access activity for DANDI summaries, which includes al
1733

1834
Added `s3_log_extraction.dataase.bundle_database` method for creating a hive-partitioned Parquet-based database of the extraction cache for easier sharing.
1935

20-
# Improvements
36+
## Improvements
2137

2238
Added `bogon` labeling for IP addresses that are not routable on the public internet, such as private IPs and reserved ranges. This improves the update iteration of the `s3logextraction update ip regions`.
2339

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</p>
77
<p>
88
<a href="https://pypi.org/project/s3-log-extraction/"><img alt="PyPI latest release version" src="https://badge.fury.io/py/s3-log-extraction.svg?id=py&kill_cache=1"></a>
9-
<a href="https://github.com/dandi/s3-log-extraction/blob/main/license.txt"><img alt="License: MIT" src="https://img.shields.io/pypi/l/s3-log-extraction.svg"></a>
9+
<a href="https://github.com/dandi/s3-log-extraction/blob/main/LICENSE.txt"><img alt="License: MIT" src="https://img.shields.io/pypi/l/s3-log-extraction.svg"></a>
1010
<a href="https://doi.org/10.5281/zenodo.17147965"><img src="https://zenodo.org/badge/826995164.svg" alt="DOI"></a>
1111
</p>
1212
<p>
@@ -21,6 +21,8 @@ Developed for the [DANDI Archive](https://dandiarchive.org/).
2121

2222
Read more about [S3 logging on AWS](https://web.archive.org/web/20240807191829/https://docs.aws.amazon.com/AmazonS3/latest/userguide/LogFormat.html).
2323

24+
⚠️ This package currently only supports processing of access data (`GET`-type requests); if you wish to use this package for other types of requests (`PUT`/`DELETE`/`HEAD`, etc.) please reach out by raising an issue. ⚠️
25+
2426

2527

2628
## Installation

pyproject.toml

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,15 @@ source = "vcs"
88
[tool.hatch.build.targets.wheel]
99
packages = ["src/s3_log_extraction"]
1010

11-
# This is a temporary hack while waiting for hatch to support PEP 735, Dependency Groups,
12-
# in creating environments. See https://github.com/pypa/hatch/pull/1922 for more
13-
# details.
14-
#
15-
# Execute `hatch env create test` to create the environment
16-
# Execute `hatch run test:pytest tests` to run tests in the hatch environment
17-
[tool.hatch.envs.test]
18-
features = ["all"]
19-
post-install-commands = ["pip install --group test"]
20-
21-
[tool.hatch.envs.coverage]
22-
templates = "test" # Set this environment to inherit from the test environment
23-
post-install-commands = ["pip install --group coverage"]
24-
25-
[tool.hatch.envs.dev]
26-
features = ["all"]
27-
post-install-commands = ["pip install --group dev"]
28-
29-
[tool.hatch.envs.all]
30-
features = ["all"]
31-
post-install-commands = ["pip install --group all"]
32-
3311

3412

3513
[project]
3614
name = "s3-log-extraction"
37-
version="1.1.3"
15+
version="1.2.0"
3816
authors = [
3917
{ name="Cody Baker", email="[email protected]" },
4018
]
41-
description = "Fast extraction of access summary data for S3 logs."
19+
description = "Fast extraction of access summary data from S3 logs."
4220
readme = "README.md"
4321
keywords = [
4422
"AWS",
@@ -56,10 +34,11 @@ dependencies = [
5634
"pandas",
5735
"tqdm",
5836
"PyYAML",
59-
"click",
37+
"rich_click",
6038
"natsort",
6139
"psutil",
6240
"cryptography",
41+
"pydantic",
6342
]
6443
classifiers = [
6544
"Development Status :: 5 - Production/Stable",
@@ -155,6 +134,7 @@ ignore = [
155134
"S101",
156135
"ICN001",
157136
"INP001",
137+
"F821", # Only way to do annotation of lazy imports...
158138
]
159139
fixable = ["ALL"]
160140

@@ -166,8 +146,12 @@ known-first-party = ["s3_log_extraction"]
166146
"src/s3_log_extraction/_hidden_top_level_imports.py" = ["F401"] # Must perform imports here even if not exposed
167147

168148

169-
# None of these environment variables need to be 'correct' with respect to Drogon
149+
# None of these environment variables need to be 'correct' with respect to test suite
170150
[tool.pytest.ini_options]
151+
markers = [
152+
"dandi: mark a test as requiring remote resources",
153+
"remote: mark a test as requiring remote resources",
154+
]
171155
env = [
172156
"IPINFO_API_KEY=a1",
173157
"OPENCAGE_API_KEY=a1",

0 commit comments

Comments
 (0)