Skip to content

Commit

Permalink
Merge pull request #28 from mvexel/0.4
Browse files Browse the repository at this point in the history
0.4
  • Loading branch information
mvexel authored May 25, 2024
2 parents 0f1071a + 654fb6f commit a5819b1
Show file tree
Hide file tree
Showing 19 changed files with 379 additions and 156 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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: build and test

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

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
- name: Setup Python+PDM
uses: pdm-project/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pdm sync -d -G test
- name: test
run: |
pdm run -v pytest tests
34 changes: 0 additions & 34 deletions .github/workflows/python-package.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.venv/
build/
dist/
.pdm-python
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# osmdiff

[![build and test](https://github.com/mvexel/osmdiff/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/mvexel/osmdiff/actions/workflows/build_and_test.yml)

A read-only interface to OpenStreetMap change APIs and files. See also [pyosm](https://github.com/iandees/pyosm) which can do similar things.

Python 3.7+
Expand All @@ -16,8 +18,7 @@ Retrieve the latest replication diff from the OSM API:

```python
>>> from osmdiff import OSMChange
>>> o = OSMChange()
>>> o.frequency = "minute" # the default
>>> o = OSMChange(frequency="minute") # minute is the default frequency
>>> o.get_state() # retrieve current sequence ID
>>> o.sequence_number
2704451
Expand Down Expand Up @@ -104,4 +105,4 @@ I welcome your contributions in code, documentation and suggestions for enhancem

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

If you find `osmdiff` useful, or you use it in commercial software, please consider sponsoring this project.
If you find `osmdiff` useful, or you use it in commercial software, please consider sponsoring this project.
16 changes: 11 additions & 5 deletions tests/try.py → examples/try.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,32 @@

from osmdiff import AugmentedDiff, OSMChange
from osmdiff.osm import Node, Relation, Way
from pathlib import Path

debug = True
osm_change_file = Path("tests", "data", "test_osmchange.xml")
print(osm_change_file)

r = OSMChange(debug=debug)
# absolute path
osm_change_file = osm_change_file.resolve()
print(osm_change_file)


r = OSMChange()
r.get_state()
r.retrieve()
print(r)

r = OSMChange(file="test_osmchange.xml", debug=debug)
r = OSMChange(file=osm_change_file)
print(r)

a = AugmentedDiff(file="test_adiff.xml", debug=debug)
a = AugmentedDiff(file=osm_change_file)
print(a)

a = AugmentedDiff(
# minlon=-160.0,
# minlat=20.0,
# maxlon=-80.0,
# maxlat=60.0,
debug=debug
)
a.get_state()
a.retrieve()
Expand Down
193 changes: 193 additions & 0 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 15 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[project]
name = "osmdiff"
dynamic = ["version"]
authors = [{ name = "Martijn van Exel", email = "[email protected]" }]
maintainers = [{ name = "Martijn van Exel", email = "[email protected]" }]
description = "A read-only API to OpenStreetMap diffs"
description = "A read-only interface to OpenStreetMap change APIs and files"
keywords = ["openstreetmap", "osm", "diff", "changeset", "api"]
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = ["python-dateutil==2.9.0.post0", "requests==2.28.1"]
license = { text = "MIT" }

[tool.pdm.dev-dependencies]
test = ["pytest>=8.2.1", "typing-extensions>=4.12.0"]

[project.urls]
"Homepage" = "https://github.com/mvexel/osmdiff"
"Bug Tracker" = "https://github.com/mvexel/osmdiff/issues"

[project.optional-dependencies]
dev = ["pytest==7.1.3", "pytest-cov==5.0.0"]

[tool.setuptools.dynamic]
version = {attr = "osmdiff.__version__"}
[tool.pytest.ini_options]
markers = ["integration: mark a test as an integration test"]
[tool.pdm]
distribution = true
version = { source = "file", path = "src/osmdiff/__init__.py" }
Loading

0 comments on commit a5819b1

Please sign in to comment.