#!/usr/bin/env python
from __future__ import print_function

import io
import os
import sys
from distutils.util import convert_path
from fnmatch import fnmatchcase

from setuptools import find_packages, setup


# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ["*.py", "*.pyc", "*~", ".*", "*.bak", "Makefile"]
standard_exclude_directories = [
    ".*",
    "CVS",
    "_darcs",
    "./build",
    "./dist",
    "EGG-INFO",
    "*.egg-info",
    "./example",
]


# Copied from paste/util/finddata.py
def find_package_data(
    where=".",
    package="",
    exclude=standard_exclude,
    exclude_directories=standard_exclude_directories,
    only_in_packages=True,
    show_ignored=False,
):
    """
    Return a dictionary suitable for use in ``package_data``
    in a distutils ``setup.py`` file.

    The dictionary looks like::

        {"package": [files]}

    Where ``files`` is a list of all the files in that package that
    don't match anything in ``exclude``.

    If ``only_in_packages`` is true, then top-level directories that
    are not packages won't be included (but directories under packages
    will).

    Directories matching any pattern in ``exclude_directories`` will
    be ignored; by default directories with leading ``.``, ``CVS``,
    and ``_darcs`` will be ignored.

    If ``show_ignored`` is true, then all the files that aren't
    included in package data are shown on stderr (for debugging
    purposes).

    Note patterns use wildcards, or can be exact paths (including
    leading ``./``), and all searching is case-insensitive.
    """

    out = {}
    stack = [(convert_path(where), "", package, only_in_packages)]
    while stack:
        where, prefix, package, only_in_packages = stack.pop(0)
        for name in os.listdir(where):
            fn = os.path.join(where, name)
            if os.path.isdir(fn):
                bad_name = False
                for pattern in exclude_directories:
                    if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
                        bad_name = True
                        if show_ignored:
                            print(
                                "Directory %s ignored by pattern %s" % (fn, pattern),
                                file=sys.stderr,
                            )
                        break
                if bad_name:
                    continue
                if os.path.isfile(os.path.join(fn, "__init__.py")) and not prefix:
                    if not package:
                        new_package = name
                    else:
                        new_package = package + "." + name
                    stack.append((fn, "", new_package, False))
                else:
                    stack.append((fn, prefix + name + "/", package, only_in_packages))
            elif package or not only_in_packages:
                # is a file
                bad_name = False
                for pattern in exclude:
                    if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
                        bad_name = True
                        if show_ignored:
                            print(
                                "File %s ignored by pattern %s" % (fn, pattern),
                                file=sys.stderr,
                            )
                        break
                if bad_name:
                    continue
                out.setdefault(package, []).append(prefix + name)
    return out


excluded_directories = standard_exclude_directories

package_data = find_package_data(exclude_directories=excluded_directories)

long_description = io.open("README.rst", encoding="utf-8").read()

# Dynamically calculate the version based on allauth.VERSION.
version = __import__("allauth").__version__

METADATA = dict(
    name="django-allauth",
    version=version,
    author="Raymond Penners",
    author_email="raymond.penners@intenct.nl",
    description="Integrated set of Django applications addressing"
    " authentication, registration, account management as well as"
    " 3rd party (social) account authentication.",
    long_description=long_description,
    url="http://www.intenct.nl/projects/django-allauth/",
    keywords="django auth account social openid twitter facebook oauth registration",
    project_urls={
        "Documentation": "https://django-allauth.readthedocs.io/en/latest/",
        "Changelog": "https://github.com/pennersr/django-allauth/blob/master/ChangeLog.rst",
        "Source": "http://github.com/pennersr/django-allauth",
        "Tracker": "https://github.com/pennersr/django-allauth/issues",
        "Donate": "https://github.com/sponsors/pennersr",
    },
    tests_require=[],
    install_requires=[
        "Django >= 2.0",
        "python3-openid >= 3.0.8",
        "requests-oauthlib >= 0.3.0",
        "requests",
        "pyjwt[crypto] >= 1.7",
    ],
    include_package_data=True,
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: Developers",
        "Topic :: Software Development :: Libraries :: Python Modules",
        "Environment :: Web Environment",
        "Topic :: Internet",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "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",
        "Framework :: Django",
        "Framework :: Django :: 2.0",
        "Framework :: Django :: 2.1",
        "Framework :: Django :: 2.2",
        "Framework :: Django :: 3.0",
        "Framework :: Django :: 3.1",
        "Framework :: Django :: 3.2",
        "Framework :: Django :: 4.0",
    ],
    packages=find_packages(exclude=["example"]),
    package_data=package_data,
)

