Skip to content

Commit d21fee4

Browse files
committed
Merge remote-tracking branch 'origin' into feature-bounding-box
2 parents d328bde + 956e773 commit d21fee4

File tree

89 files changed

+19076
-1412
lines changed

Some content is hidden

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

89 files changed

+19076
-1412
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: documentation
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
checks:
11+
if: github.event_name != 'push'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v1
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: '12.x'
18+
- name: Test Build
19+
run: |
20+
cd docs
21+
if [ -e yarn.lock ]; then
22+
yarn install --frozen-lockfile
23+
elif [ -e package-lock.json ]; then
24+
npm ci
25+
else
26+
npm i
27+
fi
28+
npm run build
29+
gh-release:
30+
if: github.event_name != 'pull_request'
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v1
34+
- uses: actions/setup-node@v1
35+
with:
36+
node-version: '12.x'
37+
- uses: webfactory/[email protected]
38+
with:
39+
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
40+
- name: Release to GitHub Pages
41+
env:
42+
USE_SSH: true
43+
GIT_USER: git
44+
run: |
45+
cd docs
46+
git config --global user.email "[email protected]"
47+
git config --global user.name "Saif Ul Islam"
48+
if [ -e yarn.lock ]; then
49+
yarn install --frozen-lockfile
50+
elif [ -e package-lock.json ]; then
51+
npm ci
52+
else
53+
npm i
54+
fi
55+
npm run deploy

.github/workflows/pypi-publish.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This workflow will build the distributions with sdist, bdist_wheel, run tests, format, and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Mapillary Python SDK - Publishing to PyPi
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python 3.9
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: 3.9
21+
22+
- name: Install dependencies
23+
run: |
24+
python3 -m pip install --upgrade pip
25+
pip install wheel build twine readme-renderer check-manifest
26+
27+
- name: Setup PyPi RC
28+
run: |
29+
touch ~/.pypirc
30+
cat >> ~/.pypyirc <<EOL
31+
[distutils]
32+
index-servers =
33+
pypi
34+
testpypi
35+
36+
[testpypi]
37+
repository: https://test.pypi.org/legacy
38+
username = ${{ secrets.PYPI_USERNAME }}
39+
password = ${{ secrets.PYPI_PASSWORD }}
40+
41+
[pypi]
42+
username = ${{ secrets.PYPI_USERNAME }}
43+
password = ${{ secrets.PYPI_PASSWORD }}
44+
EOL
45+
46+
- name: Uploading To PyPi
47+
run: |
48+
python3 setup.py upload
49+
50+
- name: Publish a Python distribution to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
with:
53+
user: ${{ secrets.PYPI_USERNAME }}
54+
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/pytest.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will install Python dependencies, run tests, format, and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Mapillary Python SDK - PyTest Workflow
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python 3.9
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.9
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install flake8 black pytest requests mercantile vt2geojson mapillary
27+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28+
- name: Formatting with black
29+
run: |
30+
make format
31+
- name: Lint with flake8
32+
run: |
33+
make lint
34+
- name: Test with pytest
35+
run: |
36+
make test

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ share/python-wheels/
2626
*.egg
2727
MANIFEST
2828

29+
# PyCharm
30+
.idea/
31+
2932
# PyInstaller
3033
# Usually these files are written by a python script from a template
3134
# before PyInstaller builds the exe, so as to inject date/other infos into it.
@@ -138,4 +141,7 @@ dmypy.json
138141
cython_debug/
139142

