From 1765f7f7177c99631fc5ec56cfe13e4f15a53072 Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Thu, 22 May 2025 07:11:52 +0000 Subject: [PATCH 01/10] feat: Add .gitlab-ci.yml --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..cc951da --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,5 @@ +# Copyright (C) Pipin Fitriadi - All Rights Reserved + +# Unauthorized copying of this file, via any medium is strictly prohibited +# Proprietary and confidential +# Written by Pipin Fitriadi , 22 May 2025 \ No newline at end of file From e26eac37d8e66dc6783c272036452c42adc4ec52 Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Thu, 22 May 2025 07:12:31 +0000 Subject: [PATCH 02/10] fix: .gitlab-ci.yml Add newline at the end of file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc951da..cbca7e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,4 +2,4 @@ # Unauthorized copying of this file, via any medium is strictly prohibited # Proprietary and confidential -# Written by Pipin Fitriadi , 22 May 2025 \ No newline at end of file +# Written by Pipin Fitriadi , 22 May 2025 From 55b044f088f7638014a6c88cd77e2b275a8d22d9 Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Sat, 29 Nov 2025 23:38:27 +0000 Subject: [PATCH 03/10] fix: Use pyproject.toml instead requirements*.txt for depedencies --- .gitignore | 1 - README.md | 9 +++++++++ pyproject.toml | 26 ++++++++++++++++++++++++++ requirements.code-coverage.txt | 9 --------- requirements.code-quality.txt | 10 ---------- 5 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.code-coverage.txt delete mode 100644 requirements.code-quality.txt diff --git a/.gitignore b/.gitignore index 3ad4ddb..251236e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,4 @@ build/ code-coverage.xml !.oh-my-posh/**/* -!requirements*.txt !template.env diff --git a/README.md b/README.md index 8b18d79..da2fe71 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,22 @@ Proprietary and confidential Written by Pipin Fitriadi , 22 May 2025 --> + # Python [![License](https://img.shields.io/badge/license-Proprietary-red)](LICENSE) [![PyPI - Python Version](https://img.shields.io/badge/python-3.13.1-blue)](https://www.python.org/downloads/release/python-3131/) +- [Setup](#setup) + This repository serves as a centralized Python's workspace, providing structure and resources to support development activities. It may include configuration files, environment setup, shared utilities and documentation that help maintain consistency and streamline workflows across projects or teams. + +## Setup + +Follow these steps the first time you use VS Code after cloning this git repository: + +1. Change `name` value in [pyproject.toml](pyproject.toml) to your project name diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5093af3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,26 @@ +# Copyright (C) Pipin Fitriadi - All Rights Reserved + +# Unauthorized copying of this file, via any medium is strictly prohibited +# Proprietary and confidential +# Written by Pipin Fitriadi , 30 November 2025 + +[build-system] +requires = ['setuptools>=61.0', 'setuptools-git-versioning<2'] +build-backend = 'setuptools.build_meta' + +[project] +name = 'template' +dynamic = ['version'] + +[project.optional-dependencies] +code-coverage = [ + 'coverage', + 'pytest', + 'toml', +] +code-quality = [ + 'flake8-bandit', + 'flake8-black', + 'flake8-bugbear', + 'flake8-isort', +] diff --git a/requirements.code-coverage.txt b/requirements.code-coverage.txt deleted file mode 100644 index 476b1fa..0000000 --- a/requirements.code-coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) Pipin Fitriadi - All Rights Reserved - -# Unauthorized copying of this file, via any medium is strictly prohibited -# Proprietary and confidential -# Written by Pipin Fitriadi , 24 July 2025 - -coverage -pytest -toml diff --git a/requirements.code-quality.txt b/requirements.code-quality.txt deleted file mode 100644 index 275aa34..0000000 --- a/requirements.code-quality.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (C) Pipin Fitriadi - All Rights Reserved - -# Unauthorized copying of this file, via any medium is strictly prohibited -# Proprietary and confidential -# Written by Pipin Fitriadi , 24 July 2025 - -flake8-bandit -flake8-black -flake8-bugbear -flake8-isort From 1b2fb6447912d96d5e90b34ec847bf45365891d4 Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Sun, 30 Nov 2025 00:21:35 +0000 Subject: [PATCH 04/10] fix: .gitlab-ci Implement Code Quality, Code Coverage, and PyPI release --- .gitlab-ci.yml | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbca7e5..3ed757f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,3 +3,66 @@ # Unauthorized copying of this file, via any medium is strictly prohibited # Proprietary and confidential # Written by Pipin Fitriadi , 22 May 2025 + +stages: [Test, Release] +.pip-variables: + variables: + PIP_ROOT_USER_ACTION: ignore + PIP_DISABLE_PIP_VERSION_CHECK: 1 +.python-paths: &python-paths + - tests/**/* + - pyproject.toml +.pypi-rule: &pypi-rule + if: $CI_COMMIT_TAG =~ /(?i)\A(?:v?(?:([0-9]+)!)?([0-9]+(?:\.[0-9]+)*)([-_.]?((a|b|c|rc|alpha|beta|pre|preview))[-_.]?([0-9]+)?)?((?:-([0-9]+))|(?:[-_.]?(post|rev|r)[-_.]?([0-9]+)?))?([-_.]?(dev)[-_.]?([0-9]+)?)?(?:\+([a-z0-9]+(?:[-_.][a-z0-9]+)*))?)\z/ + exists: *python-paths +default: + tags: + - gitlab-runner-docker +Code Quality: + stage: Test + extends: .pip-variables + rules: + - changes: ['**/*.py'] + image: pipelinecomponents/flake8 + before_script: + - pip install --editable ".[code-quality]" + script: + - flake8 +Code Coverage: + stage: Test + extends: .pip-variables + rules: + - if: | + $CI_COMMIT_BRANCH == 'main' || + $CI_COMMIT_BRANCH =~ /^hotfix\/.*/ || + $CI_COMMIT_BRANCH =~ /^release\/.*/ + changes: *python-paths + - <<: *pypi-rule + image: python:3.13-slim-bookworm + before_script: + - pip install --editable ".[code-coverage]" + script: + - coverage run -m pytest -rfEP -q --junit-xml=code-coverage.xml + - coverage report -m + coverage: /TOTAL.*\s+(\d+%)/ + artifacts: + when: always + reports: + junit: code-coverage.xml +PyPI: + stage: Release + needs: [Code Quality, Code Coverage] + extends: .pip-variables + rules: + - <<: *pypi-rule + image: python:3.13-slim-bookworm + variables: + TWINE_USERNAME: gitlab-ci-token + TWINE_PASSWORD: $CI_JOB_TOKEN + before_script: + - apt-get update + - apt-get install -y git + - pip install build twine + script: + - python -m build + - twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* From d09885a85922194e09a002667e05a387b4d4f292 Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Tue, 2 Dec 2025 04:51:08 +0000 Subject: [PATCH 05/10] fix: gitlab-ci.yml Code Quality job change fro flake8 to python 3.9 slim for solving error installing process --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ed757f..c019985 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ Code Quality: extends: .pip-variables rules: - changes: ['**/*.py'] - image: pipelinecomponents/flake8 + image: python:3.9-slim-bookworm before_script: - pip install --editable ".[code-quality]" script: From f216fdfe7983519cd22a240319ae7f64845ed43f Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Mon, 29 Dec 2025 22:55:25 +0000 Subject: [PATCH 06/10] fix: pyproject.toml Change optional-depedencies into dependency-groups https://packaging.python.org/en/latest/specifications/dependency-groups/ --- pyproject.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 58d867b..73e73ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ['version'] -[project.optional-dependencies] +[dependency-groups] code-coverage = [ 'coverage', 'pytest', @@ -41,6 +41,10 @@ code-quality = [ 'flake8-bugbear', 'flake8-isort', ] +dev = [ + {include-group = "code-coverage"}, + {include-group = "code-quality"}, +] [tool.setuptools-git-versioning] enabled = true From 12b1f6859c9c1f661ff0220295c84b2a78a0c215 Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Fri, 2 Jan 2026 07:02:43 +0000 Subject: [PATCH 07/10] fix: Version image docker for gitlab ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b03144..544b0ec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ Code Quality: extends: .pip-variables rules: - changes: ['**/*.py'] - image: python:3.9-slim-bookworm + image: python:3.13-slim-bookworm before_script: - pip install --editable . --group code-quality script: From 34925b459fc2270761e67a8a1e4fde416508658a Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Fri, 2 Jan 2026 07:07:36 +0000 Subject: [PATCH 08/10] fix: remove --editable from pip install gitlab ci --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 544b0ec..35e70e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ Code Quality: - changes: ['**/*.py'] image: python:3.13-slim-bookworm before_script: - - pip install --editable . --group code-quality + - pip install . --group code-quality script: - flake8 Code Coverage: @@ -40,7 +40,7 @@ Code Coverage: - <<: *pypi-rule image: python:3.13-slim-bookworm before_script: - - pip install --editable . --group code-coverage + - pip install . --group code-coverage script: - coverage run -m pytest -rfEP -q --junit-xml=code-coverage.xml - coverage report -m From 227c69138fc744879ee66353710febd3d9a8b633 Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Wed, 14 Jan 2026 05:07:51 +0000 Subject: [PATCH 09/10] Revert "fix: remove --editable from pip install gitlab ci" This reverts commit 34925b459fc2270761e67a8a1e4fde416508658a. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35e70e3..544b0ec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ Code Quality: - changes: ['**/*.py'] image: python:3.13-slim-bookworm before_script: - - pip install . --group code-quality + - pip install --editable . --group code-quality script: - flake8 Code Coverage: @@ -40,7 +40,7 @@ Code Coverage: - <<: *pypi-rule image: python:3.13-slim-bookworm before_script: - - pip install . --group code-coverage + - pip install --editable . --group code-coverage script: - coverage run -m pytest -rfEP -q --junit-xml=code-coverage.xml - coverage report -m From 96f2cb5310cce04a7108d9bb329e3e0b1d05a909 Mon Sep 17 00:00:00 2001 From: pipinfitriadi Date: Wed, 28 Jan 2026 18:46:18 +0000 Subject: [PATCH 10/10] fix: Drop isort ruff no longer needit --- .isort.cfg | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .isort.cfg diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index dad017b..0000000 --- a/.isort.cfg +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (C) Pipin Fitriadi - All Rights Reserved - -# Unauthorized copying of this file, via any medium is strictly prohibited -# Proprietary and confidential -# Written by Pipin Fitriadi , 24 July 2025 - -[settings] -include_trailing_comma=True -multi_line_output=3 -profile=black