11# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
22
33define PYTHON_SCRIPT
4+
45import os
56import sys
7+
68sys.path.insert(0, os.path.abspath('../'))
79
8- def skip(app, what, name, obj,would_skip, options):
9- if name in ( '__init__',):
10- return False
11- return would_skip
1210
13- def setup(app):
14- app.connect('autodoc-skip-member', skip)
15- extensions.append('sphinx_autodoc_typehints')
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)
1625endef
1726
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
1858style : format lint
1959
60+ # # # Formatting
2061format :
21- black src/mapillary
62+ @ black src/mapillary
2263
64+ # # # Linting
2365lint :
24- # stop the build if there are Python syntax errors or undefined names
25- flake8 src/mapillary --count --select=E9,F63,F7,F82 --show-source --statistics
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
2673
27- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
28- flake8 src/mapillary --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
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
2977
30- sphinx-docs :
78+ # # # Sphinx Documentation Generation
79+ docs-sphinx :
3180 sphinx-apidoc -o sphinx-docs ./src/ sphinx-apidoc --full -A ' Mapillary' ; cd sphinx-docs; echo " $$ PYTHON_SCRIPT" >> conf.py; make markdown;
3281
33- sphinx-docs-clean :
34- rm -rf sphinx-docs/
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;
3589
36- docs : docs-build docs-deploy
90+ # # For pushing the docs to the gh-pages branch
91+ docs-push : docs-build docs-deploy
3792
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
3899docs-deploy :
39100 # Deploying the documentation
40101 # Deploying requires GIT_USER's password and write access to the repository
@@ -44,14 +105,25 @@ docs-deploy:
44105 # https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
45106 cd docs; GIT_USER=Rubix982 yarn deploy;
46107
47- docs-build :
48- # Building the documentation
49- cd docs; npm run build;
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/
50116
117+ # # # Remove latest build of docs
51118docs-clean :
52119 rm -rf docs/build
53120
121+ # # # Remove latest sr/mapillary build
122+ build-clean :
123+ rm -rf build/ dist/
124+
125+ # TESTING
126+
127+ # # Execute pytest on tests/
54128test :
55129 @ pytest --log-cli-level=20
56-
57- clean : sphinx-docs-clean docs-clean
0 commit comments