140143
# Testing
141-
tests/helper/data/*.geojson
144+
tests/helper/data/*.geojson
145+
146+
# Sphinx documentation generation
147+
sphinx-docs/

Makefile

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,129 @@
11
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
22

3-
style:
4-
black src/mapillary && flake8 src/mapillary
3+
define PYTHON_SCRIPT
54

5+
import os
6+
import sys
7+
8+
sys.path.insert(0, os.path.abspath('../'))
9+
10+
11+
def skip(app, what, name, obj, would_skip, options):
12+
'''Skip'''
13+
14+
extensions.append('sphinx_autodoc_typehints')
15+
16+
if name in ('__init__',):
17+
return False
18+
return would_skip
19+
20+
21+
def setup(app):
22+
'''Setup App'''
23+
24+
app.connect('autodoc-skip-member', skip)
25+
endef
26+
27+
# SETUP
28+
29+
# # Setup all
30+
setup: setup-prod setup-dev
31+
32+
# # Install needed dependencies
33+
setup-prod:
34+
python -m pip install --upgrade pip
35+
pip install pipenv
36+
pipenv install
37+
38+
# # Install developer dependencies
39+
setup-dev:
40+
python -m pip install --upgrade pip
41+
pip install pipenv
42+
pipenv install --dev
43+
44+
# PACKAGE BUILD
45+
46+
# # Build the package
47+
build:
48+
# Builds the package distributions
49+
python3 setup.py sdist bdist_wheel --universal
50+
51+
local-install:
52+
# Locally install mapillary - DO THIS ONLY AFTER RUNNING `make build`
53+
pip3 install -e .
54+
55+
# CODE QUALITY
56+
57+
# # Styling related
58+
style: format lint
59+
60+
# # # Formatting
61+
format:
62+
@ black src/mapillary
63+
64+
# # # Linting
65+
lint:
66+
@ # stop the build if there are Python syntax errors or undefined names
67+
@ flake8 src/mapillary --count --select=E9,F63,F7,F82 --show-source --statistics
68+
69+
@ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
70+
@ flake8 src/mapillary --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
71+
72+
# DOCUMENTATION
73+
74+
# # For generating the latest developer documentation from src/mapillary
75+
# # and serving them locally with Docusaurus
76+
docs-gen: docs-sphinx docs-py docs-start
77+
78+
# # # Sphinx Documentation Generation
79+
docs-sphinx:
80+
sphinx-apidoc -o sphinx-docs ./src/ sphinx-apidoc --full -A 'Mapillary'; cd sphinx-docs; echo "$$PYTHON_SCRIPT" >> conf.py; make markdown;
81+
82+
# # # Python Script for moving markdown from sphinx -> docusaurus
83+
docs-py:
84+
python3 scripts/documentation.py
85+
86+
# # # Serve the newly generated documentation
87+
docs-start:
88+
cd docs; npm run start;
89+
90+
# # For pushing the docs to the gh-pages branch
91+
docs-push: docs-build docs-deploy
92+
93+
# # # Building the static pages
94+
docs-build:
95+
# Building the documentation
96+
cd docs; npm run build;
97+
98+
# # # Deploying the documentation to gh-pages
99+
docs-deploy:
100+
# Deploying the documentation
101+
# Deploying requires GIT_USER's password and write access to the repository
102+
# If normal password authentication is used, deployment fails
103+
# remote: Support for password authentication was removed on August 13, 2021.
104+
# Please use a personal access token instead. See here for more information
105+
# https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
106+
cd docs; GIT_USER=Rubix982 yarn deploy;
107+
108+
# CLEANING
109+
110+
# # Removing temporary created artifacts
111+
clean: sphinx-docs-clean docs-clean build-clean
112+
113+
# # # Remove Sphinx Documentation
114+
sphinx-docs-clean:
115+
rm -rf sphinx-docs/
116+
117+
# # # Remove latest build of docs
118+
docs-clean:
119+
rm -rf docs/build
120+
121+
# # # Remove latest sr/mapillary build
122+
build-clean:
123+
rm -rf build/ dist/
124+
125+
# TESTING
126+
127+
# # Execute pytest on tests/
6128
test:
7129
@ pytest --log-cli-level=20

Pipfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ pycodestyle = "==2.7.0"
6868
pyflakes = "==2.3.1"
6969
regex = "==2021.4.4"
7070
toml = "==0.10.2"
71-
twine = "*"
72-
check-manifest = "*"
71+
twine = "==1.13.0"
72+
check-manifest = "==0.46"
73+
sphinx = "==4.1.2"
74+
sphinx-markdown-builder = "==0.5.4"
75+
sphinx-autodoc-typehints = "==1.12.0"
7376

7477
[requires]
7578
python_version = "3.8"

0 commit comments

Comments
 (0)