if __name__ == "__main__":
    setup(**METADATA)

setup.py
#!/usr/bin/env python
from __future__ import print_function

import io
import os
import sys
from distutils.util import convert_path
from fnmatch import fnmatchcase

from setuptools import find_packages, setup


# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ["*.py", "*.pyc", "*~", ".*", "*.bak", "Makefile"]
standard_exclude_directories = [
    ".*",
    "CVS",
    "_darcs",
    "./build",
    "./dist",
    "EGG-INFO",
    "*.egg-info",
    "./example",
]


# Copied from paste/util/finddata.py
def find_package_data(
    where=".",
    package="",
    exclude=standard_exclude,
    exclude_directories=standard_exclude_directories,
    only_in_packages=True,
    show_ignored=False,
):
    """
    Return a dictionary suitable for use in ``package_data``
    in a distutils ``setup.py`` file.

    The dictionary looks like::

        {"package": [files]}

    Where ``files`` is a list of all the files in that package that
    don't match anything in ``exclude``.

    If ``only_in_packages`` is true, then top-level directories that
    are not packages won't be included (but directories under packages
    will).

    Directories matching any pattern in ``exclude_directories`` will
    be ignored; by default directories with leading ``.``, ``CVS``,
    and ``_darcs`` will be ignored.

    If ``show_ignored`` is true, then all the files that aren't
    included in package data are shown on stderr (for debugging
    purposes).

    Note patterns use wildcards, or can be exact paths (including
    leading ``./``), and all searching is case-insensitive.
    """

    out = {}
    stack = [(convert_path(where), "", package, only_in_packages)]
    while stack:
        where, prefix, package, only_in_packages = stack.pop(0)
        for name in os.listdir(where):
            fn = os.path.join(where, name)
            if os.path.isdir(fn):
                bad_name = False
                for pattern in exclude_directories:
                    if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
                        bad_name = True
                        if show_ignored:
                            print(
                                "Directory %s ignored by pattern %s" % (fn, pattern),
                                file=sys.stderr,
                            )
                        break
                if bad_name:
                    continue
                if os.path.isfile(os.path.join(fn, "__init__.py")) and not prefix:
                    if not package:
                        new_package = name
                    else:
                        new_package = package + "." + name
                    stack.append((fn, "", new_package, False))
                else:
                    stack.append((fn, prefix + name + "/", package, only_in_packages))
            elif package or not only_in_packages:
                # is a file
                bad_name = False
                for pattern in exclude:
                    if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
                        bad_name = True
                        if show_ignored:
                            print(
                                "File %s ignored by pattern %s" % (fn, pattern),
                                file=sys.stderr,
                            )
                        break
                if bad_name:
                    continue
                out.setdefault(package, []).append(prefix + name)
    return out


excluded_directories = standard_exclude_directories

package_data = find_package_data(exclude_directories=excluded_directories)

long_description = io.open("README.rst", encoding="utf-8").read()

# Dynamically calculate the version based on allauth.VERSION.
version = __import__("allauth").__version__

