Skip to content

Commit

Permalink
Merge branch 'master' into fix-importlib-deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
edschofield committed Feb 21, 2024
2 parents dbd3cd0 + cd717be commit 925039a
Show file tree
Hide file tree
Showing 56 changed files with 960 additions and 426 deletions.
13 changes: 13 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security Policy

## Supported Versions

Security updates are applied only to the latest release.

## Reporting a Vulnerability

If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.

Please disclose it at [security advisory](https://github.com/PythonCharmers/python-future/security/advisories/new).

This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
pull_request:
push:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
strategy:
fail-fast: false
matrix:
versions:
- python: "2.6"
- python: "2.7"
- python: "3.3"
- python: "3.4"
- python: "3.5"
- python: "3.6"
- python: "3.7"
- python: "3.8"
- python: "3.9"

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- if: ${{ matrix.versions.python != '2.6' }}
run: |
docker build \
. \
--build-arg PYTHON_VERSION=${{ matrix.versions.python }} \
-t jmadler/python-future-builder:${{ matrix.versions.python }}
- if: ${{ matrix.versions.python == '2.6' }}
run: |
docker build \
. \
-f 2.6.Dockerfile \
-t jmadler/python-future-builder:${{ matrix.versions.python }}
- run: |
docker run \
-e PYTHON_VERSION=${{ matrix.versions.python }} \
jmadler/python-future-builder:${{ matrix.versions.python }} \
/root/python-future/test.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ develop-eggs
.installed.cfg
lib
lib64
MANIFEST
MANIFEST.in

# Backup files
*.bak
Expand Down
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

26 changes: 26 additions & 0 deletions 2.6.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM mrupgrade/deadsnakes:2.6

RUN mkdir -p ~/.pip/ && echo '[global] \n\
trusted-host = pypi.python.org\n\
pypi.org\n\
files.pythonhosted.org\n\
' >> ~/.pip/pip.conf

RUN apt-get update && \
apt-get install -y curl

RUN mkdir -p /root/pip && \
cd /root/pip && \
curl -O https://files.pythonhosted.org/packages/8a/e9/8468cd68b582b06ef554be0b96b59f59779627131aad48f8a5bce4b13450/wheel-0.29.0-py2.py3-none-any.whl && \
curl -O https://files.pythonhosted.org/packages/31/77/3781f65cafe55480b56914def99022a5d2965a4bb269655c89ef2f1de3cd/importlib-1.0.4.zip && \
curl -O https://files.pythonhosted.org/packages/ef/41/d8a61f1b2ba308e96b36106e95024977e30129355fd12087f23e4b9852a1/pytest-3.2.5-py2.py3-none-any.whl && \
curl -O https://files.pythonhosted.org/packages/f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl && \
curl -O https://files.pythonhosted.org/packages/72/20/7f0f433060a962200b7272b8c12ba90ef5b903e218174301d0abfd523813/unittest2-1.1.0-py2.py3-none-any.whl && \
curl -O https://files.pythonhosted.org/packages/53/67/9620edf7803ab867b175e4fd23c7b8bd8eba11cb761514dcd2e726ef07da/py-1.4.34-py2.py3-none-any.whl && \
curl -O https://files.pythonhosted.org/packages/53/25/ef88e8e45db141faa9598fbf7ad0062df8f50f881a36ed6a0073e1572126/ordereddict-1.1.tar.gz && \
curl -O https://files.pythonhosted.org/packages/17/0a/6ac05a3723017a967193456a2efa0aa9ac4b51456891af1e2353bb9de21e/traceback2-1.4.0-py2.py3-none-any.whl && \
curl -O https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl && \
curl -O https://files.pythonhosted.org/packages/c7/a3/c5da2a44c85bfbb6eebcfc1dde24933f8704441b98fdde6528f4831757a6/linecache2-1.0.0-py2.py3-none-any.whl

WORKDIR /root/python-future
ADD . /root/python-future
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}-slim

ENV LC_ALL=C.UTF-8

WORKDIR /root/python-future
ADD . /root/python-future
9 changes: 6 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Overview: Easy, clean, reliable Python 2/3 compatibility
========================================================

.. image:: https://github.com/PythonCharmers/python-future/actions/workflows/ci.yml/badge.svg?branch=master
:target: https://github.com/PythonCharmers/python-future/actions/workflows/ci.yml?query=branch%3Amaster

.. image:: https://readthedocs.org/projects/python-future/badge/?version=latest
:target: https://python-future.readthedocs.io/en/latest/?badge=latest

