Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python Template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Harisankar Babu
Python Template
Commits
e35c3dc4
Commit
e35c3dc4
authored
1 year ago
by
harisankar95
Browse files
Options
Downloads
Patches
Plain Diff
Changed sphinx theme to rtd
parent
cfcbf7a2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+110
-110
110 additions, 110 deletions
.gitlab-ci.yml
docs/conf.py
+2
-1
2 additions, 1 deletion
docs/conf.py
setup.py
+55
-54
55 additions, 54 deletions
setup.py
with
167 additions
and
165 deletions
.gitlab-ci.yml
+
110
−
110
View file @
e35c3dc4
# 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
This diff is collapsed.
Click to expand it.
docs/conf.py
+
2
−
1
View file @
e35c3dc4
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
55
−
54
View file @
e35c3dc4
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
"
,
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment