From 312844570a4f51a7cf689fcbaedede4541e2709c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 31 Jul 2024 12:25:56 +0200 Subject: [PATCH 1/5] fix: remove pip setup() deprecated message --- .pre-commit-config.yaml | 47 +++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 9 ++++++++ requirements.txt | 1 - 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml delete mode 100644 requirements.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6fa575a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,47 @@ +exclude: 'node_modules|.git' +default_stages: [commit] +fail_fast: false + + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: trailing-whitespace + files: "red_background.*" + exclude: ".*json$|.*txt$|.*csv|.*md" + - id: check-yaml + - id: no-commit-to-branch + args: ['--branch', 'develop'] + - id: check-merge-conflict + - id: check-ast + - id: check-json + - id: check-toml + - id: check-yaml + - id: debug-statements + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.7.1 + hooks: + - id: prettier + types_or: [javascript, vue, scss] + + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v8.44.0 + hooks: + - id: eslint + types_or: [javascript] + args: [ '--quiet' ] + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.2.0 + hooks: + - id: ruff + name: "Run ruff import sorter" + args: ["--select=I", "--fix"] + + - id: ruff + name: "Run ruff linter" + + - id: ruff-format + name: "Run ruff formatter" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f783b50 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,9 @@ +[project] +name = "red_background" +authors = [ + { name = "ALYF GmbH", email = "hallo@alyf.de"} +] +description = "Red background to distinguish test systems from prod" +requires-python = ">=3.10" +readme = "README.md" +dynamic = ["version"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7668191..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -# frappe -- https://github.com/frappe/frappe is installed via 'bench init' \ No newline at end of file From 725ac3ca516e5421d3e65ede01b906232fe76b0d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 31 Jul 2024 12:34:19 +0200 Subject: [PATCH 2/5] chore: set pyproject.toml, .pre-commit-config.yaml, hook.py from new application boilerplate --- pyproject.toml | 11 +++ red_background/config/desktop.py | 12 --- red_background/config/docs.py | 11 --- red_background/hooks.py | 127 +++++++++++++++++++++---------- setup.py | 19 ----- 5 files changed, 99 insertions(+), 81 deletions(-) delete mode 100644 red_background/config/desktop.py delete mode 100644 red_background/config/docs.py delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index f783b50..8922110 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,3 +7,14 @@ description = "Red background to distinguish test systems from prod" requires-python = ">=3.10" readme = "README.md" dynamic = ["version"] +dependencies = [ + # "frappe~=15.0.0" # Installed and managed by bench. +] + +[build-system] +requires = ["flit_core >=3.4,<4"] +build-backend = "flit_core.buildapi" + +# These dependencies are only installed when developer mode is enabled +[tool.bench.dev-dependencies] +# package_name = "~=1.1.0" diff --git a/red_background/config/desktop.py b/red_background/config/desktop.py deleted file mode 100644 index 7bc0fde..0000000 --- a/red_background/config/desktop.py +++ /dev/null @@ -1,12 +0,0 @@ -from frappe import _ - -def get_data(): - return [ - { - "module_name": "Red Background", - "color": "grey", - "icon": "octicon octicon-file-directory", - "type": "module", - "label": _("Red Background") - } - ] diff --git a/red_background/config/docs.py b/red_background/config/docs.py deleted file mode 100644 index cdf3d6b..0000000 --- a/red_background/config/docs.py +++ /dev/null @@ -1,11 +0,0 @@ -""" -Configuration for docs -""" - -# source_link = "https://github.com/[org_name]/red_background" -# docs_base_url = "https://[org_name].github.io/red_background" -# headline = "App that does everything" -# sub_heading = "Yes, you got that right the first time, everything" - -def get_context(context): - context.brand_html = "Red Background" diff --git a/red_background/hooks.py b/red_background/hooks.py index f40b123..684b96c 100644 --- a/red_background/hooks.py +++ b/red_background/hooks.py @@ -1,5 +1,3 @@ -from . import __version__ as app_version - app_name = "red_background" app_title = "Red Background" app_publisher = "ALYF GmbH" @@ -8,20 +6,21 @@ app_color = "grey" app_email = "hallo@alyf.de" app_license = "MIT" +# required_apps = [] # Includes in # ------------------ # include js, css files in header of desk.html app_include_css = "/assets/red_background/css/red_background.css" -# app_include_js = "/assets/red_background/js/red_background.js" +# app_include_js = "/assets/anothertest/js/anothertest.js" # include js, css files in header of web template -# web_include_css = "/assets/red_background/css/red_background.css" -# web_include_js = "/assets/red_background/js/red_background.js" +# web_include_css = "/assets/anothertest/css/anothertest.css" +# web_include_js = "/assets/anothertest/js/anothertest.js" # include custom scss in every website theme (without file extension ".scss") -# website_theme_scss = "red_background/public/scss/website" +# website_theme_scss = "anothertest/public/scss/website" # include js, css files in header of web form # webform_include_js = {"doctype": "public/js/doctype.js"} @@ -36,6 +35,11 @@ # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} # doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"} +# Svg Icons +# ------------------ +# include app icons in desk +# app_include_icons = "anothertest/public/icons.svg" + # Home Pages # ---------- @@ -44,7 +48,7 @@ # website user home page (by Role) # role_home_page = { -# "Role": "home_page" +# "Role": "home_page" # } # Generators @@ -53,34 +57,59 @@ # automatically create page for each record of this doctype # website_generators = ["Web Page"] +# Jinja +# ---------- + +# add methods and filters to jinja environment +# jinja = { +# "methods": "anothertest.utils.jinja_methods", +# "filters": "anothertest.utils.jinja_filters" +# } + # Installation # ------------ -# before_install = "red_background.install.before_install" -# after_install = "red_background.install.after_install" +# before_install = "anothertest.install.before_install" +# after_install = "anothertest.install.after_install" # Uninstallation # ------------ -# before_uninstall = "red_background.uninstall.before_uninstall" -# after_uninstall = "red_background.uninstall.after_uninstall" +# before_uninstall = "anothertest.uninstall.before_uninstall" +# after_uninstall = "anothertest.uninstall.after_uninstall" + +# Integration Setup +# ------------------ +# To set up dependencies/integrations with other apps +# Name of the app being installed is passed as an argument + +# before_app_install = "anothertest.utils.before_app_install" +# after_app_install = "anothertest.utils.after_app_install" + +# Integration Cleanup +# ------------------- +# To clean up dependencies/integrations with other apps +# Name of the app being uninstalled is passed as an argument + +# before_app_uninstall = "anothertest.utils.before_app_uninstall" +# after_app_uninstall = "anothertest.utils.after_app_uninstall" # Desk Notifications # ------------------ # See frappe.core.notifications.get_notification_config -# notification_config = "red_background.notifications.get_notification_config" +# notification_config = "anothertest.notifications.get_notification_config" # Permissions # ----------- # Permissions evaluated in scripted ways # permission_query_conditions = { -# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", +# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", # } # # has_permission = { -# "Event": "frappe.desk.doctype.event.event.has_permission", +# "Event": "frappe.desk.doctype.event.event.has_permission", # } # DocType Class @@ -88,7 +117,7 @@ # Override standard doctype classes # override_doctype_class = { -# "ToDo": "custom_app.overrides.CustomToDo" +# "ToDo": "custom_app.overrides.CustomToDo" # } # Document Events @@ -96,57 +125,71 @@ # Hook on document methods and events # doc_events = { -# "*": { -# "on_update": "method", -# "on_cancel": "method", -# "on_trash": "method" -# } +# "*": { +# "on_update": "method", +# "on_cancel": "method", +# "on_trash": "method" +# } # } # Scheduled Tasks # --------------- # scheduler_events = { -# "all": [ -# "red_background.tasks.all" -# ], -# "daily": [ -# "red_background.tasks.daily" -# ], -# "hourly": [ -# "red_background.tasks.hourly" -# ], -# "weekly": [ -# "red_background.tasks.weekly" -# ] -# "monthly": [ -# "red_background.tasks.monthly" -# ] +# "all": [ +# "anothertest.tasks.all" +# ], +# "daily": [ +# "anothertest.tasks.daily" +# ], +# "hourly": [ +# "anothertest.tasks.hourly" +# ], +# "weekly": [ +# "anothertest.tasks.weekly" +# ], +# "monthly": [ +# "anothertest.tasks.monthly" +# ], # } # Testing # ------- -# before_tests = "red_background.install.before_tests" +# before_tests = "anothertest.install.before_tests" # Overriding Methods # ------------------------------ # # override_whitelisted_methods = { -# "frappe.desk.doctype.event.event.get_events": "red_background.event.get_events" +# "frappe.desk.doctype.event.event.get_events": "anothertest.event.get_events" # } # # each overriding function accepts a `data` argument; # generated from the base implementation of the doctype dashboard, # along with any modifications made in other Frappe apps # override_doctype_dashboards = { -# "Task": "red_background.task.get_dashboard_data" +# "Task": "anothertest.task.get_dashboard_data" # } # exempt linked doctypes from being automatically cancelled # # auto_cancel_exempted_doctypes = ["Auto Repeat"] +# Ignore links to specified DocTypes when deleting documents +# ----------------------------------------------------------- + +# ignore_links_on_delete = ["Communication", "ToDo"] + +# Request Events +# ---------------- +# before_request = ["anothertest.utils.before_request"] +# after_request = ["anothertest.utils.after_request"] + +# Job Events +# ---------- +# before_job = ["anothertest.utils.before_job"] +# after_job = ["anothertest.utils.after_job"] # User Data Protection # -------------------- @@ -176,6 +219,12 @@ # -------------------------------- # auth_hooks = [ -# "red_background.auth.validate" +# "anothertest.auth.validate" # ] +# Automatically update python controller files with type annotations for this app. +# export_python_type_annotations = True + +# default_log_clearing_doctypes = { +# "Logging DocType Name": 30 # days to retain logs +# } diff --git a/setup.py b/setup.py deleted file mode 100644 index cb6b2e5..0000000 --- a/setup.py +++ /dev/null @@ -1,19 +0,0 @@ -from setuptools import setup, find_packages - -with open("requirements.txt") as f: - install_requires = f.read().strip().split("\n") - -# get version from __version__ variable in red_background/__init__.py -from red_background import __version__ as version - -setup( - name="red_background", - version=version, - description="Red background to distinguish test systems from prod", - author="ALYF GmbH", - author_email="hallo@alyf.de", - packages=find_packages(), - zip_safe=False, - include_package_data=True, - install_requires=install_requires -) From 8ff57f314c0d8ac62a8da14b12f707b778df85af Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 31 Jul 2024 12:47:53 +0200 Subject: [PATCH 3/5] chore: review pre-commit-config --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6fa575a..9228622 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ fail_fast: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.3.0 hooks: - id: trailing-whitespace files: "red_background.*" @@ -31,7 +31,7 @@ repos: hooks: - id: eslint types_or: [javascript] - args: [ '--quiet' ] + args: ['--quiet'] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.2.0 From eb1ea20183bdf11c39e89b63a53a48f87d20a93b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 1 Aug 2024 02:12:52 +0200 Subject: [PATCH 4/5] chore: remove dummy app anothertest reference --- red_background/hooks.py | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/red_background/hooks.py b/red_background/hooks.py index 684b96c..4026942 100644 --- a/red_background/hooks.py +++ b/red_background/hooks.py @@ -13,14 +13,14 @@ # include js, css files in header of desk.html app_include_css = "/assets/red_background/css/red_background.css" -# app_include_js = "/assets/anothertest/js/anothertest.js" +# app_include_js = "/assets/red_background/js/red_background.js" # include js, css files in header of web template -# web_include_css = "/assets/anothertest/css/anothertest.css" -# web_include_js = "/assets/anothertest/js/anothertest.js" +# web_include_css = "/assets/red_background/css/red_background.css" +# web_include_js = "/assets/red_background/js/red_background.js" # include custom scss in every website theme (without file extension ".scss") -# website_theme_scss = "anothertest/public/scss/website" +# website_theme_scss = "red_background/public/scss/website" # include js, css files in header of web form # webform_include_js = {"doctype": "public/js/doctype.js"} @@ -38,7 +38,7 @@ # Svg Icons # ------------------ # include app icons in desk -# app_include_icons = "anothertest/public/icons.svg" +# app_include_icons = "red_background/public/icons.svg" # Home Pages # ---------- @@ -62,43 +62,43 @@ # add methods and filters to jinja environment # jinja = { -# "methods": "anothertest.utils.jinja_methods", -# "filters": "anothertest.utils.jinja_filters" +# "methods": "red_background.utils.jinja_methods", +# "filters": "red_background.utils.jinja_filters" # } # Installation # ------------ -# before_install = "anothertest.install.before_install" -# after_install = "anothertest.install.after_install" +# before_install = "red_background.install.before_install" +# after_install = "red_background.install.after_install" # Uninstallation # ------------ -# before_uninstall = "anothertest.uninstall.before_uninstall" -# after_uninstall = "anothertest.uninstall.after_uninstall" +# before_uninstall = "red_background.uninstall.before_uninstall" +# after_uninstall = "red_background.uninstall.after_uninstall" # Integration Setup # ------------------ # To set up dependencies/integrations with other apps # Name of the app being installed is passed as an argument -# before_app_install = "anothertest.utils.before_app_install" -# after_app_install = "anothertest.utils.after_app_install" +# before_app_install = "red_background.utils.before_app_install" +# after_app_install = "red_background.utils.after_app_install" # Integration Cleanup # ------------------- # To clean up dependencies/integrations with other apps # Name of the app being uninstalled is passed as an argument -# before_app_uninstall = "anothertest.utils.before_app_uninstall" -# after_app_uninstall = "anothertest.utils.after_app_uninstall" +# before_app_uninstall = "red_background.utils.before_app_uninstall" +# after_app_uninstall = "red_background.utils.after_app_uninstall" # Desk Notifications # ------------------ # See frappe.core.notifications.get_notification_config -# notification_config = "anothertest.notifications.get_notification_config" +# notification_config = "red_background.notifications.get_notification_config" # Permissions # ----------- @@ -137,39 +137,39 @@ # scheduler_events = { # "all": [ -# "anothertest.tasks.all" +# "red_background.tasks.all" # ], # "daily": [ -# "anothertest.tasks.daily" +# "red_background.tasks.daily" # ], # "hourly": [ -# "anothertest.tasks.hourly" +# "red_background.tasks.hourly" # ], # "weekly": [ -# "anothertest.tasks.weekly" +# "red_background.tasks.weekly" # ], # "monthly": [ -# "anothertest.tasks.monthly" +# "red_background.tasks.monthly" # ], # } # Testing # ------- -# before_tests = "anothertest.install.before_tests" +# before_tests = "red_background.install.before_tests" # Overriding Methods # ------------------------------ # # override_whitelisted_methods = { -# "frappe.desk.doctype.event.event.get_events": "anothertest.event.get_events" +# "frappe.desk.doctype.event.event.get_events": "red_background.event.get_events" # } # # each overriding function accepts a `data` argument; # generated from the base implementation of the doctype dashboard, # along with any modifications made in other Frappe apps # override_doctype_dashboards = { -# "Task": "anothertest.task.get_dashboard_data" +# "Task": "red_background.task.get_dashboard_data" # } # exempt linked doctypes from being automatically cancelled @@ -183,13 +183,13 @@ # Request Events # ---------------- -# before_request = ["anothertest.utils.before_request"] -# after_request = ["anothertest.utils.after_request"] +# before_request = ["red_background.utils.before_request"] +# after_request = ["red_background.utils.after_request"] # Job Events # ---------- -# before_job = ["anothertest.utils.before_job"] -# after_job = ["anothertest.utils.after_job"] +# before_job = ["red_background.utils.before_job"] +# after_job = ["red_background.utils.after_job"] # User Data Protection # -------------------- @@ -219,7 +219,7 @@ # -------------------------------- # auth_hooks = [ -# "anothertest.auth.validate" +# "red_background.auth.validate" # ] # Automatically update python controller files with type annotations for this app. From c37468cb7fcd41aa35d8d96357945d5bb0da0e0c Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:41:41 +0200 Subject: [PATCH 5/5] chore: bump version to 15.0.0 --- red_background/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/red_background/__init__.py b/red_background/__init__.py index 7a0660b..d5793af 100644 --- a/red_background/__init__.py +++ b/red_background/__init__.py @@ -1,3 +1 @@ - -__version__ = '0.0.1' - +__version__ = "15.0.0"