Skip to content

Commit 7a8f2c8

Browse files
committed
move to github pages etc.
1 parent e068ebd commit 7a8f2c8

8 files changed

Lines changed: 109 additions & 69 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
4-
name: Python application
1+
name: CI
52

63
on:
74
push:
@@ -13,27 +10,36 @@ permissions:
1310
contents: read
1411

1512
jobs:
16-
build:
17-
13+
test:
1814
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ["3.10", "3.11", "3.12"]
1918

2019
steps:
21-
- uses: actions/checkout@v3
22-
- name: Set up Python 3.11
23-
uses: actions/setup-python@v3
20+
- uses: actions/checkout@v4
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
2423
with:
25-
python-version: "3.11"
24+
python-version: ${{ matrix.python-version }}
25+
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install flake8 pytest
29+
pip install flake8 pytest pylint
3030
pip install -e .
31+
3132
- name: Lint with flake8
3233
run: |
3334
# stop the build if there are Python syntax errors or undefined names
3435
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3536
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3637
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38+
39+
- name: Lint with pylint
40+
run: |
41+
pylint $(git ls-files '*.py')
42+
3743
- name: Test with pytest
3844
run: |
39-
pytest
45+
pytest

.github/workflows/docs.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [ "public" ]
6+
pull_request:
7+
branches: [ "public" ]
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: '3.11'
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install -e ".[docs]"
35+
36+
- name: Setup Pages
37+
id: pages
38+
uses: actions/configure-pages@v5
39+
40+
- name: Build documentation
41+
run: |
42+
cd docs
43+
make html
44+
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: docs/_build/html
49+
50+
deploy:
51+
# Only deploy on pushes to main branch, not on PRs
52+
if: github.ref == 'refs/heads/public' && github.event_name == 'push'
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
runs-on: ubuntu-latest
57+
needs: build
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

.github/workflows/pylint.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/python-publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ jobs:
2020
id-token: write # required for trusted publishing
2121

2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424

2525
- name: Set up Python
26-
uses: actions/setup-python@v4
26+
uses: actions/setup-python@v5
2727
with:
2828
python-version: '3.11'
2929

30-
- name: Install build & publish tools
30+
- name: Install build tools
3131
run: |
3232
python -m pip install --upgrade pip
33-
pip install build twine
33+
pip install build
3434
3535
- name: Build package
3636
run: |

docs/conf.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77
project.
88
"""
99

10+
from pathlib import Path
11+
try:
12+
import tomllib
13+
except ImportError:
14+
import tomli as tomllib
15+
16+
# Read project metadata from pyproject.toml
17+
project_root = Path(__file__).parent.parent
18+
pyproject_path = project_root / "pyproject.toml"
19+
20+
with open(pyproject_path, "rb") as f:
21+
pyproject_data = tomllib.load(f)
22+
23+
project_meta = pyproject_data["project"]
24+
1025
# -- General configuration ------------------------------------------------
1126

1227
extensions = ["sphinx.ext.autodoc"]
@@ -17,12 +32,13 @@
1732

1833
MASTER_DOC = "index"
1934

20-
PROJECT = "Geo sampling"
21-
COPYRIGHT_INFO = "2016--2025, Suriyan Laohaprapanon, Gaurav Sood"
22-
AUTHOR = "Suriyan Laohaprapanon, Gaurav Sood"
35+
PROJECT = project_meta["name"].replace("-", " ").title()
36+
AUTHORS = ", ".join([author["name"] for author in project_meta["authors"]])
37+
COPYRIGHT_INFO = f"2016--2025, {AUTHORS}"
38+
AUTHOR = AUTHORS
2339

24-
VERSION = "0.2.1"
25-
RELEASE = "0.2.1"
40+
VERSION = project_meta["version"]
41+
RELEASE = project_meta["version"]
2642

2743
LANGUAGE = None
2844

geo_sampling/geo_roads.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def bbbike_submit_extract_link(args):
413413
Returns:
414414
bool: True if submission is successful, False otherwise.
415415
"""
416-
response = requests.get(args.bbbike_url + "&submit=1")
416+
response = requests.get(args.bbbike_url + "&submit=1", timeout=30)
417417
if response.status_code == 200:
418418
print("Extract link submitted")
419419
return True
@@ -434,7 +434,8 @@ def bbbike_check_download_link(args):
434434
while wait_time < BBBIKE_MAX_WAIT:
435435
try:
436436
response = requests.get(
437-
"https://download.bbbike.org/osm/extract/?date=all"
437+
"https://download.bbbike.org/osm/extract/?date=all",
438+
timeout=30
438439
)
439440
if response.status_code == 200:
440441
soup = BeautifulSoup(response.text, "html.parser")

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ dependencies = [
3636

3737
[project.optional-dependencies]
3838
dev = ["check-manifest"]
39-
test = ["coverage"]
39+
test = ["coverage", "pytest"]
40+
docs = ["sphinx>=4.0", "sphinx_rtd_theme", "tomli>=1.2.0;python_version<'3.11'"]
4041

4142
[project.urls]
4243
Homepage = "https://github.com/geosensing/geo_sampling"

readthedocs.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)