Skip to content

Commit d35bf64

Browse files
authored
Merge pull request #1 from investigativedata/develop
v0.0.1
2 parents 6d25d92 + 4da27d0 commit d35bf64

File tree

209 files changed

+38381
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+38381
-0
lines changed

.bumpversion.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[bumpversion]
2+
current_version = 0.0.3
3+
commit = True
4+
tag = True
5+
message = 🔖 Bump version: {current_version} → {new_version}
6+
7+
[bumpversion:file:VERSION]
8+
9+
[bumpversion:file:pyproject.toml]
10+
11+
[bumpversion:file:leakrfc/__init__.py]

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
open-pull-requests-limit: 99
6+
schedule:
7+
interval: "daily"
8+
target-branch: "develop"
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
target-branch: "develop"
14+
- package-ecosystem: "docker"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
target-branch: "develop"

.github/workflows/docker.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build docker container
2+
3+
on:
4+
workflow_dispatch: {}
5+
push: {}
6+
7+
permissions:
8+
contents: read
9+
packages: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v3
18+
- name: Docker meta
19+
id: meta
20+
uses: docker/metadata-action@v5
21+
with:
22+
images: ghcr.io/investigativedata/leakrfc
23+
tags: |
24+
type=ref,event=branch
25+
type=semver,pattern={{version}}
26+
type=sha
27+
type=raw,value=latest
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
with:
31+
install: true
32+
- name: Login to GitHub Container Registry
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Build and push release
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
platforms: linux/amd64,linux/arm64
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}
46+
cache-from: type=gha
47+
cache-to: type=gha,mode=max

