Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Dec 19, 2023
2 parents 910e0c0 + b4ec855 commit 8b279dc
Show file tree
Hide file tree
Showing 50 changed files with 345 additions and 336 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.x
- name: Install dependencies
run: pip install sphinx
- name: Build docs
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/flake8.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/publish.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "PyPI releases"

on: release

jobs:
build_sdist:
name: Build Python source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

pypi-publish:
name: Upload release to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs:
- build_sdist
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/django-haystack
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
54 changes: 32 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
name: Test

on: [pull_request, push]
on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
ruff: # https://beta.ruff.rs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install --user ruff
- run: ruff --output-format=github .

test:
runs-on: ubuntu-latest
needs: ruff # Do not run the tests if linting fails.
strategy:
matrix:
django-version: [2.2, 3.1, 3.2]
python-version: [3.6, 3.7, 3.8, 3.9]
elastic-version: [1.7, 2.4, 5.5, '7.13.1']
fail-fast: false
matrix: # https://docs.djangoproject.com/en/4.1/faq/install
django-version: ["3.2", "4.0", "4.1"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
elastic-version: ["1.7", "2.4", "5.5", "7.13.1"]
exclude:
- django-version: "4.0"
python-version: "3.7"
- django-version: "4.1"
python-version: "3.7"
include:
- django-version: '4.0'
python-version: 3.8
elastic-version: 5.5
- django-version: '4.0'
python-version: 3.8
elastic-version: '7.13.1'
- django-version: '4.0'
python-version: 3.9
elastic-version: 5.5
- django-version: '4.0'
python-version: 3.9
elastic-version: '7.13.1'
- django-version: "4.1"
python-version: "3.11"
elastic-version: "7.13.1"
services:
elastic:
image: elasticsearch:${{ matrix.elastic-version }}
Expand All @@ -41,18 +49,20 @@ jobs:
ports:
- 9001:9001
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: sudo apt install --no-install-recommends -y gdal-bin
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install coverage requests
pip install coverage requests tox tox-gh-actions
pip install django==${{ matrix.django-version }} elasticsearch==${{ matrix.elastic-version }}
python setup.py clean build install
- name: Run test
run: coverage run setup.py test
run: tox -v
env:
DJANGO: ${{ matrix.django-version }}
13 changes: 10 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
exclude: ".*/vendor/.*"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
hooks:
- id: ruff
# args: [ --fix, --exit-non-zero-on-fix ]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.1.0
rev: 23.12.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ["--maxkb=128"]
Expand All @@ -21,6 +27,7 @@ repos:
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
Expand Down
12 changes: 12 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.12"

sphinx:
configuration: docs/conf.py
12 changes: 11 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,19 @@ Requirements

Haystack has a relatively easily-met set of requirements.

* Python 3.6+
* A supported version of Python: https://devguide.python.org/versions/#supported-versions
* A supported version of Django: https://www.djangoproject.com/download/#supported-versions

Additionally, each backend has its own requirements. You should refer to
https://django-haystack.readthedocs.io/en/latest/installing_search_engines.html for more
details.

Experimental support for Django v5.0
====================================

The current release on PyPI_ does not yet support Django v5.0.

.. _PyPI: https://pypi.org/project/django-haystack/

To run on Django v5.0, please install by using:
``pip install git+https://github.com/django-haystack/django-haystack.git``
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ Other
Add python 3.5 to tests
- Add python 3.5 to tests. [Marco Badan]

ref: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django
ref: https://docs.djangoproject.com/en/stable/faq/install/#what-python-version-can-i-use-with-django
- SearchQuerySet: don’t trigger backend access in __repr__ [Chris Adams]

This can lead to confusing errors or performance issues by
Expand Down
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import os
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ If you've been granted the commit bit, here's how to shepherd the changes in:

* ``git merge --squash`` is a good tool for performing this, as is
``git rebase -i HEAD~N``.
* This is done to prevent anyone using the git repo from accidently pulling
* This is done to prevent anyone using the git repo from accidentally pulling
work-in-progress commits.

* Commit messages should use past tense, describe what changed & thank anyone
Expand Down
2 changes: 1 addition & 1 deletion docs/python3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Virtually all tests pass under both Python 2 & 3, with a small number of
expected failures under Python (typically related to ordering, see below).

.. _`six`: http://pythonhosted.org/six/
.. _`Django`: https://docs.djangoproject.com/en/1.5/topics/python3/#str-and-unicode-methods
.. _`Django`: https://docs.djangoproject.com/en/stable/topics/python3/#str-and-unicode-methods


Supported Backends
Expand Down
16 changes: 6 additions & 10 deletions docs/running_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,13 @@ the errors persist.
To run just a portion of the tests you can use the script ``run_tests.py`` and
just specify the files or directories you wish to run, for example::

cd test_haystack
./run_tests.py whoosh_tests test_loading.py
python test_haystack/run_tests.py whoosh_tests test_loading.py

The ``run_tests.py`` script is just a tiny wrapper around the nose_ library and
any options you pass to it will be passed on; including ``--help`` to get a
list of possible options::
The ``run_tests.py`` script is just a tiny wrapper around the Django test
command and any options you pass to it will be passed on; including ``--help``
to get a list of possible options::

cd test_haystack
./run_tests.py --help

.. _nose: https://nose.readthedocs.io/en/latest/
python test_haystack/run_tests.py --help

Configuring Solr
================
Expand Down Expand Up @@ -67,4 +63,4 @@ If you want to run the geo-django tests you may need to review the
cd test_haystack
./run_tests.py elasticsearch_tests

.. _GeoDjango GEOS and GDAL settings: https://docs.djangoproject.com/en/1.7/ref/contrib/gis/install/geolibs/#geos-library-path
.. _GeoDjango GEOS and GDAL settings: https://docs.djangoproject.com/en/stable/ref/contrib/gis/install/geolibs/#geos-library-path
2 changes: 1 addition & 1 deletion docs/searchindex_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ non-existent), merely an example of how to extend existing fields.

