Skip to content
Snippets Groups Projects
Commit e35c3dc4 authored by harisankar95's avatar harisankar95
Browse files

Changed sphinx theme to rtd

parent cfcbf7a2
No related branches found
No related tags found
No related merge requests found
# Define the common variables for the pipeline
variables:
PYTHON_IMAGE: python:3.8.10
PIPENV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pipenv"
REPO_NAME: hariivi/sample-project # Replace with your repository name on Docker Hub
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# Cache the pipenv, make it faster to install dependencies next time
cache:
key: build-cache
paths:
- .cache/pipenv
- venv/
stages:
- pre-deploy
- tests
- deploy
# Define the defaults for all jobs
default:
image: $PYTHON_IMAGE
before_script: # will be executed before each job
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -e .[dev]
# Define the jobs
linters-formatters:
stage: pre-deploy
tags:
- asprunner
when: always
allow_failure: true
script:
- pylint --fail-under=9 sample_project_ivi
- mypy sample_project_ivi
- isort --check-only --diff sample_project_ivi tests
- black --check --diff sample_project_ivi tests -l 120
pytest:
stage: tests
tags:
- asprunner
when: always
script:
- pytest --cov-report term --cov-config=setup.cfg --cov=model_deploy tests/
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' # regex to match the coverage percentage
pages:
stage: deploy
when: always
tags:
- asprunner
rules:
# only code in main is deployed to pages
- if: '$CI_COMMIT_REF_NAME == "main" || $CI_PIPELINE_SOURCE == "merge_request_event"'
allow_failure: true
script:
- pip install -e .[docs]
- sphinx-build -b html docs/ public
artifacts:
paths:
- public
docker-image:
stage: deploy
# run when there is a release
rules:
- if: "$CI_COMMIT_TAG"
tags:
- asprunner
# docker in docker (dind)
image: docker:18.09
# docker deamon service
services:
- docker:18.09-dind
before_script:
# add sensitive information as secret variables in GitLab
- echo $DOCKER_PASS | docker login -u $DOCKER_ID --password-stdin
- docker info
script:
- docker build -t $REPO_NAME:$CI_COMMIT_TAG --pull --cache-from $REPO_NAME:$CI_COMMIT_TAG .
- docker push $REPO_NAME:$CI_COMMIT_TAG
publish-pypi:
stage: deploy
# run when there is a release
rules:
- if: "$CI_COMMIT_TAG"
tags:
- asprunner
script:
- python -m pip install --upgrade pip
- pip install setuptools wheel twine
- python setup.py sdist bdist_wheel # build the package
- TWINE_PASSWORD=$PYPI_PASS TWINE_USERNAME=$PYPI_USER twine upload dist/* # upload to pypi
# Define the common variables for the pipeline
variables:
PYTHON_IMAGE: python:3.8.10
PIPENV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pipenv"
REPO_NAME: hariivi/sample-project # Replace with your repository name on Docker Hub
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# Cache the pipenv, make it faster to install dependencies next time
cache:
key: build-cache
paths:
- .cache/pipenv
- venv/
stages:
- pre-deploy
- tests
- deploy
# Define the defaults for all jobs
default:
image: $PYTHON_IMAGE
before_script: # will be executed before each job
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -e .[dev]
# Define the jobs
linters-formatters:
stage: pre-deploy
tags:
- asprunner
when: always
allow_failure: true
script:
- pylint --fail-under=9 sample_project_ivi
- mypy sample_project_ivi
- isort --check-only --diff sample_project_ivi tests
- black --check --diff sample_project_ivi tests -l 120
pytest:
stage: tests
tags:
- asprunner
when: always
script:
- pytest --cov-report term --cov-config=setup.cfg --cov=sample_project_ivi tests/
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' # regex to match the coverage percentage
pages:
stage: deploy
when: always
tags:
- asprunner
rules:
# only code in main is deployed to pages
- if: '$CI_COMMIT_REF_NAME == "main" || $CI_PIPELINE_SOURCE == "merge_request_event"'
allow_failure: true
script:
- pip install -e .[docs]
- sphinx-build -b html docs/ public
artifacts:
paths:
- public
docker-image:
stage: deploy
# run when there is a release
rules:
- if: "$CI_COMMIT_TAG"
tags:
- asprunner
# docker in docker (dind)
image: docker:18.09
# docker deamon service
services:
- docker:18.09-dind
before_script:
# add sensitive information as secret variables in GitLab
- echo $DOCKER_PASS | docker login -u $DOCKER_ID --password-stdin
- docker info
script:
- docker build -t $REPO_NAME:$CI_COMMIT_TAG --pull --cache-from $REPO_NAME:$CI_COMMIT_TAG .
- docker push $REPO_NAME:$CI_COMMIT_TAG
publish-pypi:
stage: deploy
# run when there is a release
rules:
- if: "$CI_COMMIT_TAG"
tags:
- asprunner
script:
- python -m pip install --upgrade pip
- pip install setuptools wheel twine
- python setup.py sdist bdist_wheel # build the package
- TWINE_PASSWORD=$PYPI_PASS TWINE_USERNAME=$PYPI_USER twine upload dist/* # upload to pypi
......@@ -32,6 +32,7 @@ extensions = [
"sphinx_copybutton", # for copy button
"sphinx-prompt", # for prompt
"recommonmark", # for markdown
"sphinx_rtd_theme", # for read the docs theme
]
# source suffix
......@@ -49,7 +50,7 @@ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = "alabaster"
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
# autodoc
......
import os
from setuptools import find_packages, setup
# read the version from version.txt
with open(os.path.join("sample_project_ivi", "version.txt"), encoding="utf-8") as file_handler:
__version__ = file_handler.read().strip()
setup(
name="sample_project_ivi",
version=__version__,
description="A sample project to demonstrate packaging and testing.",
author="Harisankar Babu",
author_email="harisankar.babu@ivi.fraunhofer.de",
keywords=["python"],
license="MIT",
url="https://gitlab.cc-asp.fraunhofer.de/babu/python-template/",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Researchers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
],
packages=[package for package in find_packages() if package.startswith("sample_project_ivi")],
# by default find packages will only include python files, so we need to manually add the version.txt file
package_data={"sample_project_ivi": ["version.txt"]},
install_requires=[
# tada! no external dependencies
],
extras_require={
"dev": [
"pytest",
"pytest-cov",
"coverage",
"pylint",
"mypy",
"isort",
"black",
"tox>=4.5.0",
],
"docs": [
"sphinx",
"sphinx-autodoc-typehints",
"sphinx-copybutton",
"sphinx-prompt",
"recommonmark",
],
},
python_requires=">=3.8",
platforms="any",
)
import os
from setuptools import find_packages, setup
# read the version from version.txt
with open(os.path.join("sample_project_ivi", "version.txt"), encoding="utf-8") as file_handler:
__version__ = file_handler.read().strip()
setup(
name="sample_project_ivi",
version=__version__,
description="A sample project to demonstrate packaging and testing.",
author="Harisankar Babu",
author_email="harisankar.babu@ivi.fraunhofer.de",
keywords=["python"],
license="MIT",
url="https://gitlab.cc-asp.fraunhofer.de/babu/python-template/",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Researchers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
],
packages=[package for package in find_packages() if package.startswith("sample_project_ivi")],
# by default find packages will only include python files, so we need to manually add the version.txt file
package_data={"sample_project_ivi": ["version.txt"]},
install_requires=[
# tada! no external dependencies
],
extras_require={
"dev": [
"pytest",
"pytest-cov",
"coverage",
"pylint",
"mypy",
"isort",
"black",
"tox>=4.5.0",
],
"docs": [
"sphinx",
"sphinx-autodoc-typehints",
"sphinx-copybutton",
"sphinx-prompt",
"recommonmark",
"sphinx_rtd_theme",
],
},
python_requires=">=3.8",
platforms="any",
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment