Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use pyproject.toml instead of setup.py #2109

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions helpdesk/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
after_install = "helpdesk.setup.install.after_install"
after_migrate = [
"helpdesk.search.build_index_in_background",
"helpdesk.search.download_corpus",
]

scheduler_events = {
"all": ["helpdesk.search.build_index_if_not_exists"],
"hourly": ["helpdesk.search.download_corpus"],
}


Expand Down
22 changes: 2 additions & 20 deletions helpdesk/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ def create_index(self):
self._index_exists = True

def add_synonyms(self):
for word, synonym in frappe.get_all(
"HD Synonym", ["parent", "name"], as_list=True
):
for word, synonym in frappe.get_all("HD Synonym", ["parent", "name"], as_list=True):
self.redis.ft(self.index_name).synupdate(word, True, word, synonym)

def add_document(self, id, doc):
Expand Down Expand Up @@ -325,9 +323,7 @@ def get_count(self, doctype):
def get_records(self, doctype):
records = []
filters = {"status": "Published"} if doctype == "HD Article" else {}
for d in frappe.db.get_all(
doctype, filters=filters, fields=self.DOCTYPE_FIELDS[doctype]
):
for d in frappe.db.get_all(doctype, filters=filters, fields=self.DOCTYPE_FIELDS[doctype]):
d.doctype = doctype
if doctype == "HD Article":
for heading, section in self.get_sections(d.content):
Expand Down Expand Up @@ -396,17 +392,3 @@ def build_index_if_not_exists():
search = HelpdeskSearch()
if not search.index_exists():
build_index()


@filelock("helpdesk_corpus_download", timeout=60)
def download_corpus():
from nltk import data, download

try:
data.find("taggers/averaged_perceptron_tagger_eng.zip")
data.find("tokenizers/punkt_tab.zip")
data.find("corpora/brown.zip")
except LookupError:
download("averaged_perceptron_tagger_eng")
download("punkt_tab")
download("brown")
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[project]
name = "helpdesk"
authors = [
{ name = "Frappe Technologies Pvt Ltd", email = "[email protected]"}
]
description = "Open Source Customer Service Software"
requires-python = ">=3.10"
readme = "README.md"
dynamic = ["version"]
dependencies = [
# Core dependencies
"textblob==0.18.0.post0",
]

[build-system]
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"

[tool.black]
line-length = 99

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

19 changes: 0 additions & 19 deletions setup.py

This file was deleted.

Loading