Skip to content

Commit

Permalink
Merge branch 'develop' into 479-support-django42
Browse files Browse the repository at this point in the history
  • Loading branch information
wongcht authored Aug 27, 2023
2 parents e82d975 + 797101b commit b9617b2
Show file tree
Hide file tree
Showing 25 changed files with 400 additions and 174 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.5.3

- name: Set up Python 3.10
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.6.1
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.5.3

- name: Set up Python 3.10
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.6.1
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.5.3
with:
fetch-depth: 5

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.6.1
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.5.3

# 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.5.3

- name: Set up Python 3.10
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.6.1
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.5.3

- name: Set up Python 3.10
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v4.6.1
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
34 changes: 31 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,37 @@ 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`_ - 00-Unreleased-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
`#419 <https://github.com/joke2k/django-environ/pull/419>`_.

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>`_.

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 +56,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 +368,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>`_
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
10 changes: 6 additions & 4 deletions environ/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from pkgutil import find_loader


if find_loader('simplejson'):
import simplejson as json
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_loader('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 Down
Loading

0 comments on commit b9617b2

Please sign in to comment.