Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to native package namespaces #137

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"sphinx-mdinclude >= 0.5.2",
"picobox >= 2.2",
"deepmerge >= 0.1",
"importlib-metadata; python_version < '3.8'",
],
project_urls={
"Documentation": "https://sphinxcontrib-openapi.readthedocs.io/",
Expand All @@ -54,6 +55,5 @@
"Framework :: Sphinx",
"Framework :: Sphinx :: Extension",
],
namespace_packages=["sphinxcontrib"],
python_requires=">=3.7",
)
2 changes: 1 addition & 1 deletion sphinxcontrib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
:license: BSD, see LICENSE for details.
"""

__import__("pkg_resources").declare_namespace(__name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
10 changes: 7 additions & 3 deletions sphinxcontrib/openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
:license: BSD, see LICENSE for details.
"""

from pkg_resources import get_distribution, DistributionNotFound
try:
from importlib.metadata import distribution, PackageNotFoundError
except ImportError: # python < 3.8
from importlib_metadata import distribution, PackageNotFoundError

from sphinxcontrib.openapi import renderers, directive

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
__version__ = distribution(__name__).version
except PackageNotFoundError:
# package is not installed
__version__ = None

Expand Down