Skip to content

Commit 086e0a2

Browse files
author
Jakob Stolze
committed
Introducing generated python-sdk
- To reduce development work on the python sdk it will be generated using swagger-codegen - This commit includes the generated sdk merged together with the old sdk where old classes and methods have been marked deprecated. This makes the new sdk available while still providing a copy of the old sdk. - Adds deploy_docs.yaml to deploy documentation to github pages
1 parent 9fc22f3 commit 086e0a2

File tree

390 files changed

+85905
-3455
lines changed

Some content is hidden

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

390 files changed

+85905
-3455
lines changed

.github/workflows/ci-tests.yml

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,7 @@ on:
55
branches: '**'
66

77
jobs:
8-
lint:
9-
runs-on: ubuntu-20.04
10-
steps:
11-
- name: checkout
12-
uses: actions/checkout@v2
13-
- name: Install Python
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: 3.9
17-
- uses: pre-commit/[email protected]
18-
with:
19-
extra_args: --all-files --show-diff-on-failure
208
pytest:
21-
needs:
22-
- lint
239
strategy:
2410
fail-fast: false
2511
matrix:
@@ -40,39 +26,15 @@ jobs:
4026
with:
4127
python-version: ${{ matrix.python-version }}
4228
cache: 'pip'
43-
- name: Select the cache folder
44-
id: cache-folder
45-
run: |
46-
if [ ${{ matrix.os }} == 'ubuntu-20.04' ]; then
47-
CACHE_FOLDER="/home/runner/.cache/pypoetry"
48-
elif [ ${{ matrix.os }} == 'macos-latest' ]; then
49-
CACHE_FOLDER="/Users/runner/Library/Caches/pypoetry"
50-
elif [ ${{ matrix.os }} == 'windows-latest' ]; then
51-
CACHE_FOLDER="C:\Users\runneradmin\AppData\Local\pypoetry\Cache"
52-
fi
53-
echo "Cache folder is $CACHE_FOLDER"
54-
echo "folder=$CACHE_FOLDER" >> "$GITHUB_OUTPUT"
55-
- name: Cache Poetry cache
56-
uses: actions/cache@v3
57-
with:
58-
path: ${{ steps.cache-folder.outputs.folder }}
59-
key: poetry-cache-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}
60-
- name: Run Poetry action
61-
uses: abatilo/actions-poetry@v2
62-
with:
63-
poetry-version: ${{ matrix.poetry-version }}
64-
- name: View poetry --version
65-
run: poetry --version
6629
- name: Install dependencies
67-
run: poetry install
30+
run: pip install -r requirements.txt
31+
- name: Install test dependencies
32+
run: pip install -r test-requirements.txt
33+
- name: Install tox
34+
run: pip install tox
35+
- name: Setup API Key
36+
env:
37+
ORS_API_KEY: ${{ secrets.ORS_API_KEY }}
38+
run: echo "[ORS]\napiKey = $ORS_API_KEY\n" > tests-config.ini
6839
- name: Run tests
69-
run: poetry run pytest
70-
- name: Upload coverage to Codecov
71-
uses: codecov/codecov-action@v3
72-
with:
73-
token: ${{ secrets.CODECOV_TOKEN }}
74-
flags: unittests
75-
env_vars: OS,PYTHON
76-
name: codecov-umbrella
77-
fail_ci_if_error: true
78-
verbose: true
40+
run: python -m tox

.github/workflows/deploy_docs.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Sample workflow for building and deploying a VitePress site to GitHub Pages
2+
#
3+
name: Deploy Python SDK Documentation to Pages
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
- master
10+
release:
11+
types:
12+
- created
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18+
permissions:
19+
contents: read
20+
pages: write
21+
id-token: write
22+
23+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
24+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
25+
concurrency:
26+
group: pages
27+
cancel-in-progress: false
28+
29+
jobs:
30+
# Build job
31+
build:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
with:
37+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
38+
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
39+
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
40+
- name: Setup Node
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: 20
44+
cache: npm # or pnpm / yarn
45+
- name: Setup Pages
46+
uses: actions/configure-pages@v3
47+
- name: Install dependencies
48+
run: npm ci # or pnpm install / yarn install / bun install
49+
- name: Build with VitePress
50+
run: |
51+
npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
52+
touch .vitepress/dist/.nojekyll
53+
- name: Upload artifact
54+
uses: actions/upload-pages-artifact@v2
55+
with:
56+
path: .vitepress/dist
57+
58+
# Deployment job
59+
deploy:
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
needs: build
64+
runs-on: ubuntu-latest
65+
name: Deploy
66+
steps:
67+
- name: Deploy to GitHub Pages
68+
id: deployment
69+
uses: actions/deploy-pages@v2

.gitignore

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
1-
.tox/
2-
.venv*
3-
.env*
4-
.coverage
5-
**/.ipynb_checkpoints/
6-
*.geojson
7-
*.pyc
8-
*.in
9-
*egg-info/
10-
dist/
11-
build/
12-
/docs/build
13-
test.py
1+
# IDE
2+
.vscode
143

15-
#IDE
16-
.spyproject/
17-
.idea/
4+
# Vitepress
5+
/**/node_modules
6+
.vitepress/cache
187

19-
cover/
20-
conda/
21-
*coverage.xml
22-
/setup.py
23-
/requirements.txt
8+
# Python
9+
/**/__pycache__
10+
dist
11+
*.egg-info
12+
13+
# Secrets
14+
tests-config.ini

