Skip to content
Open

0.29 #60

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
Binary file modified .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Changelog

## 0.28 - 2023-11-02

- Performance improvements
- Change default theme to light one

## 0.27.1 - 2023-10-21

- Fixing things that were broken for glorious Linux-People.



## 0.27 - 2023-10-13

- Add better support to solarized theme
Expand Down
5,734 changes: 886 additions & 4,848 deletions poetry.lock

Large diffs are not rendered by default.

65 changes: 12 additions & 53 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[tool.poetry]
name = "python-search"
version = "0.27.1"

version = "0.30.0"
description = "Build your knowledge database in python and retrieve it efficiently"
authors = ["Jean Carlo Machado <machado.c.jean@gmail.com>"]

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
python = ">=3.10,<=3.13"
fire = "^0.4.0"
pydantic = "^1.9.1"
PyYAML = "^6.0"
Expand All @@ -15,36 +14,19 @@ colorama = "^0.4.5"
certifi = ">=2022.6.1"
dill = "^0.3.5.1"
fastapi = { version = "^0.79.0", optional = true }
kafka-python = { version = "^2.0.2", optional = true }
scipy = { version = ">=1.8.1", optional = true }
xgboost = { version = "^1.6.1", optional = true }
matplotlib = { version = "^3.5.2", optional = true }
pandas = { version = "^1.4.3", optional = true }
redis = { version = "^4.3.4", optional = true }
uvicorn = { version = "^0.18.2", optional = true }
# needs to be pinned down due to bug
numpy = { version = "==1.24.2", optional = true }
msgpack-numpy = { version = ">=0.4.8", optional = true }
pyspark = { version = ">=3.0", optional = true}
mlflow = { version=">=1.29.0,<1.30.0", optional = true }
numpy = { version = ">=1.24.3", optional = true }
mlflow-skinny = { version=">=1.29.0,<1.30.0", optional = true }
pdoc3 = {version = "^0.10.0", optional = true}
keras = {version = ">=2.10", optional = true}
# tensorflow cannot be installed in mac m1 chips
tensorflow = {version = ">=2.10.0", optional = true, platform = 'linux'}
arize = { version = "^5.2.0", optional = true }
jupyterlab = { version = "^3.5.0", optional = true }
streamlit = {version = "^1.14.1", optional = true, python = "3.10"}
pyroscope-io = "^0.8.0"
tensorflow-macos = {version = "^2.11.0", optional = true, platform = "mac"}
openai = {version=">=0.27.0", optional = true}
openai = {version=">=0.27.0"}
python-dateutil = "^2.8.2"
chardet = "^5.1.0"
jupyter = {version = "^1.0.0", optional = true}
sentence-transformers = {version = "^2.2.2", optional = true}
accelerate = "^0.22.0"
colorful = "^0.5.5"


