Skip to content
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
23 changes: 12 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,31 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
operating-system: [ubuntu-20.04, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v3
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --group dev
- name: Check format
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r requirements.testing.txt
- name: Lint with flake8
uv run nox -s check_format
- name: Check lint
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
uv run nox -s check_lint
- name: Check types
run: |
uv run nox -s check_types
- name: Test with pytest
run: |
py.test -s -v --cov-report xml --cov=herepy tests/
uv run nox -s run_tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Module
run: pip install -e .
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.docs.txt
pip install livereload
run: uv sync --group docs
- name: Build Docs
run: mkdocs build
run: uv run mkdocs build
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v3.0
with:
Expand Down
24 changes: 16 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ HerePy
Introduction
============

This library provides a pure Python interface for the `HERE API <https://developer.here.com/>`_. It works with Python versions 3.x.
This library provides a pure Python interface for the `HERE API <https://developer.here.com/>`_. It works with Python versions 3.10 and over.

`HERE <https://www.here.com/>`_ provides location based services. HERE exposes a `rest APIs <https://developer.here.com/documentation>`_ and this library is intended to make it even easier for Python programmers to use.

Expand All @@ -38,6 +38,7 @@ Installing
You can install herepy using Python Package Index::

$ pip install herepy
$ uv pip install herepy

Install with conda from the Anaconda conda-forge channel::

Expand All @@ -57,28 +58,27 @@ Check out the latest development version anonymously with::
$ git clone git://github.com/abdullahselek/HerePy.git
$ cd HerePy

To install dependencies, run either::
To install dependencies for development, use uv::

$ pip install -r requirements.testing.txt
$ pip install -r requirements.txt
$ uv sync

To install the minimal dependencies for production use (i.e., what is installed
with ``pip install herepy``) run::

$ pip install -r requirements.txt
$ uv sync --no-dev

Running Tests
=============

The test suite can be run against a single Python version which requires ``pip install pytest`` and optionally ``pip install pytest-cov`` (these are included if you have installed dependencies from ``requirements.testing.txt``)
The test suite can be run against a single Python version using uv::

To run the unit tests with a single Python version::

$ py.test -v
$ uv run pytest -v

to also run code coverage::

$ py.test --cov=herepy
$ uv run pytest --cov=herepy

To run the unit tests against a set of Python versions::

Expand Down Expand Up @@ -138,6 +138,14 @@ Using
The library provides a Python wrapper around the HERE APIs with different data models. To get started, check out the examples in the ``examples/`` folder or
read the documentation at `https://herepy.abdullahselek.com/ <https://herepy.abdullahselek.com/>`_. All API clients need an API key which you can get from `HERE Developer Portal <https://developer.here.com/>`_.

Publishing
============

Maintainers can publish the package to PyPI using uv::

$ uv build
$ uv publish

License
-------

Expand Down
16 changes: 8 additions & 8 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,38 @@
**From PyPI**

$ pip install herepy
$ uv pip install herepy

**From source**

Install dependencies using `pip`
Install dependencies using `uv`

```console
$ pip install -r requirements.txt
$ uv sync
```

Download the latest `herepy` library from: https://github.com/abdullahselek/HerePy

Extract the source distribution and run
To install the project in editable mode for development:

```console
$ python setup.py build
$ python setup.py install
$ uv sync
```

## Running Tests

The test suite can be run against a single Python version which requires `pip install pytest` and optionally `pip install pytest-cov` (these are included if you have installed dependencies from `requirements.testing.txt`)
The test suite can be run against a single Python version using `uv`

To run the unit tests with a single Python version

```console
$ py.test -v
$ uv run pytest -v
```

to also run code coverage

```console
$ py.test -v --cov-report html --cov=herepy
$ uv run pytest -v --cov-report html --cov=herepy
```

To run the unit tests against a set of Python versions::
Expand Down
9 changes: 3 additions & 6 deletions examples/destination_weather_api.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""Example usage of destination_weather_api."""
#!/usr/bin/env python

from herepy import DestinationWeatherApi, WeatherProductType

destination_weather_api = DestinationWeatherApi("api_key")

# weather conditions with given location name
response = destination_weather_api.weather_for_location_name(
location_name="Berlin", product=WeatherProductType.forecast_7days
)
response = destination_weather_api.weather_for_location_name(location_name="Berlin", product=WeatherProductType.forecast_7days)
print(response.as_dict())

# weather conditions within given coordinates
Expand All @@ -19,7 +18,5 @@
print(response.as_dict())

# weather conditions within given zipcode
response = destination_weather_api.weather_for_zip_code(
zip_code="10025", product=WeatherProductType.forecast_7days
)
response = destination_weather_api.weather_for_zip_code(zip_code="10025", product=WeatherProductType.forecast_7days)
print(response.as_dict())
1 change: 1 addition & 0 deletions examples/ev_charging_stations_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Example usage of ev_charging_stations_api."""
#!/usr/bin/env python

from herepy import EVChargingStationsApi, EVStationConnectorTypes
Expand Down
3 changes: 2 additions & 1 deletion examples/fleet_telematics_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Example usage of fleet_telematics_api."""
#!/usr/bin/env python

from herepy import FleetTelematicsApi, RouteMode, MultiplePickupOfferType
from herepy import FleetTelematicsApi, MultiplePickupOfferType, RouteMode

fleet_telematics_api = FleetTelematicsApi(api_key="api_key")

Expand Down
5 changes: 2 additions & 3 deletions examples/geocoder_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Example usage of geocoder_api."""
#!/usr/bin/env python

from herepy import GeocoderApi
Expand All @@ -17,9 +18,7 @@
print(response.as_dict())

# geocodes with given address details
response = geocoder_api.address_with_details(
house_number=34, street="Barbaros", city="Istanbul", country="Turkey"
)
response = geocoder_api.address_with_details(house_number=34, street="Barbaros", city="Istanbul", country="Turkey")
print(response.as_dict())

# geocodes with given street and city
Expand Down
9 changes: 3 additions & 6 deletions examples/geocoder_autocomplete_api.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
"""Example usage of geocoder_autocomplete_api."""
#!/usr/bin/env python

from herepy import GeocoderAutoCompleteApi

geocoder_autocomplete_api = GeocoderAutoCompleteApi(api_key="api_key")

# ask for a list of suggested addresses found within a specified area
response = geocoder_autocomplete_api.address_suggestion(
query="High", prox=[51.5035, -0.1616], radius=100
)
response = geocoder_autocomplete_api.address_suggestion(query="High", prox=[51.5035, -0.1616], radius=100)
print(response.as_dict())

# ask for a list of suggested addresses within a single country
response = geocoder_autocomplete_api.limit_results_byaddress(
query="Nis", country_code="USA"
)
response = geocoder_autocomplete_api.limit_results_byaddress(query="Nis", country_code="USA")
print(response.as_dict())
1 change: 1 addition & 0 deletions examples/geocoder_reverse_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Example usage of geocoder_reverse_api."""
#!/usr/bin/env python

from herepy import GeocoderReverseApi
Expand Down
3 changes: 2 additions & 1 deletion examples/isoline_routing_api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Example usage of isoline_routing_api."""
#!/usr/bin/env python

from herepy import (
IsolineRoutingApi,
IsolineRoutingTransportMode,
IsolineRoutingMode,
IsolineRoutingTransportMode,
)

isoline_routing_api = IsolineRoutingApi(api_key="api_key")
Expand Down
13 changes: 4 additions & 9 deletions examples/map_image_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Example usage of map_image_api."""
#!/usr/bin/env python

from herepy import MapImageApi
Expand All @@ -20,15 +21,11 @@
print(map_image)

# Get map image for given coordinates, uncertainty and map scheme
map_image = map_image_api.get_mapimage(
coordinates=[28.371425, 77.387695], uncertainty="5m", map_scheme=3
)
map_image = map_image_api.get_mapimage(coordinates=[28.371425, 77.387695], uncertainty="5m", map_scheme=3)
print(map_image)

# Get a dotless map image for given coordinates and uncertainty
map_image = map_image_api.get_mapimage(
coordinates=[28.371425, 77.387695], uncertainty="5m", nodot=True
)
map_image = map_image_api.get_mapimage(coordinates=[28.371425, 77.387695], uncertainty="5m", nodot=True)
print(map_image)

# Get an image showing position with coordinates, city name, image height
Expand All @@ -42,9 +39,7 @@
print(map_image)

# Get an image showing with coordinates and country name
map_image = map_image_api.get_mapimage(
coordinates=[60.17675, 24.929974], country_name="Finland", zoom=15
)
map_image = map_image_api.get_mapimage(coordinates=[60.17675, 24.929974], country_name="Finland", zoom=15)
print(map_image)

# Get an image showing with coordinates, country name and center
Expand Down
3 changes: 2 additions & 1 deletion examples/map_tile_api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Example usage of map_tile_api."""
#!/usr/bin/env python

from herepy import (
BaseMapTileResourceType,
MapTileApi,
MapTileApiType,
BaseMapTileResourceType,
TrafficMapTileResourceType,
)

Expand Down
13 changes: 4 additions & 9 deletions examples/places_api.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
"""Example usage of places_api."""
#!/usr/bin/env python

from herepy import PlacesApi

places_api = PlacesApi(api_key="api_key")

# fetches a list of places based on a query string
response = places_api.onebox_search(
coordinates=[37.7905, -122.4107], query="restaurant"
)
response = places_api.onebox_search(coordinates=[37.7905, -122.4107], query="restaurant")
print(response.as_dict())

# fetches a list of places based on a query string and country code
response = places_api.search_in_country(
coordinates=[37.7905, -122.4107], query="cafe", country_code="USA"
)
response = places_api.search_in_country(coordinates=[37.7905, -122.4107], query="cafe", country_code="USA")
print(response.as_dict())

# a list of popular places around a location
response = places_api.places_in_circle(
coordinates=[37.7905, -122.4107], radius=1000, query="cafe", limit=40
)
response = places_api.places_in_circle(coordinates=[37.7905, -122.4107], radius=1000, query="cafe", limit=40)
print(response.as_dict())
1 change: 1 addition & 0 deletions examples/public_transit_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Example usage of public_transit_api."""
#!/usr/bin/env python

from herepy import PublicTransitApi, PublicTransitSearchMethod
Expand Down
4 changes: 2 additions & 2 deletions examples/rme_api.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Example usage of rme_api."""
#!/usr/bin/env python

import io

from herepy import RmeApi

rme_api = RmeApi(api_key="api_key")

# retrieves misc information about the route given in gpx file
with io.open("testdata/routes/sample.gpx", encoding="utf-8") as gpx_file:
with open("testdata/routes/sample.gpx", encoding="utf-8") as gpx_file:
gpx_content = gpx_file.read()
response = rme_api.match_route(gpx_content, ["ADAS_ATTRIB_FCn(SLOPES)"])
print(response.as_dict())
Loading
Loading