.. note::

This method is analagous to Django's ``Field.clean`` methods.
This method is analogous to Django's ``Field.clean`` methods.


Adding New Fields
Expand Down
14 changes: 9 additions & 5 deletions docs/spatial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ close to GeoDjango_ as possible. There are some differences, which we'll
highlight throughout this guide. Additionally, while the support isn't as
comprehensive as PostGIS (for example), it is still quite useful.

.. _GeoDjango: https://docs.djangoproject.com/en/1.11/ref/contrib/gis/
.. _GeoDjango: https://docs.djangoproject.com/en/stable/ref/contrib/gis/


Additional Requirements
Expand Down Expand Up @@ -261,7 +261,8 @@ calculations on your part.
Examples::

from haystack.query import SearchQuerySet
from django.contrib.gis.geos import Point, D
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D

ninth_and_mass = Point(-95.23592948913574, 38.96753407043678)
# Within a two miles.
Expand Down Expand Up @@ -304,7 +305,8 @@ include these calculated distances on results.
Examples::

from haystack.query import SearchQuerySet
from django.contrib.gis.geos import Point, D
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D

ninth_and_mass = Point(-95.23592948913574, 38.96753407043678)

Expand All @@ -322,7 +324,8 @@ key, well-cached hotspots in town but want distances from the user's current
position::

from haystack.query import SearchQuerySet
from django.contrib.gis.geos import Point, D
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D

ninth_and_mass = Point(-95.23592948913574, 38.96753407043678)
user_loc = Point(-95.23455619812012, 38.97240128290697)
Expand Down Expand Up @@ -363,7 +366,8 @@ distance information on the results & nothing to sort by.
Examples::

from haystack.query import SearchQuerySet
from django.contrib.gis.geos import Point, D
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D

ninth_and_mass = Point(-95.23592948913574, 38.96753407043678)
downtown_bottom_left = Point(-95.23947, 38.9637903)
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ note-taking application. Here is ``myapp/models.py``::
title = models.CharField(max_length=200)
body = models.TextField()

def __unicode__(self):
def __str__(self):
return self.title

Finally, before starting with Haystack, you will want to choose a search
Expand Down
Loading

0 comments on commit 8b279dc

Please sign in to comment.