Skip to content

Commit 099b778

Browse files
committed
chore: upgrade tooling
1 parent 7f23fc2 commit 099b778

File tree

7 files changed

+67
-142
lines changed

7 files changed

+67
-142
lines changed

DOCKER_README.md

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,7 @@
1-
In this page you will find our recommended way of installing Docker on your machine.
2-
This guide is made for OSX users.
3-
4-
## Install Docker
5-
6-
First install Docker using [Homebrew](https://brew.sh/)
7-
```
8-
$ brew install docker
9-
```
10-
11-
You can then install [Docker Desktop](https://docs.docker.com/get-docker/) if you wish, or use `docker-machine`. As we prefer the second option, we will only document this one.
12-
13-
## Setup your Docker
14-
15-
Install `docker-machine`
16-
```
17-
$ brew install docker-machine
18-
```
19-
20-
Then install [VirtualBox](https://www.virtualbox.org/) with [Homebrew Cask](https://github.com/Homebrew/homebrew-cask) to get a driver for your Docker machine
21-
```
22-
$ brew cask install virtualbox
23-
```
24-
25-
You may need to enter your password and authorize the application in your `System Settings` > `Security & Privacy`.
26-
27-
Create now a new machine, set it up as default and connect your shell to it (here we use zsh. The commands should anyway be displayed in each steps' output)
28-
29-
```
30-
$ docker-machine create --driver virtualbox default
31-
$ docker-machine env default
32-
$ eval "$(docker-machine env default)"
33-
```
34-
35-
Now you're all setup to use our provided Docker image!
36-
371
## Build the image
382

3+
> Make sure to have [Docker installed](https://docs.docker.com/engine/install/)
4+
395
```bash
406
docker build -t algoliasearch-django .
417
```
@@ -53,8 +19,8 @@ docker run -it --rm --env ALGOLIA_APPLICATION_ID=XXXXXX \
5319
However, we advise you to export them. That way, you can use [Docker's shorten syntax](https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file) to set your variables.
5420

5521
```bash
56-
export ALGOLIA_APPLICATION_ID=XXXXXX
57-
export ALGOLIA_API_KEY=XXX
22+
export ALGOLIA_APPLICATION_ID=XXXXXX
23+
export ALGOLIA_API_KEY=XXX
5824

5925
docker run -it --rm --env ALGOLIA_APPLICATION_ID --env ALGOLIA_API_KEY -v $PWD:/code -w /code algoliasearch-django bash
6026
```
@@ -64,8 +30,8 @@ Once your container is running, any changes you make in your IDE are directly re
6430
To launch the tests, you can use this command
6531

6632
```bash
67-
tox -e py36-django31
33+
tox -e py313-django51
6834
```
6935

70-
If you'd like to sue an env other that `py36-django31`, run `tox --listenvs` to see the list of available envs.
36+
If you'd like to sue an env other that `py313-django51`, run `tox --listenvs` to see the list of available envs.
7137
Feel free to contact us if you have any questions.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8-slim
1+
FROM python:3.13-slim
22

33
# Force the stdout and stderr streams to be unbuffered.
44
# Ensure python output goes to your terminal
@@ -7,6 +7,6 @@ ENV PYTHONUNBUFFERED=1
77
WORKDIR /code
88
COPY requirements.txt /code/
99

10-
RUN pip install -r requirements.txt
10+
RUN pip3 install --upgrade pip && pip3 install -r requirements.txt
1111

1212
COPY . /code/

MAINTAINERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
| Name | Email |
44
|-----------------|---------------------|
5-
| Paul-Louis Nech | [email protected] |
5+
| Algolia | [email protected] |

README.md

Lines changed: 39 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
</p>
1313
</p>
1414

15-
1615
<p align="center">
1716
<a href="https://www.algolia.com/doc/framework-integration/django/options/?language=python" target="_blank">Documentation</a> •
1817
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
@@ -26,55 +25,56 @@
2625

2726
You can find the full reference on [Algolia's website](https://www.algolia.com/doc/framework-integration/django/).
2827

29-
30-
3128
1. **[Setup](#setup)**
32-
* [Introduction](#introduction)
33-
* [Install](#install)
34-
* [Setup](#setup)
35-
* [Quick Start](#quick-start)
29+
30+
- [Introduction](#introduction)
31+
- [Install](#install)
32+
- [Setup](#setup)
33+
- [Quick Start](#quick-start)
3634

3735
1. **[Commands](#commands)**
38-
* [Commands](#commands)
36+
37+
- [Commands](#commands)
3938

4039
1. **[Search](#search)**
41-
* [Search](#search)
40+
41+
- [Search](#search)
4242

4343
1. **[Geo-Search](#geo-search)**
44-
* [Geo-Search](#geo-search)
44+
45+
- [Geo-Search](#geo-search)
4546

4647
1. **[Tags](#tags)**
47-
* [Tags](#tags)
48+
49+
- [Tags](#tags)
4850

4951
1. **[Options](#options)**
50-
* [Custom <code>objectID</code>](#custom-codeobjectidcode)
51-
* [Custom index name](#custom-index-name)
52-
* [Field Preprocessing and Related objects](#field-preprocessing-and-related-objects)
53-
* [Index settings](#index-settings)
54-
* [Restrict indexing to a subset of your data](#restrict-indexing-to-a-subset-of-your-data)
55-
* [Multiple indices per model](#multiple-indices-per-model)
56-
* [Temporarily disable the auto-indexing](#temporarily-disable-the-auto-indexing)
5752

58-
1. **[Tests](#tests)**
59-
* [Run Tests](#run-tests)
53+
- [Custom <code>objectID</code>](#custom-codeobjectidcode)
54+
- [Custom index name](#custom-index-name)
55+
- [Field Preprocessing and Related objects](#field-preprocessing-and-related-objects)
56+
- [Index settings](#index-settings)
57+
- [Restrict indexing to a subset of your data](#restrict-indexing-to-a-subset-of-your-data)
58+
- [Multiple indices per model](#multiple-indices-per-model)
59+
- [Temporarily disable the auto-indexing](#temporarily-disable-the-auto-indexing)
6060

61-
1. **[Troubleshooting](#troubleshooting)**
62-
* [Frequently asked questions](#frequently-asked-questions)
61+
1. **[Tests](#tests)**
6362

63+
- [Run Tests](#run-tests)
6464

65+
1. **[Troubleshooting](#troubleshooting)**
66+
- [Frequently asked questions](#frequently-asked-questions)
6567

6668
# Setup
6769

68-
69-
7070
## Introduction
7171

7272
This package lets you easily integrate the Algolia Search API to your [Django](https://www.djangoproject.com/) project. It's based on the [algoliasearch-client-python](https://github.com/algolia/algoliasearch-client-python) package.
7373

7474
You might be interested in this sample Django application providing a typeahead.js based auto-completion and Google-like instant search: [algoliasearch-django-example](https://github.com/algolia/algoliasearch-django-example).
7575

76-
- Compatible with **Python 2.7** and **Python 3.4+**.
77-
- Supports **Django 1.7+**, **2.x** and **3.x**.
76+
- Compatible with **Python 3.8+**.
77+
- Supports **Django 4.x** and **5.x**.
7878

7979
## Install
8080

@@ -95,10 +95,10 @@ ALGOLIA = {
9595

9696
There are several optional settings:
9797

98-
* `INDEX_PREFIX`: prefix all indices. Use it to separate different applications, like `site1_Products` and `site2_Products`.
99-
* `INDEX_SUFFIX`: suffix all indices. Use it to differentiate development and production environments, like `Location_dev` and `Location_prod`.
100-
* `AUTO_INDEXING`: automatically synchronize the models with Algolia (default to **True**).
101-
* `RAISE_EXCEPTIONS`: raise exceptions on network errors instead of logging them (default to **settings.DEBUG**).
98+
- `INDEX_PREFIX`: prefix all indices. Use it to separate different applications, like `site1_Products` and `site2_Products`.
99+
- `INDEX_SUFFIX`: suffix all indices. Use it to differentiate development and production environments, like `Location_dev` and `Location_prod`.
100+
- `AUTO_INDEXING`: automatically synchronize the models with Algolia (default to **True**).
101+
- `RAISE_EXCEPTIONS`: raise exceptions on network errors instead of logging them (default to **settings.DEBUG**).
102102

103103
## Quick Start
104104

@@ -134,25 +134,17 @@ class YourModelIndex(AlgoliaIndex):
134134

135135
```
136136

137-
138-
139137
# Commands
140138

141-
142-
143139
## Commands
144140

145-
* `python manage.py algolia_reindex`: reindex all the registered models. This command will first send all the record to a temporary index and then moves it.
146-
* you can pass ``--model`` parameter to reindex a given model
147-
* `python manage.py algolia_applysettings`: (re)apply the index settings.
148-
* `python manage.py algolia_clearindex`: clear the index
149-
150-
141+
- `python manage.py algolia_reindex`: reindex all the registered models. This command will first send all the record to a temporary index and then moves it.
142+
- you can pass `--model` parameter to reindex a given model
143+
- `python manage.py algolia_applysettings`: (re)apply the index settings.
144+
- `python manage.py algolia_clearindex`: clear the index
151145

152146
# Search
153147

154-
155-
156148
## Search
157149

158150
We recommend using our [InstantSearch.js library](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/) to build your search
@@ -169,12 +161,8 @@ params = { "hitsPerPage": 5 }
169161
response = raw_search(Contact, "jim", params)
170162
```
171163

172-
173-
174164
# Geo-Search
175165

176-
177-
178166
## Geo-Search
179167

180168
Use the `geo_field` attribute to localize your record. `geo_field` should be a callable that returns a tuple (latitude, longitude).
@@ -195,12 +183,8 @@ class ContactIndex(AlgoliaIndex):
195183
algoliasearch.register(Contact, ContactIndex)
196184
```
197185

198-
199-
200186
# Tags
201187

202-
203-
204188
## Tags
205189

206190
Use the `tags` attributes to add tags to your record. It can be a field or a callable.
@@ -212,16 +196,12 @@ class ArticleIndex(AlgoliaIndex):
212196

213197
At query time, specify `{ tagFilters: 'tagvalue' }` or `{ tagFilters: ['tagvalue1', 'tagvalue2'] }` as search parameters to restrict the result set to specific tags.
214198

215-
216-
217199
# Options
218200

219-
220-
221201
## Custom `objectID`
222202

223203
You can choose which field will be used as the `objectID `. The field should be unique and can
224-
be a string or integer. By default, we use the `pk` field of the model.
204+
be a string or integer. By default, we use the `pk` field of the model.
225205

226206
```python
227207
class ArticleIndex(AlgoliaIndex):
@@ -279,8 +259,8 @@ class ContactIndex(AlgoliaIndex):
279259

280260
- With this configuration, you can search for a `Contact` using its `Account` names
281261
- You can use the associated `account_ids` at search-time to fetch more data from your
282-
model (you should **only proxy the fields relevant for search** to keep your records' size
283-
as small as possible)
262+
model (you should **only proxy the fields relevant for search** to keep your records' size
263+
as small as possible)
284264

285265
## Index settings
286266

@@ -400,12 +380,8 @@ with disable_auto_indexing(MyModel):
400380

401381
```
402382

403-
404-
405383
# Tests
406384

407-
408-
409385
## Run Tests
410386

411387
To run the tests, first find your Algolia application id and Admin API key (found on the Credentials page).
@@ -414,8 +390,8 @@ To run the tests, first find your Algolia application id and Admin API key (foun
414390
ALGOLIA_APPLICATION_ID={APPLICATION_ID} ALGOLIA_API_KEY={ADMIN_API_KEY} tox
415391
```
416392

417-
418393
To override settings for some tests, use the [settings method](https://docs.djangoproject.com/en/1.11/topics/testing/tools/#django.test.SimpleTestCase.settings):
394+
419395
```python
420396
class OverrideSettingsTestCase(TestCase):
421397
def setUp(self):
@@ -433,15 +409,12 @@ class OverrideSettingsTestCase(TestCase):
433409
# ...
434410
```
435411

436-
437-
438412
# Troubleshooting
439413

440414
# Use the Dockerfile
415+
441416
If you want to contribute to this project without installing all its dependencies, you can use our Docker image. Please check our [dedicated guide](DOCKER_README.md) to learn more.
442417

443418
## Frequently asked questions
444419

445420
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/framework-integration/django/faq/) where you will find answers for the most common issues and gotchas with the package.
446-
447-

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
django>=1.7
2-
algoliasearch>=3.0,<4.0
1+
django>=4.0
2+
algoliasearch>=4.0,<5.0
33
# dev dependencies
44
pypandoc
55
wheel

setup.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020

2121
path_version = os.path.join(os.path.dirname(__file__),
2222
'algoliasearch_django/version.py')
23-
if sys.version_info[0] == 3:
24-
exec(open(path_version).read())
23+
if sys.version_info < (3, 8):
24+
raise RuntimeError("algoliasearch_django 4.x requires Python 3.8+")
2525
else:
26-
execfile(path_version)
26+
exec(open(path_version).read())
2727

2828

2929
setup(
3030
name='algoliasearch-django',
3131
version=VERSION,
3232
license='MIT License',
3333
packages=find_packages(exclude=['tests']),
34-
install_requires=['django>=1.7', 'algoliasearch>=3.0,<4.0'],
34+
install_requires=['django>=4.0', 'algoliasearch>=4.0,<5.0'],
3535
description='Algolia Search integration for Django',
3636
long_description=README,
3737
long_description_content_type='text/markdown',
@@ -47,8 +47,12 @@
4747
'License :: OSI Approved :: MIT License',
4848
'Operating System :: OS Independent',
4949
'Programming Language :: Python',
50-
'Programming Language :: Python :: 2',
5150
'Programming Language :: Python :: 3',
51+
'Programming Language :: Python :: 3.8',
52+
'Programming Language :: Python :: 3.9',
53+
'Programming Language :: Python :: 3.10',
54+
'Programming Language :: Python :: 3.11',
55+
'Programming Language :: Python :: 3.12',
5256
'Topic :: Internet :: WWW/HTTP',
5357
]
5458
)

0 commit comments

Comments
 (0)