Skip to content

Commit

Permalink
Merge pull request #131 from ambitioninc/develop
Browse files Browse the repository at this point in the history
3.0.1
  • Loading branch information
somewes authored Aug 23, 2022
2 parents 132318d + 59e5621 commit ff10979
Show file tree
Hide file tree
Showing 13 changed files with 223 additions and 75 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# copied from django-cte
name: manager_utils tests
on:
push:
branches: [master]
pull_request:
branches: [master,develop]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9']
# Time to switch to pytest or nose2?
# nosetests is broken on 3.10
# AttributeError: module 'collections' has no attribute 'Callable'
# https://github.com/nose-devs/nose/issues/1099
django:
- 'Django~=2.2.0'
- 'Django~=3.0.0'
- 'Django~=3.1.0'
- 'Django~=3.2.0'
- 'Django~=4.0.0'
- 'Django~=4.1.0'
experimental: [false]
include:
- python: '3.9'
django: 'https://github.com/django/django/archive/refs/heads/main.zip#egg=Django'
experimental: true
# NOTE this job will appear to pass even when it fails because of
# `continue-on-error: true`. Github Actions apparently does not
# have this feature, similar to Travis' allow-failure, yet.
# https://github.com/actions/toolkit/issues/399
exclude:
- python: '3.7'
django: 'Django~=4.0.0'
- python: '3.7'
django: 'Django~=4.1.0'
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Setup
run: |
python --version
pip install --upgrade pip wheel
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-testing.txt
pip install "${{ matrix.django }}"
pip freeze
- name: Run tests
env:
DB_SETTINGS: >-
{
"ENGINE":"django.db.backends.postgresql_psycopg2",
"NAME":"manager_utils",
"USER":"postgres",
"PASSWORD":"postgres",
"HOST":"localhost",
"PORT":"5432"
}
run: |
coverage run manage.py test manager_utils
coverage report --fail-under=100
continue-on-error: ${{ matrix.experimental }}
- name: Check style
run: flake8 manager_utils
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Compiled python files
*.pyc

.tox/

# Vim files
*.swp
*.swo
Expand Down
21 changes: 17 additions & 4 deletions .travis.yml → .travis_old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,37 @@ dist: xenial
language: python
sudo: false

services:
- postgresql

python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"

env:
global:
- PGPORT=5433
- PGUSER=travis
matrix:
- DJANGO=2.2
- DJANGO=3.0
- DJANGO=3.1
- DJANGO=3.2
- DJANGO=4.0
- DJANGO=4.1
- DJANGO=master

addons:
postgresql: '9.6'
postgresql: '13'
apt:
packages:
- postgresql-13
- postgresql-client-13

matrix:
include:
- { python: "3.6", env: TOXENV=flake8 }
- { python: "3.7", env: TOXENV=flake8 }

allow_failures:
- env: DJANGO=master
Expand All @@ -28,7 +41,7 @@ install:
- pip install tox-travis

before_script:
- psql -c 'CREATE DATABASE manager_utils;' -U postgres
- psql -c 'CREATE DATABASE manager_utils;' -U travis

script:
- tox
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include README.rst
include LICENSE
recursive-include requirements *
10 changes: 10 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Release Notes
=============

v3.0.1
------
* Switch to github actions

v3.0.0
------
* Add support for django 3.2, 4.0, 4.1
* Add support for python 3.9
* Drop support for python 3.6

v2.0.4
------
* Only conditionally fetching newly created models to match number of queries prior to 2.0.2
Expand Down
5 changes: 4 additions & 1 deletion manager_utils/manager_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@


# A signal that is emitted when any bulk operation occurs
post_bulk_operation = Signal(providing_args=['model'])
post_bulk_operation = Signal()
"""
providing_args=['model']
"""


def id_dict(queryset):
Expand Down
2 changes: 1 addition & 1 deletion manager_utils/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.4'
__version__ = '3.0.1'
3 changes: 2 additions & 1 deletion requirements/requirements-testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ psycopg2
django-nose>=1.3
django-dynamic-fixture
pytz
django-timezone-field
django-timezone-field==4.0
parameterized
freezegun
flake8
2 changes: 2 additions & 0 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Django>=2.2
django-query-builder>=3.0.1
56 changes: 36 additions & 20 deletions settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import json

from django.conf import settings

Expand All @@ -12,41 +13,56 @@ def configure_settings():
test_db = os.environ.get('DB', None)
if test_db is None:
db_config = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'ambition',
'USER': 'ambition',
'PASSWORD': 'ambition',
'HOST': 'db'
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'ambition_test',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'db',
}
elif test_db == 'postgres':
db_config = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'postgres',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'manager_utils',
}
'USER': 'travis',
'PORT': '5433',
}
# db_config = {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': 'manager_utils',
# 'USER': 'postgres',
# 'PASSWORD': '',
# 'HOST': 'db',
# }
elif test_db == 'sqlite':
db_config = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'manager_utils',
}
}
else:
raise RuntimeError('Unsupported test DB {0}'.format(test_db))

if os.environ.get('DB_SETTINGS'):
db_config = json.loads(os.environ.get('DB_SETTINGS'))

installed_apps = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'manager_utils',
'manager_utils.tests',
]

settings.configure(
TEST_RUNNER='django_nose.NoseTestSuiteRunner',
NOSE_ARGS=['--nocapture', '--nologcapture', '--verbosity=1'],
MIDDLEWARE_CLASSES={},
DATABASES={
'default': db_config,
},
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'manager_utils',
'manager_utils.tests',
),
MIDDLEWARE_CLASSES={},
INSTALLED_APPS=installed_apps,
ROOT_URLCONF='manager_utils.urls',
DEBUG=False,
NOSE_ARGS=['--nocapture', '--nologcapture', '--verbosity=1'],
TEST_RUNNER='django_nose.NoseTestSuiteRunner',
SECRET_KEY='*',
USE_DEPRECATED_PYTZ=True,
)
36 changes: 20 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ def get_version():
raise RuntimeError('Unable to find version string in {0}.'.format(VERSION_FILE))


def get_lines(file_path):
return open(file_path, 'r').read().split('\n')


install_requires = get_lines('requirements/requirements.txt')
tests_require = get_lines('requirements/requirements-testing.txt')


setup(
name='django-manager-utils',
version=get_version(),
Expand All @@ -25,35 +33,31 @@ def get_version():
url='http://github.com/ambitioninc/django-manager-utils/',
author='Wes Kendall',
author_email='[email protected]',
project_urls={
"Bug Tracker": "https://github.com/ambitioninc/django-manager-utils/issues",
"Changes": "https://django-manager-utils.readthedocs.io/en/latest/release_notes.html",
"Documentation": "https://django-manager-utils.readthedocs.io/en/latest/",
"Source Code": "https://github.com/ambitioninc/django-manager-utils",
},
packages=find_packages(),
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
],
install_requires=[
'Django>=2.2',
'django-query-builder>=2.0.0',
],
tests_require=[
'coverage',
'freezegun',
'mock',
'psycopg2',
'django-nose>=1.3',
'django-dynamic-fixture',
'pytz',
'django-timezone-field',
'parameterized',
],
install_requires=install_requires,
tests_require=tests_require,
test_suite='run_tests.run',
include_package_data=True,
)
32 changes: 0 additions & 32 deletions tox.ini

This file was deleted.

Loading

0 comments on commit ff10979

Please sign in to comment.