METADATA = dict(
    name="django-allauth",
    version=version,
    author="Raymond Penners",
    author_email="raymond.penners@intenct.nl",
    description="Integrated set of Django applications addressing"
    " authentication, registration, account management as well as"
    " 3rd party (social) account authentication.",
    long_description=long_description,
    url="http://www.intenct.nl/projects/django-allauth/",
    keywords="django auth account social openid twitter facebook oauth registration",
    project_urls={
        "Documentation": "https://django-allauth.readthedocs.io/en/latest/",
        "Changelog": "https://github.com/pennersr/django-allauth/blob/master/ChangeLog.rst",
        "Source": "http://github.com/pennersr/django-allauth",
        "Tracker": "https://github.com/pennersr/django-allauth/issues",
        "Donate": "https://github.com/sponsors/pennersr",
    },
    tests_require=[],
    install_requires=[
        "Django >= 2.0",
        "python3-openid >= 3.0.8",
        "requests-oauthlib >= 0.3.0",
        "requests",
        "pyjwt[crypto] >= 1.7",
    ],
    include_package_data=True,
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: Developers",
        "Topic :: Software Development :: Libraries :: Python Modules",
        "Environment :: Web Environment",
        "Topic :: Internet",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "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",
        "Framework :: Django",
        "Framework :: Django :: 2.0",
        "Framework :: Django :: 2.1",
        "Framework :: Django :: 2.2",
        "Framework :: Django :: 3.0",
        "Framework :: Django :: 3.1",
        "Framework :: Django :: 3.2",
        "Framework :: Django :: 4.0",
    ],
    packages=find_packages(exclude=["example"]),
    package_data=package_data,
)

if __name__ == "__main__":
    setup(**METADATA)

setup.py
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1bbdccb2ad..55d08aa2eb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,24 +12,32 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.5', '3.6', '3.7', '3.8', '3.9']
+        python-version: ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10']
         django-version: ['main', '2.0', '2.1', '2.2', '3.0', '3.1', '3.2', '4.0']
         exclude:
           - python-version: '3.8'
             django-version: '2.0'
           - python-version: '3.9'
             django-version: '2.0'
+          - python-version: '3.10'
+            django-version: '2.0'
 
           - python-version: '3.8'
             django-version: '2.1'
           - python-version: '3.9'
             django-version: '2.1'
+          - python-version: '3.10'
+            django-version: '2.1'
 
           - python-version: '3.5'
             django-version: '3.0'
+          - python-version: '3.10'
+            django-version: '3.0'
 
           - python-version: '3.5'
             django-version: '3.1'
+          - python-version: '3.10'
+            django-version: '3.1'
 
           - python-version: '3.5'
             django-version: '3.2'
diff --git a/docs/overview.rst b/docs/overview.rst
index 6c30abb502..fbed7a4f39 100644
--- a/docs/overview.rst
+++ b/docs/overview.rst
@@ -4,7 +4,7 @@ Overview
 Requirements
 ------------
 
-- Python 3.5, 3.6, 3.7, 3.8 or 3.9
+- Python 3.5, 3.6, 3.7, 3.8, 3.9, or 3.10
 
 - Django (2.0+)
 
diff --git a/setup.py b/setup.py
index e4fc0e95c4..1b1e43a83e 100644
--- a/setup.py
+++ b/setup.py
@@ -157,6 +157,7 @@ def find_package_data(
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
         "Framework :: Django",
         "Framework :: Django :: 2.0",
         "Framework :: Django :: 2.1",
diff --git a/tox.ini b/tox.ini
index 5f52334a71..f54009291f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,8 +5,8 @@ envlist =
     py{35,36,37,38,39}-django22
     py{36,37,38,39}-django30
     py{36,37,38,39}-django31
-    py{36,37,38,39}-django32
-    py{38,39}-django40
+    py{36,37,38,39,310}-django32
+    py{38,39,310}-django40
     py{39}-djangomain
     docs
     checkqa
@@ -78,6 +78,7 @@ PYTHON_VER =
     3.7: py37
     3.8: py38
     3.9: py39
+    3.10: py310
 DJANGO =
     main: djangomain
     2.0: django20

Add python 3.10 support
Would maintainers be willing to add python 3.10 to tox tests and official support? You can add this with the `py310` tag according the tox's [changelog](https://tox.wiki/en/latest/changelog.html#id158). 
