Skip to content

Commit df23aec

Browse files
committed
Project setup, python and django basics
1 parent b1ca84a commit df23aec

28 files changed

Lines changed: 1745 additions & 172 deletions

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.12"
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install ruff mypy django-stubs django
24+
25+
- name: Ruff check
26+
run: ruff check .
27+
28+
- name: Ruff format check
29+
run: ruff format --check .
30+
31+
- name: Type check
32+
run: mypy src/paradedb
33+
34+
test:
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
python-version: ["3.12", "3.13"]
39+
django-version: ["5.0", "5.1"]
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Set up Python ${{ matrix.python-version }}
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install "Django~=${{ matrix.django-version }}.0"
53+
pip install -e ".[dev]"
54+
55+
# Tests SQL generation only - no database required
56+
- name: Run tests
57+
run: pytest --cov=paradedb --cov-report=xml
58+
59+
- name: Upload coverage
60+
uses: codecov/codecov-action@v4
61+
with:
62+
files: ./coverage.xml
63+
fail_ci_if_error: false
64+
65+
docs:
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Set up Python
71+
uses: actions/setup-python@v5
72+
with:
73+
python-version: "3.12"
74+
75+
- name: Install dependencies
76+
run: |
77+
python -m pip install --upgrade pip
78+
pip install -e ".[docs]"
79+
80+
- name: Build docs
81+
run: mkdocs build --strict

.gitignore

Lines changed: 23 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3-
*.py[codz]
3+
*.py[cod]
44
*$py.class
55

6-
# C extensions
7-
*.so
8-
96
# Distribution / packaging
107
.Python
118
build/
@@ -20,188 +17,42 @@ parts/
2017
sdist/
2118
var/
2219
wheels/
23-
share/python-wheels/
2420
*.egg-info/
2521
.installed.cfg
2622
*.egg
27-
MANIFEST
28-
29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
3423

35-
# Installer logs
36-
pip-log.txt
37-
pip-delete-this-directory.txt
24+
# Virtual environments
25+
.venv/
26+
venv/
27+
ENV/
3828

39-
# Unit test / coverage reports
29+
# Testing
30+
.pytest_cache/
31+
.coverage
4032
htmlcov/
4133
.tox/
4234
.nox/
43-
.coverage
44-
.coverage.*
45-
.cache
46-
nosetests.xml
4735
coverage.xml
4836
*.cover
49-
*.py.cover
50-
.hypothesis/
51-
.pytest_cache/
52-
cover/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
.pybuilder/
76-
target/
77-
78-
# Jupyter Notebook
79-
.ipynb_checkpoints
80-
81-
# IPython
82-
profile_default/
83-
ipython_config.py
84-
85-
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# UV
98-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
#uv.lock
10237

103-
# poetry
104-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105-
# This is especially recommended for binary packages to ensure reproducibility, and is more
106-
# commonly ignored for libraries.
107-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108-
#poetry.lock
109-
#poetry.toml
110-
111-
# pdm
112-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113-
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114-
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115-
#pdm.lock
116-
#pdm.toml
117-
.pdm-python
118-
.pdm-build/
119-
120-
# pixi
121-
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122-
#pixi.lock
123-
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124-
# in the .venv directory. It is recommended not to include this directory in version control.
125-
.pixi
126-
127-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128-
__pypackages__/
129-
130-
# Celery stuff
131-
celerybeat-schedule
132-
celerybeat.pid
133-
134-
# SageMath parsed files
135-
*.sage.py
136-
137-
# Environments
138-
.env
139-
.envrc
140-
.venv
141-
env/
142-
venv/
143-
ENV/
144-
env.bak/
145-
venv.bak/
146-
147-
# Spyder project settings
148-
.spyderproject
149-
.spyproject
150-
151-
# Rope project settings
152-
.ropeproject
153-
154-
# mkdocs documentation
155-
/site
156-
157-
# mypy
38+
# Mypy
15839
.mypy_cache/
159-
.dmypy.json
160-
dmypy.json
161-
162-
# Pyre type checker
163-
.pyre/
164-
165-
# pytype static type analyzer
166-
.pytype/
167-
168-
# Cython debug symbols
169-
cython_debug/
17040

