Use the src/ layout to fix packaging Khoj for PyPi

- Why
  The khoj pypi packages should be installed in `khoj' directory.
  Previously it was being installed into `src' directory, which is a
  generic top level directory name that is discouraged from being used

- Changes
 - move src/* to src/khoj/*
 - update `setup.py' to `find_packages' in `src' instead of project root
 - rename imports to form `from khoj.*' in complete project
 - update `constants.web_directory' path to use `khoj' directory
 - rename root logger to `khoj' in `main.py'
 - fix image_search tests to use the newly rename `khoj' logger
 - update config, docs, workflows to reference new path `src/khoj'
This commit is contained in:
Debanjum Singh Solanky
2023-02-14 14:50:51 -06:00
parent cc31cd070d
commit 25a749ca1d
104 changed files with 209 additions and 208 deletions

View File

@@ -28,7 +28,7 @@
;; Khoj Package for Semantic Search
(use-package khoj
:after org
:straight (khoj :type git :host github :repo "debanjum/khoj" :files (:defaults "src/interface/emacs/khoj.el"))
:straight (khoj :type git :host github :repo "debanjum/khoj" :files (:defaults "src/khoj/interface/emacs/khoj.el"))
:bind ("C-c s" . 'khoj))
```
- With [Quelpa](https://github.com/quelpa/quelpa#installation)

View File

@@ -6,8 +6,8 @@
*Allow natural language search on user content like notes, images,
transactions using transformer ML models*
User can interface with Khoj via [Web](./src/interface/web/index.html),
[Emacs](./src/interface/emacs/khoj.el) or the API. All search is done
User can interface with Khoj via [Web](./src/khoj/interface/web/index.html),
[Emacs](./src/khoj/interface/emacs/khoj.el) or the API. All search is done
locally[\*](https://github.com/debanjum/khoj#miscellaneous)
## Demo
@@ -47,8 +47,8 @@ just generating embeddings*
- [Update Index](http://localhost:8000/api/update?t=ledger)
- [Configure Application](https://localhost:8000/ui)
- **Khoj via Emacs**
- [Install](https://github.com/debanjum/khoj/tree/master/src/interface/emacs#installation)
[khoj.el](./src/interface/emacs/khoj.el)
- [Install](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#installation)
[khoj.el](./src/khoj/interface/emacs/khoj.el)
- Run `M-x khoj <user-query>`
## Run Unit tests
@@ -118,7 +118,7 @@ docker-compose build --pull
images, transactions etc specified in config YAML
``` shell
python3 -m src.main -c=config/khoj_sample.yml -vv
python3 -m src.khoj.main -c=config/khoj_sample.yml -vv
```
### Upgrade On Local Machine