From 0972f301e73afadba969be0068732c67327b2c6a Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Tue, 23 Jun 2020 15:01:43 +0200 Subject: [PATCH 01/10] feat(techdocs-core): Adds skeleton of techdocs-core defaults --- plugins/techdocs/mkdocs/README.md | 2 +- plugins/techdocs/mkdocs/container/Dockerfile | 3 + .../mkdocs/container/techdocs-core/.gitignore | 117 ++++++++++++++++++ .../container/techdocs-core/requirements.txt | 1 + .../mkdocs/container/techdocs-core/setup.py | 33 +++++ .../container/techdocs-core/src/__init__.py | 0 .../container/techdocs-core/src/core.py | 19 +++ plugins/techdocs/mkdocs/mock-docs/.gitignore | 1 + plugins/techdocs/mkdocs/mock-docs/mkdocs.yml | 3 + 9 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 plugins/techdocs/mkdocs/container/techdocs-core/.gitignore create mode 100644 plugins/techdocs/mkdocs/container/techdocs-core/requirements.txt create mode 100644 plugins/techdocs/mkdocs/container/techdocs-core/setup.py create mode 100644 plugins/techdocs/mkdocs/container/techdocs-core/src/__init__.py create mode 100644 plugins/techdocs/mkdocs/container/techdocs-core/src/core.py create mode 100644 plugins/techdocs/mkdocs/mock-docs/.gitignore diff --git a/plugins/techdocs/mkdocs/README.md b/plugins/techdocs/mkdocs/README.md index 5126548f54..4d1c11d7b0 100644 --- a/plugins/techdocs/mkdocs/README.md +++ b/plugins/techdocs/mkdocs/README.md @@ -9,5 +9,5 @@ Welcome to MkDocs. This is the TechDocs implementation of MkDocs. ``` docker build ./container -t mkdocs-container - docker run -w /content -v $(pwd)/mock-docs:/content -p 8000:8000 -it mkdocs-container serve -a 0.0.0.0:8000 --theme material + docker run -w /content -v $(pwd)/mock-docs:/content -p 8000:8000 -it mkdocs-container serve -a 0.0.0.0:8000 ``` diff --git a/plugins/techdocs/mkdocs/container/Dockerfile b/plugins/techdocs/mkdocs/container/Dockerfile index 89ca705095..4256fe79cb 100644 --- a/plugins/techdocs/mkdocs/container/Dockerfile +++ b/plugins/techdocs/mkdocs/container/Dockerfile @@ -3,5 +3,8 @@ FROM python:3.7.7-alpine3.12 RUN apk update && apk --no-cache add gcc musl-dev RUN pip install mkdocs==1.1.2 mkdocs-material==5.3.2 +ADD ./techdocs-core /techdocs-core +RUN pip install --no-index /techdocs-core + ENTRYPOINT [ "mkdocs" ] diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/.gitignore b/plugins/techdocs/mkdocs/container/techdocs-core/.gitignore new file mode 100644 index 0000000000..12e6c164f6 --- /dev/null +++ b/plugins/techdocs/mkdocs/container/techdocs-core/.gitignore @@ -0,0 +1,117 @@ +*~ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ \ No newline at end of file diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/requirements.txt b/plugins/techdocs/mkdocs/container/techdocs-core/requirements.txt new file mode 100644 index 0000000000..b3667f94ec --- /dev/null +++ b/plugins/techdocs/mkdocs/container/techdocs-core/requirements.txt @@ -0,0 +1 @@ +mkdocs==1.1.2 diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py new file mode 100644 index 0000000000..2f14918300 --- /dev/null +++ b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py @@ -0,0 +1,33 @@ +from setuptools import setup, find_packages + + +setup( + name='mkdocs-techdocs-core', + version='0.1.0', + description='A Mkdocs package that contains TechDocs defaults', + long_description='', + keywords='mkdocs', + url='https://github.com/spotify/backstage', + author='Spotify', + author_email='foss@spotify.com', + license='Apache-2.0', + python_requires='>=3.7,<3.8', + install_requires=[ + 'mkdocs>=1.1.2' + ], + classifiers=[ + # 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'License :: OSI Approved :: Apache 2.0', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.7' + ], + packages=find_packages(), + entry_points={ + 'mkdocs.plugins': [ + 'techdocs-core = src.core:TechDocsCore' + ] + } +) diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/src/__init__.py b/plugins/techdocs/mkdocs/container/techdocs-core/src/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py new file mode 100644 index 0000000000..7865050674 --- /dev/null +++ b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py @@ -0,0 +1,19 @@ +from mkdocs.plugins import BasePlugin, PluginCollection +from mkdocs.theme import Theme + +from mkdocs.contrib.search import SearchPlugin + +class TechDocsCore(BasePlugin): + def on_config(self, config): + # Theme + config['theme'] = Theme(name="material") + + # Plugins + del config['plugins']['techdocs-core'] + + search_plugin = SearchPlugin() + search_plugin.load_config({}) + config['plugins']['search'] = search_plugin + + return config + diff --git a/plugins/techdocs/mkdocs/mock-docs/.gitignore b/plugins/techdocs/mkdocs/mock-docs/.gitignore new file mode 100644 index 0000000000..ccbfadbd88 --- /dev/null +++ b/plugins/techdocs/mkdocs/mock-docs/.gitignore @@ -0,0 +1 @@ +site/ \ No newline at end of file diff --git a/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml b/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml index c8370ae3ac..2ecc719875 100644 --- a/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml +++ b/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml @@ -2,3 +2,6 @@ site_name: 'mock-docs' nav: - Home: index.md + +plugins: + - techdocs-core \ No newline at end of file From f16673d857f208eb0dded952b6e78d6a4dee0667 Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Tue, 23 Jun 2020 15:06:45 +0200 Subject: [PATCH 02/10] fix(techdocs-core): remove generated .gitignore --- .../mkdocs/container/techdocs-core/.gitignore | 117 ------------------ 1 file changed, 117 deletions(-) delete mode 100644 plugins/techdocs/mkdocs/container/techdocs-core/.gitignore diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/.gitignore b/plugins/techdocs/mkdocs/container/techdocs-core/.gitignore deleted file mode 100644 index 12e6c164f6..0000000000 --- a/plugins/techdocs/mkdocs/container/techdocs-core/.gitignore +++ /dev/null @@ -1,117 +0,0 @@ -*~ - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ \ No newline at end of file From a133bf542a50a8f19922054ecd57dfe14eec03bd Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Tue, 23 Jun 2020 15:07:12 +0200 Subject: [PATCH 03/10] Update setup.py --- plugins/techdocs/mkdocs/container/techdocs-core/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py index 2f14918300..e6ecb79411 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup( name='mkdocs-techdocs-core', - version='0.1.0', + version='0.0.1', description='A Mkdocs package that contains TechDocs defaults', long_description='', keywords='mkdocs', From c19be944b367c55e63289ee89b3b6fdf9e88ca63 Mon Sep 17 00:00:00 2001 From: Emma Indal Date: Tue, 23 Jun 2020 15:15:38 +0200 Subject: [PATCH 04/10] fix(techdocs-core): add license headers --- plugins/techdocs/mkdocs/container/Dockerfile | 15 +++++++++++++++ .../mkdocs/container/techdocs-core/setup.py | 15 +++++++++++++++ .../mkdocs/container/techdocs-core/src/core.py | 16 ++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/plugins/techdocs/mkdocs/container/Dockerfile b/plugins/techdocs/mkdocs/container/Dockerfile index 4256fe79cb..1ae66589b6 100644 --- a/plugins/techdocs/mkdocs/container/Dockerfile +++ b/plugins/techdocs/mkdocs/container/Dockerfile @@ -1,3 +1,18 @@ + +# Copyright 2020 Spotify AB +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM python:3.7.7-alpine3.12 RUN apk update && apk --no-cache add gcc musl-dev diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py index e6ecb79411..73b921c44a 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py @@ -1,3 +1,18 @@ +""" + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +""" from setuptools import setup, find_packages diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py index 7865050674..e42a60d28b 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py @@ -1,3 +1,19 @@ +""" + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +""" + from mkdocs.plugins import BasePlugin, PluginCollection from mkdocs.theme import Theme From 17c342fbbaa684fce49ea440c7b590bdec1495eb Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Tue, 23 Jun 2020 15:21:15 +0200 Subject: [PATCH 05/10] fix(techdocs-core): corrected license --- plugins/techdocs/mkdocs/container/techdocs-core/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py index 73b921c44a..03053a780a 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py @@ -34,7 +34,7 @@ setup( # 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Information Technology', - 'License :: OSI Approved :: Apache 2.0', + 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.7' From 017797454c48290207da0a21ab693fb05b80cd20 Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Tue, 23 Jun 2020 15:22:02 +0200 Subject: [PATCH 06/10] fix(techdocs-core): update email --- plugins/techdocs/mkdocs/container/techdocs-core/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py index 03053a780a..dc92928270 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py @@ -24,7 +24,7 @@ setup( keywords='mkdocs', url='https://github.com/spotify/backstage', author='Spotify', - author_email='foss@spotify.com', + author_email='fossboard@spotify.com', license='Apache-2.0', python_requires='>=3.7,<3.8', install_requires=[ From 219d55a6913042d7f94c8fcf74a1ea6f5c252d51 Mon Sep 17 00:00:00 2001 From: Emma Indal Date: Tue, 23 Jun 2020 15:23:21 +0200 Subject: [PATCH 07/10] fix(techdocs-core): add empty line --- plugins/techdocs/mkdocs/mock-docs/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/mock-docs/.gitignore b/plugins/techdocs/mkdocs/mock-docs/.gitignore index ccbfadbd88..45ddf0ae39 100644 --- a/plugins/techdocs/mkdocs/mock-docs/.gitignore +++ b/plugins/techdocs/mkdocs/mock-docs/.gitignore @@ -1 +1 @@ -site/ \ No newline at end of file +site/ From 27b32140fc154e54a370b10febfe5d235a0610a7 Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Tue, 23 Jun 2020 15:23:25 +0200 Subject: [PATCH 08/10] fix(techdocs-core): correct development status classifier --- plugins/techdocs/mkdocs/container/techdocs-core/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py index dc92928270..84f43968ac 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py @@ -31,7 +31,7 @@ setup( 'mkdocs>=1.1.2' ], classifiers=[ - # 'Development Status :: 4 - Beta', + 'Development Status :: 1 - Planning', 'Intended Audience :: Developers', 'Intended Audience :: Information Technology', 'License :: OSI Approved :: Apache Software License', From ae892ac19d3b16dc5af3c089784adf170a2e46df Mon Sep 17 00:00:00 2001 From: Emma Indal Date: Tue, 23 Jun 2020 15:23:33 +0200 Subject: [PATCH 09/10] fix(techdocs-core): add empty line --- plugins/techdocs/mkdocs/mock-docs/mkdocs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml b/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml index 2ecc719875..b14d82c4de 100644 --- a/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml +++ b/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml @@ -4,4 +4,5 @@ nav: - Home: index.md plugins: - - techdocs-core \ No newline at end of file + - techdocs-core + From ddc7701329e5c36be949ec1106e105e55b28d5f7 Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Tue, 23 Jun 2020 15:26:25 +0200 Subject: [PATCH 10/10] chore(techdocs-core): remove the extremely narrow python version requirement --- plugins/techdocs/mkdocs/container/techdocs-core/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py index 84f43968ac..faa8b8c46e 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/setup.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/setup.py @@ -26,7 +26,7 @@ setup( author='Spotify', author_email='fossboard@spotify.com', license='Apache-2.0', - python_requires='>=3.7,<3.8', + python_requires='>=3.7', install_requires=[ 'mkdocs>=1.1.2' ],