Prepare Namespace package (#1543)

* Update __init__.py

* Update setup.py
This commit is contained in:
Justus Schock 2020-04-21 13:12:02 +02:00 committed by GitHub
parent bd168819f2
commit 8035c10f37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -60,4 +60,13 @@ else:
'Callback',
'data_loader'
]
# necessary for regular bolts imports. Skip exception since bolts is not always installed
try:
from pytorch_lightning import bolts
except ImportError:
pass
# __call__ = __all__
# for compatibility with namespace packages
__import__('pkg_resources').declare_namespace(__name__)

View File

@ -3,7 +3,7 @@
import os
from io import open
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from setuptools import setup, find_namespace_packages
try:
import builtins
@ -57,7 +57,7 @@ setup(
url=pytorch_lightning.__homepage__,
download_url='https://github.com/PyTorchLightning/pytorch-lightning',
license=pytorch_lightning.__license__,
packages=find_packages(exclude=['tests', 'tests/*', 'benchmarks']),
packages=find_namespace_packages(exclude=['tests', 'tests/*', 'benchmarks']),
long_description=load_long_describtion(),
long_description_content_type='text/markdown',