.vitepress/config.mts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
ignoreDeadLinks: true,
6+
title: "openrouteservice-py",
7+
description: "🐍 The Python API to consume openrouteservice(s) painlessly! ",
8+
base: '/openrouteservice-py/',
9+
head: [
10+
['link', { rel: "icon", type: "image/png", sizes: "32x32", href: "https://giscience.github.io/openrouteservice/ors_fav.png"}],
11+
],
12+
markdown: {
13+
anchor: {
14+
slugify: (s) => encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, '_'))
15+
},
16+
},
17+
vite: {
18+
publicDir: "./examples"
19+
},
20+
themeConfig: {
21+
search: {
22+
provider: 'local'
23+
},
24+
// https://vitepress.dev/reference/default-theme-config
25+
nav: [
26+
{ text: 'Home', link: '/' },
27+
{ text: 'Getting started', link: '/README' },
28+
{ text: 'Forum', link: 'https://ask.openrouteservice.org/c/sdks/10' },
29+
{ text: 'API Playground', link: 'https://openrouteservice.org/dev/#/api-docs' }
30+
],
31+
32+
sidebar: [
33+
{
34+
text: 'Documentation',
35+
link: 'README#documentation-for-api-endpoints',
36+
items: [
37+
{ text: 'Directions GeoJSON', link: '/docs/DirectionsServiceApi#get_geo_json_route' },
38+
{ text: 'Directions JSON', link: '/docs/DirectionsServiceApi#get_json_route' },
39+
{ text: 'Elevation Line', link: '/docs/ElevationApi#elevation_line_post' },
40+
{ text: 'Elevation Point', link: '/docs/ElevationApi#elevation_point_post' },
41+
{ text: 'Geocode Autocomplete ', link: '/docs/GeocodeApi#geocode_autocomplete_get' },
42+
{ text: 'Reverse Geocode', link: '/docs/GeocodeApi#geocode_reverse_get' },
43+
{ text: 'Forward Geocode', link: '/docs/GeocodeApi#geocode_search_get' },
44+
{ text: 'Structured Forward Geocode', link: '/docs/GeocodeApi#geocode_search_structured_get' },
45+
{ text: 'Isochrones', link: '/docs/IsochronesServiceApi#get_default_isochrones'},
46+
{ text: 'Matrix', link: '/docs/MatrixServiceApi#get_default' },
47+
{ text: 'Optimization', link: '/docs/OptimizationApi#optimization_post' },
48+
{ text: 'POIs', link: '/docs/PoisApi#pois_post' }
49+
]
50+
},
51+
{
52+
text: 'Examples',
53+
items: [
54+
{ text: 'Avoid construction sites dynamically', link: 'docs/examples/Avoid_ConstructionSites' },
55+
{ text: 'Dieselgate Routing', link: 'docs/examples/Dieselgate_Routing' },
56+
{ text: 'Route optimization of pub crawl', link: 'docs/examples/ortools_pubcrawl' },
57+
{ text: 'Routing optimization in humanitarian context', link: 'docs/examples/Routing_Optimization_Idai' }
58+
]
59+
},
60+
],
61+
62+
socialLinks: [
63+
{ icon: 'github', link: 'https://github.com/GIScience/openrouteservice-py' },
64+
{ icon: 'x', link: 'https://twitter.com/ors_news' }
65+
]
66+
}
67+
})

.vitepress/theme/custom.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
:root {
2+
--vp-c-brand-1: #b5152b;
3+
--vp-button-brand-bg: #b5152b;
4+
--vp-c-brand-2: #b5152b;
5+
/* values below are taken from the old Jekyll installation of the docs */
6+
--vp-font-family-base: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
7+
--vp-font-family-mono: "SFMono-Regular",menlo,consolas,monospace;
8+
9+
--vp-home-hero-name-color: transparent;
10+
--vp-home-hero-name-background: -webkit-linear-gradient(
11+
120deg,
12+
#b5152b 30%,
13+
#f57124
14+
);
15+
}
16+
17+
.vp-doc h1, .vp-doc h2, .vp-doc h3, .vp-doc h4, .vp-doc h5, .vp-doc h6 {
18+
font-weight: 300;
19+
}
20+
21+
/*
22+
//$body-font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
23+
//$root-font-size: 14px; // Base font-size for rems
24+
//$font-size-8: 28px; //h1
25+
//
26+
//$body-background-color: #fbfcfd;
27+
//$code-background-color: #f7f7f7;
28+
//
29+
//$body-text-color: #5c5c5c;
30+
//$link-color: #d60039;
31+
//$border: 1px solid !default;
32+
//$border-color: #cfcfcf;
33+
*/

.vitepress/theme/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// https://vitepress.dev/guide/custom-theme
2+
import { h } from 'vue'
3+
import type { Theme } from 'vitepress'
4+
import DefaultTheme from 'vitepress/theme'
5+
import './custom.css'
6+
7+
export default {
8+
extends: DefaultTheme,
9+
Layout: () => {
10+
return h(DefaultTheme.Layout, null, {
11+
// https://vitepress.dev/guide/extending-default-theme#layout-slots
12+
})
13+
},
14+
enhanceApp({ app, router, siteData }) {
15+
// ...
16+
}
17+
} satisfies Theme

0 commit comments

Comments
 (0)