``python-future`` is the missing compatibility layer between Python 2 and
Python 3. It allows you to use a single, clean Python 3.x-compatible
codebase to support both Python 2 and Python 3 with minimal overhead.
Expand All @@ -22,9 +28,6 @@ are `Mezzanine <http://mezzanine.jupo.org/>`_ and `ObsPy
Features
--------

.. image:: https://travis-ci.org/PythonCharmers/python-future.svg?branch=master
:target: https://travis-ci.org/PythonCharmers/python-future

- ``future.builtins`` package (also available as ``builtins`` on Py2) provides
backports and remappings for 20 builtins with different semantics on Py3
versus Py2
Expand Down
8 changes: 3 additions & 5 deletions TESTING.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
Currently the tests are passing on OS X and Linux on Python 2.7 and 3.4.
A docker image, python-future-builder, is used to do testing and building. The test suite can be run with:

The test suite can be run with:

$ tox
$ bash build.sh

which tests the module under a number of different python versions, where available, or with:

$ py.test

To execute a single test:

$ pytest -k test_chained_exceptions_stacktrace
$ pytest -k test_chained_exceptions_stacktrace
2 changes: 1 addition & 1 deletion docs/3rd-party-py3k-compat-code/jinja2_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def encode_filename(filename):

def with_metaclass(meta, *bases):
# This requires a bit of explanation: the basic idea is to make a
# dummy metaclass for one level of class instanciation that replaces
# dummy metaclass for one level of class instantiation that replaces
# itself with the actual metaclass. Because of internal type checks
# we also need to make sure that we downgrade the custom metaclass
# for one level to something closer to type (that's why __call__ and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"collapsed": false,
"input": [
"# Py3-style iterators written as new-style classes (subclasses of\n",
"# future.builtins.object) are backward compatibile with Py2:\n",
"# future.builtins.object) are backward compatible with Py2:\n",
"class Upper(object):\n",
" def __init__(self, iterable):\n",
" self._iter = iter(iterable)\n",
Expand Down
12 changes: 6 additions & 6 deletions docs/other/upload_future_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
git checkout v0.16.0 # or whatever
rm -Rf docs/build/
cd docs; make html
cp cheatsheet.pdf /shared/
cp cheatsheet.pdf ~/shared/
cd build
touch /shared/python-future-html-docs.zip
rm /shared/python-future-html-docs.zip
zip -r /shared/python-future-html-docs.zip *
touch ~/shared/python-future-html-docs.zip
rm ~/shared/python-future-html-docs.zip
zip -r ~/shared/python-future-html-docs.zip *

scp /shared/python-future-html-docs.zip python-future.org:
scp /shared/cheatsheet.pdf python-future.org:
scp ~/shared/python-future-html-docs.zip python-future.org:
scp ~/shared/cheatsheet.pdf python-future.org:
ssh python-future.org


Expand Down
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx==3.2.1
sphinx_bootstrap_theme==0.7.1
setuptools==65.5.1
2 changes: 1 addition & 1 deletion docs/standard_library_imports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ As of version 0.14, the ``future`` package comes with top-level packages for
Python 2.x that provide access to the reorganized standard library modules
under their Python 3.x names.

Direct imports are the preferred mechanism for accesing the renamed standard
Direct imports are the preferred mechanism for accessing the renamed standard
library modules in Python 2/3 compatible code. For example, the following clean
Python 3 code runs unchanged on Python 2 after installing ``future``::

Expand Down
67 changes: 65 additions & 2 deletions docs/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,69 @@
What's New
**********

What's new in version 0.18.4 (2024-02-21)
=========================================
This is a minor bug-fix release containing a number of fixes:

- Fix for Python 3.12's removal of the imp module
- Small updates to the docs

What's new in version 0.18.3 (2023-01-13)
=========================================
This is a minor bug-fix release containing a number of fixes:

- Backport fix for bpo-38804 (c91d70b)
- Fix bug in fix_print.py fixer (dffc579)
- Fix bug in fix_raise.py fixer (3401099)
- Fix newint bool in py3 (fe645ba)
- Fix bug in super() with metaclasses (6e27aac)
- docs: fix simple typo, reqest -> request (974eb1f)
- Correct __eq__ (c780bf5)
- Pass if lint fails (2abe00d)
- Update docker image and parcel out to constant variable. Add comment to update version constant (45cf382)
- fix order (f96a219)
- Add flake8 to image (046ff18)
- Make lint.sh executable (58cc984)
- Add docker push to optimize CI (01e8440)
- Build System (42b3025)
- Add docs build status badge to README.md (3f40bd7)
- Use same docs requirements in tox (18ecc5a)
- Add docs/requirements.txt (5f9893f)
- Add PY37_PLUS, PY38_PLUS, and PY39_PLUS (bee0247)
- fix 2.6 test, better comment (ddedcb9)
- fix 2.6 test (3f1ff7e)
- remove nan test (4dbded1)
- include list test values (e3f1a12)
- fix other python2 test issues (c051026)
- fix missing subTest (f006cad)
- import from old imp library on older python versions (fc84fa8)
- replace fstrings with format for python 3.4,3.5 (4a687ea)
- minor style/spelling fixes (8302d8c)
- improve cmp function, add unittest (0d95a40)
- Pin typing==3.7.4.1 for Python 3.3 compatiblity (1a48f1b)
- Fix various py26 unit test failures (9ca5a14)
- Add initial contributing guide with docs build instruction (e55f915)
- Add docs building to tox.ini (3ee9e7f)
- Support NumPy's specialized int types in builtins.round (b4b54f0)
- Added r""" to the docstring to avoid warnings in python3 (5f94572)
- Add __subclasscheck__ for past.types.basestring (c9bc0ff)
- Correct example in README (681e78c)
- Add simple documentation (6c6e3ae)
- Add pre-commit hooks (a9c6a37)
- Handling of __next__ and next by future.utils.get_next was reversed (52b0ff9)
- Add a test for our fix (461d77e)
- Compare headers to correct definition of str (3eaa8fd)
- #322 Add support for negative ndigits in round; additionally, fixing a bug so that it handles passing in Decimal properly (a4911b9)
- Add tkFileDialog to future.movers.tkinter (f6a6549)
- Sort before comparing dicts in TestChainMap (6126997)
- Fix typo (4dfa099)
- Fix formatting in "What's new" (1663dfa)
- Fix typo (4236061)
- Avoid DeprecationWarning caused by invalid escape (e4b7fa1)
- Fixup broken link to external django documentation re: porting to Python 3 and unicode_literals (d87713e)
- Fixed newdict checking version every time (99030ec)
- Add count from 2.7 to 2.6 (1b8ef51)

What's new in version 0.18.2 (2019-10-30)
=========================================
This is a minor bug-fix release containing a number of fixes:
Expand Down Expand Up @@ -33,7 +96,7 @@ This is a major bug-fix and feature release, including:
- Fix an issue with copyreg import under Py3 that results in unexposed stdlib functionality
- Export and document types in future.utils
- Update behavior of newstr.__eq__() to match str.__eq__() as per reference docs
- Fix raising and the raising fixer to handle cases where the syntax is ambigious
- Fix raising and the raising fixer to handle cases where the syntax is ambiguous
- Allow "default" parameter in min() and max() (Issue #334)
- Implement __hash__() in newstr (Issue #454)
- Future proof some version checks to handle the fact that Py4 won't be a major breaking release
Expand Down Expand Up @@ -65,7 +128,7 @@ This is a major bug-fix release, including:
- Fix ``past.translation`` on read-only file systems
- Fix Tkinter import bug introduced in Python 2.7.4 (issue #262)
- Correct TypeError to ValueError in a specific edge case for newrange
- Support inequality tests betwen newstrs and newbytes
- Support inequality tests between newstrs and newbytes
- Add type check to __get__ in newsuper
- Fix fix_divsion_safe to support better conversion of complex expressions, and
skip obvious float division.
Expand Down
13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
from distutils.core import setup


if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()


NAME = "future"
PACKAGES = ["future",
"future.builtins",
Expand Down Expand Up @@ -103,6 +98,11 @@
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved",
"License :: OSI Approved :: MIT License",
"Development Status :: 4 - Beta",
Expand Down Expand Up @@ -161,6 +161,9 @@
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
project_urls={
'Source': 'https://github.com/PythonCharmers/python-future',
},
description=DESCRIPTION,
long_description=LONG_DESC,
license=LICENSE,
Expand Down
2 changes: 1 addition & 1 deletion src/future/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
__copyright__ = 'Copyright 2013-2019 Python Charmers Pty Ltd'
__ver_major__ = 0
__ver_minor__ = 18
__ver_patch__ = 2
__ver_patch__ = 4
__ver_sub__ = ''
__version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__,
__ver_patch__, __ver_sub__)
2 changes: 1 addition & 1 deletion src/future/backports/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def today(cls):

@classmethod
def fromordinal(cls, n):
"""Contruct a date from a proleptic Gregorian ordinal.
"""Construct a date from a proleptic Gregorian ordinal.
January 1 of year 1 is day 1. Only the year, month and day are
non-zero in the result.
Expand Down
2 changes: 1 addition & 1 deletion src/future/backports/email/_header_value_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2867,7 +2867,7 @@ def parse_content_type_header(value):
_find_mime_parameters(ctype, value)
return ctype
ctype.append(token)
# XXX: If we really want to follow the formal grammer we should make
# XXX: If we really want to follow the formal grammar we should make
# mantype and subtype specialized TokenLists here. Probably not worth it.
if not value or value[0] != '/':
ctype.defects.append(errors.InvalidHeaderDefect(
Expand Down

0 comments on commit 925039a

Please sign in to comment.