Skip to content

Commit

Permalink
Merge pull request #464 from Koed00/django_3_1
Browse files Browse the repository at this point in the history
Updates to Django 3.1
  • Loading branch information
Koed00 committed Aug 6, 2020
2 parents c1a627b + 3dff552 commit 07d0a8c
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 87 deletions.
Empty file added .env
Empty file.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -9,8 +9,8 @@ python:
- "3.8"

env:
- DJANGO=3.0.8
- DJANGO=2.2.14
- DJANGO=3.1
- DJANGO=2.2.15

sudo: true
dist: xenial
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -31,7 +31,7 @@ Requirements
- `Arrow <https://github.com/crsmithdev/arrow>`__
- `Blessed <https://github.com/jquast/blessed>`__

Tested with: Python 3.7, 3.8 Django 2.2.X and 3.0.X
Tested with: Python 3.7, 3.8 Django 2.2.X and 3.1.X

.. warning:: Since Python 3.7 `async` became a reserved keyword and was refactored to `async_task`

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Expand Up @@ -24,7 +24,7 @@ Features
- Rollbar and Sentry support


Django Q is tested with: Python 3.7 and 3.8, Django 2.2.x and 3.0.x
Django Q is tested with: Python 3.7 and 3.8, Django 2.2.x and 3.1.x


Contents:
Expand Down
4 changes: 2 additions & 2 deletions docs/install.rst
Expand Up @@ -32,7 +32,7 @@ Django Q is tested for Python 3.7 and 3.8
- `Django <https://www.djangoproject.com>`__

Django Q aims to use as much of Django's standard offerings as possible
The code is tested against Django versions `2.2.x` and `3.0.x`.
The code is tested against Django versions `2.2.x` and `3.1.x`.
Please note that Django versions below 2.0 do not support Python 3.7

- `Django-picklefield <https://github.com/gintas/django-picklefield>`__
Expand Down Expand Up @@ -152,7 +152,7 @@ You can reference the `requirements <https://github.com/Koed00/django-q/blob/mas
Django
~~~~~~
We strive to be compatible with last two major version of Django.
At the moment this means we support the 2.2.x and 3.0.x releases.
At the moment this means we support the 2.2.x and 3.1.x releases.

Since we are now no longer supporting Python 2, we can also not support older versions of Django that do not support Python >= 3.6
For this you can always use older releases, but they are no longer maintained.
Expand Down
29 changes: 29 additions & 0 deletions dq/tasks.py
@@ -0,0 +1,29 @@
import numpy

from django_q.tasks import async_iter, result


# the estimation function
def parzen_estimation(x_samples, point_x, h):
k_n = 0
for row in x_samples:
x_i = (point_x - row[:, numpy.newaxis]) / h
for row in x_i:
if numpy.abs(row) > (1 / 2):
break
else:
k_n += 1
return h, (k_n / len(x_samples)) / (h ** point_x.shape[1])


def parzen_async():
mu_vec = numpy.array([0, 0])
cov_mat = numpy.array([[1, 0], [0, 1]])
sample = numpy.random.multivariate_normal(mu_vec, cov_mat, 10000)
widths = numpy.linspace(1.0, 1.2, 100)
x = numpy.array([[0], [0]])
# async_task them with async_task iterable
args = [(sample, x, w) for w in widths]
result_id = async_iter(parzen_estimation, args, cached=True)
# return the cached result or timeout after 10 seconds
return result(result_id, wait=10000, cached=True)
150 changes: 75 additions & 75 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions requirements.txt
Expand Up @@ -4,17 +4,17 @@
#
# pip-compile requirements.in
#
arrow==0.15.7 # via -r requirements.in
arrow==0.15.8 # via -r requirements.in
asgiref==3.2.10 # via django
blessed==1.17.8 # via -r requirements.in
boto3==1.14.26 # via -r requirements.in
botocore==1.17.26 # via boto3, s3transfer
blessed==1.17.9 # via -r requirements.in
boto3==1.14.36 # via -r requirements.in
botocore==1.17.36 # via boto3, s3transfer
certifi==2020.6.20 # via requests
chardet==3.0.4 # via requests
croniter==0.3.34 # via -r requirements.in
django-picklefield==3.0.1 # via -r requirements.in
django-redis==4.12.1 # via -r requirements.in
django==3.0.8 # via django-picklefield, django-redis
django==3.1 # via django-picklefield, django-redis
docutils==0.15.2 # via botocore
hiredis==1.1.0 # via -r requirements.in
idna==2.10 # via requests
Expand All @@ -23,7 +23,7 @@ iron-mq==0.9 # via -r requirements.in
jmespath==0.10.0 # via boto3, botocore
natsort==7.0.1 # via croniter
psutil==5.7.2 # via -r requirements.in
pymongo==3.10.1 # via -r requirements.in
pymongo==3.11.0 # via -r requirements.in
python-dateutil==2.8.1 # via arrow, botocore, croniter, iron-core
pytz==2020.1 # via django
redis==3.5.3 # via -r requirements.in, django-redis
Expand Down

0 comments on commit 07d0a8c

Please sign in to comment.