Skip to content

Commit

Permalink
Merge pull request #484
Browse files Browse the repository at this point in the history
Release v0.11.0
  • Loading branch information
joke2k authored Aug 30, 2023
2 parents 8874288 + cbff150 commit 4a21fd1
Show file tree
Hide file tree
Showing 26 changed files with 416 additions and 184 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.6.0

- name: Set up Python 3.10
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.7.0
with:
python-version: '3.10'

Expand Down Expand Up @@ -64,10 +64,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.6.0

- name: Set up Python 3.10
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.7.0
with:
python-version: '3.10'

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,19 @@ jobs:
# versions by django-environ will continue for as long as possible,
# and may be discontinued at any time.
include:
- python: '3.5'
os: ubuntu-20.04
- python: '3.6'
os: ubuntu-20.04
- python: '3.7'
os: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.6.0
with:
fetch-depth: 5

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.7.0
with:
python-version: ${{ matrix.python }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.6.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.6.0

- name: Set up Python 3.10
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.7.0
with:
python-version: '3.10'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.6.0

- name: Set up Python 3.10
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.7.0
with:
python-version: '3.10'

Expand Down
2 changes: 1 addition & 1 deletion BACKERS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Thank you to all our backers!
|ocbackerimage|

.. |ocsponsor0| image:: https://opencollective.com/django-environ/sponsor/0/avatar.svg
:target: https://triplebyte.com/
:target: https://opencollective.com/triplebyte
:alt: Sponsor
.. |ocsponsor1| image:: https://images.opencollective.com/static/images/become_sponsor.svg
:target: https://opencollective.com/django-environ/contribute/sponsors-3474/checkout
Expand Down
38 changes: 35 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,41 @@ All notable changes to this project will be documented in this file.
The format is inspired by `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.

`v0.10.0`_ - 2-March-2023
`v0.11.0`_ - 30-August-2023
-------------------------------
Added
+++++
- Added support for Django 4.2
`#456 <https://github.com/joke2k/django-environ/pull/456>`_.
- Added support for secure Elasticsearch connections
`#463 <https://github.com/joke2k/django-environ/pull/463>`_.
- Added variable expansion
`#468 <https://github.com/joke2k/django-environ/pull/468>`_.
- Added capability to handle comments after #, after quoted values,
like ``KEY= 'part1 # part2' # comment``
`#475 <https://github.com/joke2k/django-environ/pull/475>`_.
- Added support for ``interpolate`` parameter
`#415 <https://github.com/joke2k/django-environ/pull/415>`_.

Changed
+++++++
- Used ``mssql-django`` as engine for SQL Server
`#446 <https://github.com/joke2k/django-environ/pull/446>`_.
- Changed handling bool values, stripping whitespace around value
`#475 <https://github.com/joke2k/django-environ/pull/475>`_.
- Use ``importlib.util.find_spec`` to ``replace pkgutil.find_loader``
`#482 <https://github.com/joke2k/django-environ/pull/482>`_.


Removed
+++++++
- Removed support of Python 3.5.


`v0.10.0`_ - 2-March-2023
-------------------------
Added
+++++
- Use the core redis library by default if running Django >= 4.0
`#356 <https://github.com/joke2k/django-environ/issues/356>`_.
- Value of dict can now contain an equal sign
Expand All @@ -29,7 +60,7 @@ Deprecated
Changed
+++++++
- Used UTF-8 as a encoding when open ``.env`` file.
- Provided access to ```DB_SCHEMES`` through ``cls`` rather than
- Provided access to ``DB_SCHEMES`` through ``cls`` rather than
``Env`` in ``db_url_config``
`#414 <https://github.com/joke2k/django-environ/pull/414>`_.
- Correct CI workflow to use supported Python versions/OS matrix
Expand Down Expand Up @@ -341,7 +372,8 @@ Added
- Initial release.


.. _v0.10.0: https://github.com/joke2k/django-environ/compare/v0.9.0...develop
.. _v0.11.0: https://github.com/joke2k/django-environ/compare/v0.10.0...develop
.. _v0.10.0: https://github.com/joke2k/django-environ/compare/v0.9.0...v0.10.0
.. _v0.9.0: https://github.com/joke2k/django-environ/compare/v0.8.1...v0.9.0
.. _v0.8.1: https://github.com/joke2k/django-environ/compare/v0.8.0...v0.8.1
.. _v0.8.0: https://github.com/joke2k/django-environ/compare/v0.7.0...v0.8.0
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ Resources
---------

* `How to Contribute to Open Source <https://opensource.guide/how-to-contribute/>`_
* `Using Pull Requests <https://help.github.com/articles/about-pull-requests/>`_
* `Writing good commit messages <http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html>`_
* `Using Pull Requests <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests>`_
* `Writing good commit messages <https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html>`_
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ its documentation lives at `Read the Docs <https://django-environ.readthedocs.io
the code on `GitHub <https://github.com/joke2k/django-environ>`_,
and the latest release on `PyPI <https://pypi.org/project/django-environ/>`_.

It’s rigorously tested on Python 3.5+, and officially supports
Django 1.11, 2.2, 3., 3.1, 3.2, 4.0 and 4.1.
It’s rigorously tested on Python 3.6+, and officially supports
Django 1.11, 2.2, 3.0, 3.1, 3.2, 4.0, 4.1 and 4.2.

If you'd like to contribute to ``django-environ`` you're most welcome!

Expand Down
8 changes: 3 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of the django-environ.
#
# Copyright (c) 2021-2022, Serghei Iakovlev <[email protected]>
# Copyright (c) 2021-2023, Serghei Iakovlev <[email protected]>
# Copyright (c) 2013-2021, Daniele Faraglia <[email protected]>
#
# For the full copyright and license information, please view
Expand All @@ -12,12 +12,10 @@

import codecs
import os
import sys
import re

import sys
from datetime import date


PROJECT_DIR = os.path.abspath('..')
sys.path.insert(0, PROJECT_DIR)

Expand Down Expand Up @@ -71,7 +69,7 @@ def find_version(meta_file):
# The suffix of source filenames.
source_suffix = ".rst"

# Allow non-local URIs so we can have images in CHANGELOG etc.
# Allow non-local URIs, so we can have images in CHANGELOG etc.
suppress_warnings = [
"image.nonlocal_uri",
]
Expand Down
22 changes: 22 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ And use it with ``settings.py`` as follows:
:start-after: -code-begin-
:end-before: -overview-

Variables can contain references to another variables: ``$VAR`` or ``${VAR}``.
Referenced variables are searched in the environment and within all definitions
in the ``.env`` file. References are checked for recursion (self-reference).
Exception is thrown if any reference results in infinite loop on any level
of recursion. Variable values are substituted similar to shell parameter
expansion. Example:

.. code-block:: shell
# shell
export POSTGRES_USERNAME='user' POSTGRES_PASSWORD='SECRET'
.. code-block:: shell
# .env
POSTGRES_HOSTNAME='example.com'
POSTGRES_DB='database'
DATABASE_URL="postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOSTNAME}:5432/${POSTGRES_DB}"
The value of ``DATABASE_URL`` variable will become
``postgres://user:[email protected]:5432/database``.

The ``.env`` file should be specific to the environment and not checked into
version control, it is best practice documenting the ``.env`` file with an example.
For example, you can also add ``.env.dist`` with a template of your variables to
Expand Down
4 changes: 2 additions & 2 deletions docs/tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Proxy value
===========

Values that being with a ``$`` may be interpolated. Pass ``interpolate=True`` to
``environ.Env()`` to enable this feature:
``environ.Env()`` to enable this feature (``True`` by default):

.. code-block:: python
Expand All @@ -236,7 +236,7 @@ Values that being with a ``$`` may be interpolated. Pass ``interpolate=True`` to
# BAR=FOO
# PROXY=$BAR
>>> print env.str('PROXY')
>>> print(env.str('PROXY'))
FOO
Expand Down
8 changes: 4 additions & 4 deletions docs/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ For more detailed example see ":ref:`complex_dict_format`".

:py:meth:`~.environ.Env.search_url` supports the following URL schemas:

* Elasticsearch: ``elasticsearch://``
* Elasticsearch2: ``elasticsearch2://``
* Elasticsearch5: ``elasticsearch5://``
* Elasticsearch7: ``elasticsearch7://``
* Elasticsearch: ``elasticsearch://`` (http) or ``elasticsearchs://`` (https)
* Elasticsearch2: ``elasticsearch2://`` (http) or ``elasticsearch2s://`` (https)
* Elasticsearch5: ``elasticsearch5://`` (http) or ``elasticsearch5s://`` (https)
* Elasticsearch7: ``elasticsearch7://`` (http) or ``elasticsearch7s://`` (https)
* Solr: ``solr://``
* Whoosh: ``whoosh://``
* Xapian: ``xapian://``
Expand Down
4 changes: 2 additions & 2 deletions environ/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of the django-environ.
#
# Copyright (c) 2021-2022, Serghei Iakovlev <[email protected]>
# Copyright (c) 2021-2023, Serghei Iakovlev <[email protected]>
# Copyright (c) 2013-2021, Daniele Faraglia <[email protected]>
#
# For the full copyright and license information, please view
Expand All @@ -21,7 +21,7 @@
__copyright__ = 'Copyright (C) 2013-2022 Daniele Faraglia'
"""The copyright notice of the package."""

__version__ = '0.10.0'
__version__ = '0.11.0'
"""The version of the package."""

__license__ = 'MIT'
Expand Down
18 changes: 10 additions & 8 deletions environ/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@

"""This module handles import compatibility issues."""

from pkgutil import find_loader
from importlib.util import find_spec


if find_loader('simplejson'):
if find_spec('simplejson'):
import simplejson as json
else:
import json

if find_loader('django'):
if find_spec('django'):
from django import VERSION as DJANGO_VERSION
from django.core.exceptions import ImproperlyConfigured
else:
Expand All @@ -28,14 +27,17 @@ class ImproperlyConfigured(Exception):

def choose_rediscache_driver():
"""Backward compatibility for RedisCache driver."""

# django-redis library takes precedence
if find_spec('django_redis'):
return 'django_redis.cache.RedisCache'

# use built-in support if Django 4+
if DJANGO_VERSION is not None and DJANGO_VERSION >= (4, 0):
return 'django.core.cache.backends.redis.RedisCache'

# back compatibility with redis_cache package
if find_loader('redis_cache'):
return 'redis_cache.RedisCache'
return 'django_redis.cache.RedisCache'
return 'redis_cache.RedisCache'


def choose_postgres_driver():
Expand All @@ -49,7 +51,7 @@ def choose_postgres_driver():
def choose_pymemcache_driver():
"""Backward compatibility for pymemcache."""
old_django = DJANGO_VERSION is not None and DJANGO_VERSION < (3, 2)
if old_django or not find_loader('pymemcache'):
if old_django or not find_spec('pymemcache'):
# The original backend choice for the 'pymemcache' scheme is
# unfortunately 'pylibmc'.
return 'django.core.cache.backends.memcached.PyLibMCCache'
Expand Down
Loading

0 comments on commit 4a21fd1

Please sign in to comment.