[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
pre-commit = "^2.20.0"
Expand All @@ -57,17 +39,14 @@ streamlit = "^1.22.0"
matplotlib = "^3.7.1"


[tool.poetry.group.ml.dependencies]
torch = "^2.0.1"
transformers = "^4.29.2"
sentencepiece = "^0.1.99"
pyspark = "^3.4.0"
sentence-transformers = "^2.2.2"
cloud-tpu-client = "^0.10"
torch-xla = "^1.0"
[tool.setuptools.packages.find]
where = ["."] # list of folders that contain the packages (["."] by default)
include = ["python_search"] # package names should match these glob patterns (["*"] by default)
exclude = [] # exclude packages matching these glob patterns (empty by default)
namespaces = false # to disable scanning PEP 420 namespaces (true by default)

[build-system]
requires = ["poetry-core>=1.0.0"]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
Expand Down Expand Up @@ -95,7 +74,7 @@ prompt_editor = 'python_search.apps.prompt_editor:main'
entry_embeddings = 'python_search.next_item_predictor.features.entry_embeddings:main'
entries_editor = 'python_search.entry_capture.entries_editor:main'
register_new_launch_ui = 'python_search.entry_capture.entry_inserter_gui.register_new_gui:launch_ui'
share_entry = 'python_search.share:main'
share_entry = 'python_search.share_entry:main'
offline_evaluation = 'python_search.next_item_predictor.offline_evaluation:main'
ps_fzf = 'python_search.search_ui.fzf:main'
error_panel = 'python_search.error.error_pane:main'
Expand All @@ -109,23 +88,3 @@ llm_rank = 'python_search.ps_llm.t5.inference:main'
llm_cli = 'python_search.ps_llm.llm_cli:main'
ps_bundle = 'bundle:main'

[tool.poetry.extras]
full = [
"torch",
"pyspark",
"mlflow",
"tensorflow",
"uvicorn",
"kafka-python",
"redis",
"pandas",
"numpy",
"scipy",
"xgboost",
"matplotlib",
"msgpack-numpy",
"jupyterlab",
"scikit-learn",
'sentence_transformers',
'streamlit',
]
16 changes: 16 additions & 0 deletions python_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,19 @@

os.environ["NUMEXPR_MAX_THREADS"] = "10"
os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0"

os.environ['DD_SERVICE'] = 'python-search'
os.environ['DD_ENV'] = 'local'
os.environ['DD_LOGS_INJECTION'] = 'true'
os.environ['DD_PROFILING_ENABLED'] = 'true'
#os.environ['DD_TRACE_DEBUG'] = 'true'

#from ddtrace.profiling import Profiler
#import sys
#prof = Profiler(
# env="local", # if not specified, falls back to environment variable DD_ENV
# service="python_search", # if not specified, falls back to environment variable DD_SERVICE
# version=str(sys.argv[0]), # if not specified, falls back to environment variable DD_VERSION
# tags={'entrypoint': sys.argv[0]},
#)
#prof.start()
1 change: 0 additions & 1 deletion python_search/apps/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def get_content(self, source="--primary") -> str:
import subprocess

result = subprocess.getoutput(cmd)

result = chomp(result)

return result
Expand Down
8 changes: 2 additions & 6 deletions python_search/apps/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,9 @@ def wrap_cmd_into_terminal(
return final_cmd

def get_background_color(self):
if self.configuration.get_fzf_theme() == "light":
return " -o background=#ffffff "

if self.configuration.get_fzf_theme() in ["dracula", "dark"]:
return " -o background=#282a36 -o foreground=#ffffff "

if self.configuration.get_fzf_theme() in ["solarized"]:
return " -o background=#002b36 -o foreground=#ffffff "

return " "
theme = self.configuration.get_theme_object()
return f" -o background={theme.background} -o foreground={theme.foreground} "
22 changes: 16 additions & 6 deletions python_search/configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from python_search.entries_group import EntriesGroup
from python_search.features import PythonSearchFeaturesSupport
from python_search.theme import TimeBasedThemeSelector
from python_search.search_ui.theme import Theme
from python_search.ps_llm.llm_config import CustomLLMConfig

class PythonSearchConfiguration(EntriesGroup):
Expand Down Expand Up @@ -36,8 +36,8 @@ def __init__(
tags_dependent_inserter_marks: Optional[dict[str, Tuple[str, str]]] = None,
default_text_editor: Optional[str] = None,
fzf_theme: Literal[
"light", "dark", "dracula", "default", "automatic"
] = "automatic",
"light", 'solarized'
] = "light",
custom_window_size: Optional[Tuple[int, int]] = None,
use_webservice=False,
rerank_via_model=None,
Expand Down Expand Up @@ -79,8 +79,6 @@ def __init__(
self._default_text_editor = default_text_editor
self._fzf_theme = (
fzf_theme
if fzf_theme != "automatic"
else TimeBasedThemeSelector().get_theme()
)
if custom_window_size:
self._custom_window_size = custom_window_size
Expand All @@ -90,6 +88,7 @@ def __init__(
self.entry_generation = entry_generation
self.privacy_sensitive_terms = privacy_sensitive_terms
self.custom_llm_config = custom_llm_config
self._theme = Theme()

def get_next_item_predictor_model(self):
"""
Expand Down Expand Up @@ -135,9 +134,20 @@ def is_rerank_via_model_enabled(self):
def get_default_tags(self):
return self._default_tags

def get_fzf_theme(self):
def get_fzf_theme(self) -> str:
return self._fzf_theme

def get_theme_object(self):
from python_search.search_ui.theme import Theme
self._theme.inclusivity()
if self._fzf_theme == "solarized":
self._theme.solarized()

return self._theme




def get_window_size(self):
if hasattr(self, "_custom_window_size"):
return self._custom_window_size
7 changes: 2 additions & 5 deletions python_search/configuration/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ def load_config(self) -> PythonSearchConfiguration:

if folder not in sys.path:
sys.path.insert(0, folder)
import copy
from entries_main import config

return copy.deepcopy(config)
return config

def reload(self):
"""
Expand All @@ -42,11 +41,9 @@ def reload(self):

importlib.reload(entries_main)

import copy

import entries_main

return copy.deepcopy(entries_main.config)
return entries_main.config

def get_entries_project_root(self):
"""
Expand Down
3 changes: 1 addition & 2 deletions python_search/entry_capture/entries_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from python_search.core_entities.core_entities import Key
from python_search.search_ui.kitty import get_kitty_cmd


class EntriesEditor:
"""
Open an ide to edit the entries
Expand Down Expand Up @@ -84,7 +83,7 @@ def _edit_file(self, file_name: str, line: Optional[int] = 30, dry_run=False):
def _get_open_text_editor_command(self, file, line):
if self.configuration.get_text_editor() == "vim":
return f"{self.configuration.get_text_editor()} {file} +{line}'"
elif self.configuration.get_text_editor() == "docker_nvim":
elif self.configuration.get_text_editor() == "myvim":
return f"{self.configuration.get_text_editor()} {file} --line={line}'"
else:
# if is not a known editor just open the file
Expand Down
Loading