171-
# PyCharm
172-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174-
# and can be added to the global gitignore or merged into this file. For a more nuclear
175-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
176-
#.idea/
177-
178-
# Abstra
179-
# Abstra is an AI-powered process automation framework.
180-
# Ignore directories containing user credentials, local state, and settings.
181-
# Learn more at https://abstra.io/docs
182-
.abstra/
183-
184-
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186-
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188-
# you could uncomment the following to ignore the entire vscode folder
189-
# .vscode/
190-
191-
# Ruff stuff:
41+
# Ruff
19242
.ruff_cache/
19343

194-
# PyPI configuration file
195-
.pypirc
44+
# MkDocs
45+
site/
46+
47+
# IDEs
48+
.idea/
49+
.vscode/
50+
*.swp
51+
*.swo
19652

197-
# Cursor
198-
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199-
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200-
# refer to https://docs.cursor.com/context/ignore-files
201-
.cursorignore
202-
.cursorindexingignore
53+
# OS
54+
.DS_Store
55+
Thumbs.db
20356

204-
# Marimo
205-
marimo/_static/
206-
marimo/_lsp/
207-
__marimo__/
57+
# Snapshots (syrupy)
58+
__snapshots__/

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-toml
9+
- id: check-added-large-files
10+
- id: debug-statements
11+
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.8.4
14+
hooks:
15+
- id: ruff
16+
args: [--fix]
17+
- id: ruff-format
18+
19+
- repo: https://github.com/pre-commit/mirrors-mypy
20+
rev: v1.13.0
21+
hooks:
22+
- id: mypy
23+
additional_dependencies:
24+
- django-stubs>=5.1
25+
- django>=5.0
26+
args: [--config-file=pyproject.toml]

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# django-paradedb
2+
3+
[![CI](https://github.com/paradedb/django-paradedb/actions/workflows/ci.yml/badge.svg)](https://github.com/paradedb/django-paradedb/actions/workflows/ci.yml)
4+
[![PyPI](https://img.shields.io/pypi/v/django-paradedb)](https://pypi.org/project/django-paradedb/)
5+
[![Python](https://img.shields.io/pypi/pyversions/django-paradedb)](https://pypi.org/project/django-paradedb/)
6+
7+
ParadeDB full-text search integration for Django ORM.
8+
9+
## Installation
10+
11+
```bash
12+
pip install django-paradedb
13+
```
14+
15+
## Quick Start
16+
17+
```python
18+
from django.db import models
19+
from paradedb.indexes import BM25Index
20+
from paradedb.search import ParadeDB
21+
22+
class Product(models.Model):
23+
description = models.TextField()
24+
category = models.CharField(max_length=100)
25+
26+
class Meta:
27+
indexes = [
28+
BM25Index(
29+
fields={'id': {}, 'description': {'tokenizer': 'simple'}},
30+
key_field='id',
31+
name='product_search_idx',
32+
),
33+
]
34+
35+
# Search
36+
Product.objects.filter(description=ParadeDB('shoes'))
37+
```
38+
39+
## Documentation
40+
41+
Full documentation: https://paradedb.github.io/django-paradedb
42+
43+
## Development
44+
45+
```bash
46+
# Install dev dependencies
47+
pip install -e ".[dev]"
48+
49+
# Setup pre-commit hooks
50+
pre-commit install
51+
52+
# Run tests
53+
pytest
54+
55+
# Run linting
56+
ruff check .
57+
ruff format .
58+
59+
# Build docs locally
60+
pip install -e ".[docs]"
61+
mkdocs serve
62+
```

0 commit comments

Comments
 (0)