Skip to content
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

v0.1.0 #6

Open
wants to merge 12 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
2 changes: 2 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ current_version = 0.0.11
commit = True
tag = True

[bumpversion:file:pyproject.toml]

[bumpversion:file:ftm_geocode/__init__.py]

[bumpversion:file:VERSION]
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
open-pull-requests-limit: 99
schedule:
interval: "daily"
target-branch: "develop"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
target-branch: "develop"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
target-branch: "develop"
19 changes: 10 additions & 9 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build docker container
name: Docker

on:
workflow_dispatch: {}
Expand All @@ -11,33 +11,34 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ghcr.io/simonwoerpel/ftm-geocode
images: ghcr.io/investigativedata/ftm-geocode
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=raw,value=latest
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push release
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/build.yml

This file was deleted.

70 changes: 70 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python

on:
push:
branches: ["main"]
pull_request:
branches: ["main", "develop"]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Set up poetry cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.PY }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
- name: Set up pre-commit cache
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ env.PY }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install dependencies
run: poetry install --with dev --all-extras
- name: Run pre-commit hooks
run: poetry run pre-commit run
- name: Lint with flake8
run: make lint
- name: Test with pytest
run: make test
- name: Test building
run: poetry build
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
flag-name: run-${{ matrix.python-version }}
parallel: true

finish:
needs: test
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "run-3.11,run-3.12,run-3.13"
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
libpostal*
followthemoney.store*
cache.db*
.anystore

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -50,6 +49,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
coverage.lcov
*.cover
*.py,cover
.hypothesis/
Expand Down
74 changes: 74 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This is the configuration file for pre-commit (https://pre-commit.com/).
# To use:
# * Install pre-commit (https://pre-commit.com/#installation)
# * Copy this file as ".pre-commit-config.yaml"
# * Run "pre-commit install".
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: [ "--fix=lf" ]
- id: trailing-whitespace

# - repo: https://github.com/asottile/pyupgrade
# rev: v3.10.1
# hooks:
# - id: pyupgrade
# args: [ "--py310-plus" ]

- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/csachs/pyproject-flake8
rev: v7.0.0
hooks:
- id: pyproject-flake8
additional_dependencies: [ flake8-bugbear ]
args: [ "--extend-ignore", "E203, E501" ]
exclude: (test_[\w]+\.py|\.csv|\.json|\.lock)$

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
exclude: (test_[\w]+\.py|\.csv|\.i?json|\.lock)$

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
exclude: (test_[\w]+\.py)$
- id: python-check-blanket-type-ignore
- id: python-no-eval
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/python-poetry/poetry
rev: 2.0.0
hooks:
- id: poetry-check
- id: poetry-lock
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ FROM ghcr.io/investigativedata/libpostal:main
RUN apt-get update && apt-get -y upgrade

COPY ftm_geocode /app/ftm-geocode/ftm_geocode
COPY data /app/ftm-geocode/
COPY data /app/ftm-geocode/data
COPY setup.py /app/ftm-geocode/
COPY setup.cfg /app/ftm-geocode/
COPY pyproject.toml /app/ftm-geocode/
COPY README.md /app/ftm-geocode/
COPY VERSION /app/ftm-geocode/

WORKDIR /app/ftm-geocode
RUN pip install -U pip setuptools
RUN pip install -e ".[postal]"
RUN pip install ".[postal]"
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
all: clean install test

install:
pip install -e .
pip install twine coverage nose moto pytest pytest-cov black flake8 isort bump2version mypy ipdb
poetry install --with dev

test: install
rm -rf ./cache.db*
pytest tests -s --cov=ftm_geocode --cov-report term-missing
rm -rf ./cache.db*
lint:
poetry run flake8 ftm_geocode --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 ftm_geocode --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

pre-commit:
poetry run pre-commit install
poetry run pre-commit run -a

typecheck:
mypy --strict ftm_geocode
poetry run mypy --strict ftm_geocode

build:
python setup.py sdist bdist_wheel
test:
poetry run pytest -v --capture=sys --cov=ftm_geocode --cov-report lcov

release: clean build
twine upload dist/*
build:
poetry run build

clean:
rm -fr build/
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# ftm-geocoder
[![ftm-geocode on pypi](https://img.shields.io/pypi/v/ftm-geocode)](https://pypi.org/project/ftm-geocode/)
[![Python test and package](https://github.com/investigativedata/ftm-geocode/actions/workflows/python.yml/badge.svg)](https://github.com/investigativedata/ftm-geocode/actions/workflows/python.yml)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Coverage Status](https://coveralls.io/repos/github/investigativedata/ftm-geocode/badge.svg?branch=main)](https://coveralls.io/github/investigativedata/ftm-geocode?branch=main)
[![GPL-3.0 License](https://img.shields.io/pypi/l/ftm-geocode)](./LICENSE)

# ftm-geocode

Batch parse and geocode addresses from
[followthemoney entities](https://followthemoney.readthedocs.io/en/latest/).
Expand Down
Loading
Loading