.github/workflows/python.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main", "develop" ]
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.11", "3.12", "3.13"]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install poetry
27+
run: curl -sSL https://install.python-poetry.org | python3 -
28+
- name: Configure poetry
29+
run: poetry config virtualenvs.in-project true
30+
- name: set PY
31+
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
32+
- name: Set up poetry cache
33+
uses: actions/cache@v4
34+
with:
35+
path: .venv
36+
key: venv-${{ runner.os }}-${{ env.PY }}-${{ hashFiles('**/poetry.lock') }}
37+
- name: Ensure cache is healthy
38+
if: steps.cache.outputs.cache-hit == 'true'
39+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
40+
- name: Set up pre-commit cache
41+
uses: actions/cache@v4
42+
with:
43+
path: ~/.cache/pre-commit
44+
key: pre-commit-${{ runner.os }}-${{ env.PY }}-${{ hashFiles('.pre-commit-config.yaml') }}
45+
- name: Install dependencies
46+
run: poetry install --with dev
47+
- name: Run pre-commit hooks
48+
run: poetry run pre-commit run
49+
- name: Lint with flake8
50+
run: make lint
51+
- name: Test with pytest
52+
run: make test
53+
- name: Test building
54+
run: poetry build
55+
- name: Coveralls
56+
uses: coverallsapp/github-action@v2
57+
with:
58+
flag-name: run-${{ matrix.python-version }}
59+
parallel: true
60+
61+
finish:
62+
needs: test
63+
if: ${{ always() }}
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Coveralls Finished
67+
uses: coverallsapp/github-action@v2
68+
with:
69+
parallel-finished: true
70+
carryforward: "run-3.11,run-3.12,run-3.13"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
_wip
2+
archive/*
3+
.anystore/*
14
# Byte-compiled / optimized / DLL files
25
__pycache__/
36
*.py[cod]
@@ -42,6 +45,7 @@ htmlcov/
4245
.nox/
4346
.coverage
4447
.coverage.*
48+
coverage.lcov
4549
.cache
4650
nosetests.xml
4751
coverage.xml

.pre-commit-config.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This is the configuration file for pre-commit (https://pre-commit.com/).
2+
# To use:
3+
# * Install pre-commit (https://pre-commit.com/#installation)
4+
# * Copy this file as ".pre-commit-config.yaml"
5+
# * Run "pre-commit install".
6+
exclude: tests/fixtures
7+
repos:
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v5.0.0
10+
hooks:
11+
- id: check-added-large-files
12+
- id: check-case-conflict
13+
- id: check-merge-conflict
14+
- id: check-symlinks
15+
- id: check-toml
16+
- id: check-yaml
17+
- id: debug-statements
18+
- id: end-of-file-fixer
19+
- id: mixed-line-ending
20+
args: [ "--fix=lf" ]
21+
- id: trailing-whitespace
22+
23+
# - repo: https://github.com/asottile/pyupgrade
24+
# rev: v3.10.1
25+
# hooks:
26+
# - id: pyupgrade
27+
# args: [ "--py310-plus" ]
28+
29+
- repo: https://github.com/MarcoGorelli/absolufy-imports
30+
rev: v0.3.1
31+
hooks:
32+
- id: absolufy-imports
33+
34+
- repo: https://github.com/pycqa/isort
35+
rev: 5.13.2
36+
hooks:
37+
- id: isort
38+
args: ["--profile", "black"]
39+
40+
- repo: https://github.com/psf/black
41+
rev: 24.10.0
42+
hooks:
43+
- id: black
44+
45+
- repo: https://github.com/csachs/pyproject-flake8
46+
rev: v7.0.0
47+
hooks:
48+
- id: pyproject-flake8
49+
additional_dependencies: [ flake8-bugbear ]
50+
args: [ "--extend-ignore", "E203, E501" ]
51+
exclude: (test_[\w]+\.py|\.csv|\.json|\.lock)$
52+
53+
- repo: https://github.com/codespell-project/codespell
54+
rev: v2.3.0
55+
hooks:
56+
- id: codespell
57+
exclude: (test_[\w]+\.py|\.csv|\.i?json|\.lock)$
58+
59+
- repo: https://github.com/pre-commit/pygrep-hooks
60+
rev: v1.10.0
61+
hooks:
62+
- id: python-check-blanket-noqa
63+
exclude: (test_[\w]+\.py|api/__init__.py)$
64+
- id: python-check-blanket-type-ignore
65+
- id: python-no-eval
66+
- id: python-use-type-annotations
67+
- id: rst-backticks
68+
- id: rst-directive-colons
69+
- id: rst-inline-touching-normal
70+
71+
- repo: https://github.com/python-poetry/poetry
72+
rev: 1.8.0
73+
hooks:
74+
- id: poetry-check
75+
- id: poetry-lock
76+
args: ["--no-update"]
77+
- id: poetry-export
78+
args: ["-f", "requirements.txt", "-o", "requirements.txt"]

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.13-bookworm
2+
3+
RUN apt-get -qq update && apt-get -qq -y upgrade
4+
RUN apt-get install -qq -y pkg-config libicu-dev
5+
RUN apt-get -qq -y autoremove && apt-get clean
6+
7+
RUN pip install --no-cache-dir -q -U pip setuptools
8+
9+
COPY leakrfc /src/leakrfc
10+
COPY setup.py /src/setup.py
11+
# COPY requirements.txt /src/requirements.txt
12+
COPY README.md /src/README.md
13+
COPY pyproject.toml /src/pyproject.toml
14+
COPY VERSION /src/VERSION
15+
COPY LICENSE /src/LICENSE
16+
COPY NOTICE /src/NOTICE
17+
18+
WORKDIR /src
19+
# RUN pip install -r requirements.txt
20+
RUN pip install --no-cache-dir -q "."
21+
RUN pip install --no-cache-dir -q -U redis sqlalchemy psycopg2-binary
22+
23+
ENTRYPOINT ["leakrfc"]

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
all: clean install test
2+
3+
api:
4+
LEAKRFC_ARCHIVE__URI=./tests/fixtures/archive DEBUG=1 uvicorn leakrfc.api:app --reload --port 5000
5+
6+
install:
7+
poetry install --with dev
8+
9+
lint:
10+
poetry run flake8 leakrfc --count --select=E9,F63,F7,F82 --show-source --statistics
11+
poetry run flake8 leakrfc --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
12+
13+
pre-commit:
14+
poetry run pre-commit install
15+
poetry run pre-commit run -a
16+
17+
typecheck:
18+
poetry run mypy --strict leakrfc
19+
20+
test:
21+
poetry run pytest -v --capture=sys --cov=leakrfc --cov-report lcov
22+
23+
build:
24+
poetry run build
25+
26+
clean:
27+
rm -fr build/
28+
rm -fr dist/
29+
rm -fr .eggs/
30+
find . -name '*.egg-info' -exec rm -fr {} +
31+
find . -name '*.egg' -exec rm -f {} +
32+
find . -name '*.pyc' -exec rm -f {} +
33+
find . -name '*.pyo' -exec rm -f {} +
34+
find . -name '*~' -exec rm -f {} +
35+
find . -name '__pycache__' -exec rm -fr {} +

NOTICE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
LEAKRFC, (C) 2024 investigativedata.io
2+
3+
This product includes software developed at investigativedata.io
4+
(https://investigativedata.io)
5+
6+
LEAKRFC contains unmodified subcomponents too with separate copyright notices
7+
and license terms. Your use of the source code for these subcomponents is
8+
subject to the terms and conditions of GNU Affero General Public License 3.0 or
9+
later.

0 commit comments

Comments
 (0)