Skip to content
Snippets Groups Projects
Commit 7d891d51 authored by Frank Duncan's avatar Frank Duncan
Browse files

Preparing for release

parent 0e1821bc
No related branches found
No related tags found
No related merge requests found
# Releasing
When releasing a new version, a few things need to happen:
* run black (python formatter) on the python files
* `$ black **/*.py`
* Update the variable in both the server and client, in
* `__version__` in [django-torque-semantic-search/semantic_search/version.py]
* `$EDITOR django-torque-semantic-search/semantic_search/version.py`
* commit the version update
* tag the release in git
* push to origin
* release the client to pypi (see [the official pypi documentation](https://packaging.python.org/en/latest/tutorials/packaging-projects/) for more information):
* This requires a pypi login as well as access to the django-torque-semantic-search project
* Run `python3 -m build` from inside the `django-torque-semantic-search`
* Upload it to the normal pypi `python3 -m twine upload dist/*` from `django-torque-semantic-search`
dist dist
*.egg-info/ *.egg-info/
__pycache__
This diff is collapsed.
...@@ -48,10 +48,14 @@ def rebuild_semantic_search_index(sender, **kwargs): ...@@ -48,10 +48,14 @@ def rebuild_semantic_search_index(sender, **kwargs):
with transaction.atomic(): with transaction.atomic():
semantic_sc_documents = [] semantic_sc_documents = []
for scd in torque_models.SearchCacheDocument.objects.filter(wiki_config=wiki_config): for scd in torque_models.SearchCacheDocument.objects.filter(
document_dict = orjson.loads(torque_models.DocumentDictCache.objects.get( wiki_config=wiki_config
document=scd.document, wiki_config=wiki_config ):
).dictionary)["fields"] document_dict = orjson.loads(
torque_models.DocumentDictCache.objects.get(
document=scd.document, wiki_config=wiki_config
).dictionary
)["fields"]
semantic_summary = build_semantic_summary(document_dict, scd.filtered_data) semantic_summary = build_semantic_summary(document_dict, scd.filtered_data)
embeddings = llm.get_embeddings(semantic_summary) embeddings = llm.get_embeddings(semantic_summary)
...@@ -67,7 +71,6 @@ def rebuild_semantic_search_index(sender, **kwargs): ...@@ -67,7 +71,6 @@ def rebuild_semantic_search_index(sender, **kwargs):
SemanticSearchCacheDocument.objects.bulk_create(semantic_sc_documents) SemanticSearchCacheDocument.objects.bulk_create(semantic_sc_documents)
@receiver(search_filter) @receiver(search_filter)
def semantic_filter(sender, **kwargs): def semantic_filter(sender, **kwargs):
similarity = getattr(settings, "SEMANTIC_SEARCH_SIMILARITY", 0.7) similarity = getattr(settings, "SEMANTIC_SEARCH_SIMILARITY", 0.7)
......
from django.conf import settings from django.conf import settings
def build_semantic_summary(document_dict, filtered_data): def build_semantic_summary(document_dict, filtered_data):
embedding_data = {} embedding_data = {}
...@@ -17,4 +18,4 @@ def build_semantic_summary(document_dict, filtered_data): ...@@ -17,4 +18,4 @@ def build_semantic_summary(document_dict, filtered_data):
elif value: elif value:
data_text += f"{name} is {value}. " data_text += f"{name} is {value}. "
return data_text return data_text
\ No newline at end of file
__version__ = "0.1.0"
...@@ -2,12 +2,18 @@ ...@@ -2,12 +2,18 @@
from distutils.core import setup from distutils.core import setup
# We read version from here to make it easier to read for outside scripts
# (like release scripts)
main_ns = {}
with open("torque/version.py") as ver_file:
exec(ver_file.read(), main_ns)
with open("README.md", "r", encoding="utf-8") as readme: with open("README.md", "r", encoding="utf-8") as readme:
long_description = readme.read() long_description = readme.read()
setup( setup(
name="django-torque-semantic-search", name="django-torque-semantic-search",
version="0.1.0", version=main_ns["__version__"],
description="django app for torque semantic search", description="django app for torque semantic search",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
...@@ -29,6 +35,5 @@ setup( ...@@ -29,6 +35,5 @@ setup(
"orjson", "orjson",
], ],
package_dir={"": "."}, package_dir={"": "."},
python_requres=">=3.11", python_requires=">=3.11",
) )
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