Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
f6c43c0
open with encoding
lowtower Nov 1, 2021
64b6952
Update draw_gpx.py
lowtower Nov 1, 2021
a5445cb
Merge branch 'flopp:master' into master
lowtower Nov 22, 2021
6e26d43
- add carto providers with labels
lowtower Dec 9, 2021
ce512f8
support for api keys in cli args
lowtower Dec 9, 2021
8ad6dfa
new tile_provider "jawg maps" (requires key)
lowtower Dec 9, 2021
e5a5d67
extend gitignore
lowtower Jan 17, 2022
3bc17c0
add python 3.9 to Classifiers
lowtower Jan 17, 2022
8f30963
add windows and macOS to workflow matrix
lowtower Jan 17, 2022
b88123c
add automatic build of examples to workflow
lowtower Jan 17, 2022
3bea0be
move generated examples to build subfolder
lowtower Jan 17, 2022
e2ca730
correct upload of examples
lowtower Jan 17, 2022
8f3a58b
correct syntax
lowtower Jan 17, 2022
ee0902a
correct syntax
lowtower Jan 17, 2022
6c066c4
correct syntax
lowtower Jan 17, 2022
71792ca
add examples requirements to linting again
lowtower Jan 17, 2022
b346689
create virtual environment first
lowtower Jan 17, 2022
1cd8813
create virtual environment first
lowtower Jan 17, 2022
f4db133
discard venv
lowtower Jan 17, 2022
5e97181
mkdir build directory
lowtower Jan 17, 2022
0706247
if statement for image files
lowtower Jan 17, 2022
3e81014
correct ls statements
lowtower Jan 17, 2022
b8d1f01
Merge branch 'feature/github-workflow-win-mac' into main_ext
lowtower Jan 17, 2022
caa9a72
Merge branch 'feature/auto-build-examples' into main_ext
lowtower Jan 17, 2022
2b1dc88
implement tightening to absolute boundaries (of all objects) for svg
Jan 21, 2022
9ef3f89
Merge remote-tracking branch 'origin/feature/tighten_to_bounds' into …
Jan 21, 2022
1f7bfe1
remove small bug with max_b
Jan 21, 2022
bff7cb6
remove small bug self._bounds (union)
Jan 21, 2022
00866fd
remove small bug self._bounds (union) - correct test
Jan 21, 2022
2dd075e
take extra pixel bounds into account
Jan 21, 2022
0edcdb2
pylint
Jan 21, 2022
0c14bc7
add group for all objects, translate and scale afterwards
Jan 24, 2022
e10b9a4
Merge branch 'feature/tighten_to_bounds' into main_ext
Jan 24, 2022
61b4ba1
command line argument for tightening to boundaries (default: old beha…
Jan 24, 2022
abb8f1a
extend tests for context regarding boundaries
Jan 24, 2022
281df1d
Merge branch 'feature/tighten_to_bounds' into main_ext
Jan 24, 2022
e0576b1
remove executable line
Jan 24, 2022
78362c3
add examples for tight boundaries
Jan 25, 2022
0d91d23
Merge branch 'feature/tighten_to_bounds' into main_ext
Jan 25, 2022
eeaa772
copyright year and doc string
Jan 25, 2022
5152f43
doc strings
Jan 25, 2022
02877dd
augmented assignment
Jan 25, 2022
6213448
Merge branch 'flopp:master' into master
lowtower Feb 7, 2022
c560902
create virtual environment first
lowtower Jan 17, 2022
6119c54
create virtual environment first
lowtower Jan 17, 2022
a28e8a2
implement tightening to absolute boundaries (of all objects) for svg
Jan 21, 2022
ab3dc6f
remove small bug with max_b
Jan 21, 2022
4426fd1
remove small bug self._bounds (union)
Jan 21, 2022
8172dad
remove small bug self._bounds (union) - correct test
Jan 21, 2022
e18cd1e
take extra pixel bounds into account
Jan 21, 2022
26f79b8
pylint
Jan 21, 2022
5efe122
add group for all objects, translate and scale afterwards
Jan 24, 2022
5be5114
command line argument for tightening to boundaries (default: old beha…
Jan 24, 2022
e1fbff9
extend tests for context regarding boundaries
Jan 24, 2022
24a97f4
remove executable line
Jan 24, 2022
642b3ca
add examples for tight boundaries
Jan 25, 2022
5da42cf
Merge branch 'main_ext' of https://github.com/lowtower/py-staticmaps …
Feb 7, 2022
9a13599
Merge branch 'flopp:master' into feature/tighten_to_bounds
lowtower Feb 7, 2022
5c3a8be
Merge branch 'feature/tighten_to_bounds' of https://github.com/lowtow…
Feb 7, 2022
14c7438
add codespell
Feb 7, 2022
3e79f39
add docstrings to color.py
Feb 7, 2022
2f8e929
add file docstrings to coordinates.py
Feb 7, 2022
a482657
remove obsolete pylint config
Oct 10, 2022
674fbab
enable mkdocs
Oct 10, 2022
9c795e8
Add and change docstrings in ggole style
Oct 10, 2022
ea692a6
Drop support for version 3.6
Oct 10, 2022
075f2ce
remove temp file
Oct 10, 2022
7da77d4
Merge branch 'feature/mkdocs_google_style' into main_ext
Oct 10, 2022
b1c3e5a
pylint issues
Oct 10, 2022
429ff77
- extend tests
Oct 11, 2022
f6ddcc5
Merge branch 'feature/tighten_to_bounds' into main_ext
Oct 11, 2022
b12f9db
some small docstring issues
Oct 11, 2022
3309cee
python version in Makefile
Oct 11, 2022
6e14ee7
pillow deprectaion warning
Oct 11, 2022
d356e45
make use of node.js 16 in GitHub workflow
Oct 11, 2022
4f70baa
pillow deprectaion warning #2
Oct 11, 2022
1ff484c
examples pylint
Oct 11, 2022
617f572
modifications due to pylint update
Dec 6, 2022
3504fa3
parametrize tests
Dec 6, 2022
28e4109
Node.js 16
Dec 6, 2022
b670c12
Python version
Dec 6, 2022
83da579
Drop python version 3,6, add 3.10 and 3.11
Dec 6, 2022
8927ffa
Drop python version 3,6, add 3.10 and 3.11
Dec 6, 2022
593b2b2
Drop python version 3.11
Dec 6, 2022
e60b7a7
Merge branch 'main_ext' into feature/testing
lowtower Dec 6, 2022
21e1f30
several changes
Dec 6, 2022
8d689e0
Merge branch 'feature/testing' of https://github.com/lowtower/py-stat…
Dec 6, 2022
71ee8bc
Merge pull request #4 from lowtower/feature/testing
lowtower Dec 6, 2022
6b20a94
v0.1: enable installing cairo and cairo examples
Dec 7, 2022
b6f99e7
v0.2: enable installing cairo and cairo examples: add sudo
Dec 7, 2022
6c8ab5a
v0.3: enable installing cairo and cairo examples: increase request ti…
Dec 7, 2022
6fe985c
v0.4: enable installing cairo and cairo examples: re-enable python an…
Dec 7, 2022
2c4c903
v0.5: reorganize Makefile, formatting, linting
Dec 7, 2022
b80d5bc
v0.6: remove mypy.ini -> setup.cfg
Dec 7, 2022
4bbbcdb
pull-request: https://github.com/flopp/py-staticmaps/pull/29/commits/…
Dec 8, 2022
2f9338b
typo
Dec 8, 2022
7fac3cc
remove duplicate coverage
Dec 8, 2022
b0402fc
remove reports directory in "make clean"
Dec 8, 2022
1ffde22
v0.1: test push pictures to assets
Dec 8, 2022
122741d
v0.2: mypy config
Dec 8, 2022
55ec1d4
v0.3: deploy step
Dec 8, 2022
0c4542a
v0.4: move pictures
Dec 8, 2022
f04fef9
v0.5: git push
Dec 8, 2022
035e4d9
v0.6: git push - cd
Dec 8, 2022
33e8818
v0.7: git config user
Dec 8, 2022
4f939a2
v0.8: git config actor
Dec 8, 2022
de172ef
v0.9: git config GITHUB_ACTOR
Dec 8, 2022
87c67b1
v0.10: git config $env.GITHUB_ACTOR
Dec 8, 2022
2310d8c
v0.11: echo env variables
Dec 8, 2022
1f4ee2a
v0.12: echo env variables
Dec 8, 2022
af92189
v0.12a: echo env variables
Dec 8, 2022
7d07e0f
v0.12b: echo env variables
Dec 8, 2022
7aaaef5
v0.12c: echo env variables
Dec 8, 2022
d0ee62f
v0.13: git push
Dec 8, 2022
dd277e4
v0.13a: git push
Dec 8, 2022
21341ae
v0.13b: git push
Dec 8, 2022
0c89926
v0.13c: git push
Dec 8, 2022
c822820
v0.13d: git push
Dec 8, 2022
27f1e38
v0.13e: git push
Dec 8, 2022
60f8eb8
v0.13f: git push
Dec 8, 2022
b2e6e21
v0.13g: git push
Dec 8, 2022
34768a5
v0.13h: git push
Dec 8, 2022
e5a2125
v0.13i: git push
Dec 8, 2022
bb37cec
v0.13j: git push
Dec 8, 2022
dc88a8f
v0.13k: git push
lowtower Dec 8, 2022
e5be5c2
v0.13l: git push
Dec 8, 2022
daa83cb
v0.13m: git push
Dec 8, 2022
078f92b
v0.13n: git push
Dec 8, 2022
2076394
v0.13o: git push
Dec 8, 2022
423132e
v0.13p: git push
Dec 8, 2022
4bc93bc
v0.13q: git push
Dec 8, 2022
cf3f2fd
v0.13r: git push
Dec 8, 2022
e373ec5
v0.13s: git push
Dec 8, 2022
2c87c63
v0.13t: git push
Dec 8, 2022
7f72dd8
Feature/GitHub workflow cairo (#5)
lowtower Dec 8, 2022
106f64d
make setup working again by ignoring "--require" in requirements-dev.txt
Feb 3, 2023
9ca00f5
drop python v3.7 support
Feb 3, 2023
cdefc86
add python v3.11 support
Feb 3, 2023
57aac71
add python v3.11 support
Feb 3, 2023
b0968ff
Merge branch 'bugfix/setup' of https://github.com/lowtower/py-staticm…
Feb 3, 2023
0623044
Merge pull request #6 from lowtower/bugfix/setup
lowtower Feb 3, 2023
e226b4b
ImageDraw.textlength() instead of deprecated method ImageDraw.textsize()
Jul 18, 2023
4a374fd
Merge pull request #7 from lowtower/bugfix/main/pillow10
lowtower Jul 18, 2023
5dbebab
use ImageDraw.textbbox() to retrieve the textbox height
Jul 18, 2023
2eca499
improvement in run-examples
Jul 18, 2023
5f3c043
Merge pull request #8 from lowtower/bugfix/main/pillow10
lowtower Jul 18, 2023
5c4be45
changes for rendering svg images with tightening to object boundaries
Jul 19, 2023
f4006e6
add new bounds object
Jul 21, 2023
68b0c80
add bounds object, change tests, ...
Jul 21, 2023
bc70555
Merge pull request #9 from lowtower/example/tight_bounds
lowtower Jul 21, 2023
0f832f5
add examples to readme, add custom bounds examples
Jul 21, 2023
1814b7c
Merge pull request #10 from lowtower/example/tight_bounds
lowtower Jul 21, 2023
1bc6ae0
fix wrong file names for images in draw_gpx
Jul 21, 2023
14cbac6
add tightening to description
Jul 21, 2023
fade0dd
Change handling of extra pixel bounds - make integer possible instead…
Jul 26, 2023
b9f3e81
Merge pull request #11 from lowtower/example/tight_bounds
lowtower Jul 26, 2023
015410b
Merge branch 'main' of https://github.com/lowtower/py-staticmaps into…
Jul 26, 2023
140e87c
Merge pull request #13 from flopp/master
lowtower Jun 6, 2024
2629784
implement changes from flopp/py-staticmaps master
Jun 6, 2024
92e540d
formatting
Jun 6, 2024
3a9509b
typo
Jun 6, 2024
43db355
pylint disable
Jun 6, 2024
8a492fd
use approx_equals instead of ==
Jun 6, 2024
46726fb
mypy ignore
Jun 6, 2024
6f95a25
update to node.js 20
Jun 6, 2024
ad29e2d
update to node.js 20
Jun 6, 2024
c073df7
remove reference to Stamen
Jun 6, 2024
e252520
commit message in workflow
Jun 6, 2024
a98e150
make use of GitHub secrets for api access tokens
Jun 10, 2024
1163bd5
make use of GitHub secrets for api access tokens
Jun 10, 2024
182996b
make use of GitHub secrets for api access tokens
Jun 10, 2024
410a091
Merge remote-tracking branch 'origin/main'
Jun 10, 2024
6a0bb5d
bugfix: link to image gpx
Jun 10, 2024
fc5b0dc
optimise custom bounds example
Oct 29, 2025
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
46 changes: 46 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8

# 4 space indentation
[*.py]
max_line_length = 120
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false

[mkdocs.yml]
indent_size = 2

# Tab indentation (no size specified)
[Makefile]
max_line_length = 150
indent_style = tab
trim_trailing_whitespace = false

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

62 changes: 56 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
steps:
- name: Git config
run: git config --global core.autocrlf input
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python v${{matrix.python-version}} - ${{runner.os}}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
cache: pip
Expand All @@ -42,23 +42,30 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7]
python-version: [3.11]
needs: "lint_and_test"
if: github.ref == 'refs/heads/main'
steps:
- name: Install cairo
run: sudo apt-get install libcairo2-dev
- name: Git config
run: git config --global core.autocrlf input
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python v${{matrix.python-version}} - ${{runner.os}}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
cache: pip
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install -r requirements-cairo.txt
pip install -r requirements-examples.txt
- name: Build examples
env:
API_KEY_JAWG: ${{ secrets.API_KEY_JAWG }}
API_KEY_STADIA: ${{ secrets.API_KEY_STADIA }}
run: |
cd examples
mkdir build
Expand All @@ -74,7 +81,50 @@ jobs:
(ls *cairo*.png && mv *cairo*.png build/.) || echo "no cairo png files found!"
cd -
- name: Archive examples
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build_examples
path: examples/build
deploy:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.11]
needs: "build"
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup git and push to remote
run: |
export GIT_USER=${{ github.actor }}
git config --global core.autocrlf input
- name: Git clone
run: git clone https://github.com/lowtower/py-staticmaps --branch assets assets
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: build_examples
- name: Move pictures and commit
run: |
mv *.png assets/.
mv *.svg assets/.
cd assets
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git fetch
git pull
git add *.png
git add *.svg
git commit -m "Automatic update of example image files `date +\"%d-%m-%Y %T\"`"
git status
pwd
ls -lrt
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: assets
branch: assets
113 changes: 87 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,87 @@
PROJECT=staticmaps
SRC_CORE=staticmaps
SRC_TEST=tests
SRC_EXAMPLES=examples
SRC_COMPLETE=$(SRC_CORE) $(SRC_TEST) $(SRC_EXAMPLES) docs/gen_ref_pages.py
PYTHON=python3

help: ## Print help for each target
$(info Makefile low-level Python API.)
$(info =============================)
$(info )
$(info Available commands:)
$(info )
@grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
| sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'

clean: ## Cleanup
@rm -rf ./.env
@rm -f ./*.pyc
@rm -rf ./__pycache__
@rm -f $(SRC_CORE)/*.pyc
@rm -rf $(SRC_CORE)/__pycache__
@rm -f $(SRC_TEST)/*.pyc
@rm -rf $(SRC_TEST)/__pycache__
@rm -f $(SRC_EXAMPLES)/*.pyc
@rm -rf $(SRC_EXAMPLES)/__pycache__
@rm -rf $(SRC_EXAMPLES)/build
@rm -rf ./.coverage
@rm -rf ./coverage.xml
@rm -rf ./.pytest_cache
@rm -rf ./.mypy_cache
@rm -rf ./site
@rm -rf ./reports

.PHONY: setup
setup:
python3 -m venv .env
.env/bin/pip install --upgrade pip
setup: ## Setup virtual environment
$(PYTHON) -m venv .env
.env/bin/pip install --upgrade pip wheel
.env/bin/pip install --upgrade --requirement requirements.txt
.env/bin/pip install --upgrade --requirement requirements-dev.txt
.env/bin/pip install --upgrade --requirement requirements-examples.txt

.PHONY: install
install: setup
install: setup ## install package
.env/bin/pip install .

.PHONY: lint
lint:
.env/bin/pylint \
setup.py staticmaps examples tests
lint: ## Lint the code
.env/bin/pycodestyle \
--max-line-length=120 \
setup.py $(SRC_COMPLETE)
.env/bin/isort \
setup.py $(SRC_COMPLETE) \
--check --diff
.env/bin/black \
--line-length 120 \
--check \
--diff \
setup.py $(SRC_COMPLETE)
.env/bin/pyflakes \
setup.py $(SRC_COMPLETE)
.env/bin/flake8 \
setup.py staticmaps examples tests
setup.py $(SRC_COMPLETE)
.env/bin/pylint \
setup.py $(SRC_COMPLETE)
.env/bin/mypy \
setup.py staticmaps examples tests
.env/bin/black \
--line-length 120 \
--check \
--diff \
setup.py staticmaps examples tests
setup.py $(SRC_COMPLETE)
.env/bin/codespell \
README.md staticmaps/*.py tests/*.py examples/*.py

.PHONY: format
format:
format: ## Format the code
.env/bin/isort \
setup.py $(SRC_COMPLETE)
.env/bin/autopep8 \
-i -r \
setup.py $(SRC_COMPLETE)
.env/bin/black \
--line-length 120 \
setup.py staticmaps examples tests
--line-length 120 \
setup.py $(SRC_COMPLETE)

.PHONY: run-examples
run-examples:
run-examples: ## Generate example images
(cd examples && rm -r build)
(cd examples && PYTHONPATH=.. ../.env/bin/python custom_objects.py)
(cd examples && PYTHONPATH=.. ../.env/bin/python draw_gpx.py running.gpx)
(cd examples && PYTHONPATH=.. ../.env/bin/python frankfurt_newyork.py)
Expand All @@ -40,24 +90,35 @@ run-examples:
(cd examples && PYTHONPATH=.. ../.env/bin/python tile_providers.py)
(cd examples && PYTHONPATH=.. ../.env/bin/python us_capitals.py)
(cd examples && PYTHONPATH=.. ../.env/bin/python idl.py)
(cd examples && mv *.svg build/.)
(cd examples && mv *pillow*png build/.)
(cd examples && mv *cairo*png build/.)
(cd -)
(cd examples && mkdir -p build)
(cd examples && ls *.svg 2>/dev/null && mv *.svg build/.) || echo "no svg files found!"
(cd examples && ls *pillow*.png 2>/dev/null && mv *pillow*.png build/.) || echo "no pillow png files found!"
(cd examples && ls *cairo*.png 2>/dev/null && mv *cairo*.png build/.) || echo "no cairo png files found!"

.PHONY: test
test:
test: ## Test the code
PYTHONPATH=. .env/bin/python -m pytest tests

.PHONY: coverage
coverage: ## Generate coverage report for the code
PYTHONPATH=. .env/bin/python -m pytest --cov=staticmaps --cov-branch --cov-report=term --cov-report=html tests

.PHONY: build-package
build-package:
build-package: ## Build the package
rm -rf dist
PYTHONPATH=. .env/bin/python setup.py sdist
PYTHONPATH=. .env/bin/twine check dist/*

.PHONY: upload-package-test
upload-package-test:
upload-package-test: ## Upload package test
PYTHONPATH=. .env/bin/twine upload --repository-url https://test.pypi.org/legacy/ dist/*

.PHONY: upload-package
upload-package:
upload-package: ## Upload package
PYTHONPATH=. .env/bin/twine upload --repository py-staticmaps dist/*

.PHONY: documentation
documentation: ## Generate documentation
@if type mkdocs >/dev/null 2>&1 ; then .env/bin/python -m mkdocs build --clean --verbose ; \
else echo "SKIPPED. Run '.env/bin/python -m install mkdocs' first." >&2 ; fi

Loading
Loading