diff --git a/CHANGES.rst b/CHANGES.rst index c8142e5..4b6f38d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,11 +9,13 @@ Change History Improvements: - `Issue #66`_/`Pull #67`_: Package not marked as py.typed. +- `Issue #68`_: Exports are considered private. - `Issue #70`_/`Pull #71`_: 'Self' string literal type is Unknown in pyright. .. _`Issue #66`: https://github.com/cpburnz/python-pathspec/issues/66 .. _`Pull #67`: https://github.com/cpburnz/python-pathspec/pull/67 +.. _`Issue #68`: https://github.com/cpburnz/python-pathspec/issues/68 .. _`Issue #70`: https://github.com/cpburnz/python-pathspec/issues/70 .. _`Pull #71`: https://github.com/cpburnz/python-pathspec/pull/71 diff --git a/pathspec/__init__.py b/pathspec/__init__.py index 93f06ce..32e03f7 100644 --- a/pathspec/__init__.py +++ b/pathspec/__init__.py @@ -6,27 +6,27 @@ The following classes are imported and made available from the root of the `pathspec` package: -- :class:`pathspec.gitignore.GitIgnoreSpec` +- :class:`pathspec.gitignore.GitIgnoreSpec` -- :class:`pathspec.pathspec.PathSpec` +- :class:`pathspec.pathspec.PathSpec` -- :class:`pathspec.pattern.Pattern` +- :class:`pathspec.pattern.Pattern` -- :class:`pathspec.pattern.RegexPattern` +- :class:`pathspec.pattern.RegexPattern` -- :class:`pathspec.util.RecursionError` +- :class:`pathspec.util.RecursionError` The following functions are also imported: -- :func:`pathspec.util.lookup_pattern` +- :func:`pathspec.util.lookup_pattern` The following deprecated functions are also imported to maintain backward compatibility: -- :func:`pathspec.util.iter_tree` which is an alias for - :func:`pathspec.util.iter_tree_files`. +- :func:`pathspec.util.iter_tree` which is an alias for + :func:`pathspec.util.iter_tree_files`. -- :func:`pathspec.util.match_files` +- :func:`pathspec.util.match_files` """ from .gitignore import ( @@ -53,6 +53,24 @@ # Load pattern implementations. from . import patterns -# Expose `GitIgnorePattern` class in the root module for backward -# compatibility with v0.4. +# DEPRECATED: Expose the `GitIgnorePattern` class in the root module for +# backward compatibility with v0.4. from .patterns.gitwildmatch import GitIgnorePattern + +# Declare private imports as part of the public interface. Deprecated +# imports are deliberately excluded. +__all__ = [ + 'GitIgnoreSpec', + 'PathSpec', + 'Pattern', + 'RecursionError', + 'RegexPattern', + '__author__', + '__copyright__', + '__credits__', + '__license__', + '__version__', + 'iter_tree', + 'lookup_pattern', + 'match_files', +] diff --git a/pathspec/patterns/__init__.py b/pathspec/patterns/__init__.py index 1a0d55e..7360e9c 100644 --- a/pathspec/patterns/__init__.py +++ b/pathspec/patterns/__init__.py @@ -1,8 +1,11 @@ -# encoding: utf-8 """ The *pathspec.patterns* package contains the pattern matching implementations. """ # Load pattern implementations. +from . import gitwildmatch + +# DEPRECATED: Expose the `GitWildMatchPattern` class in this module for +# backward compatibility with v0.5. from .gitwildmatch import GitWildMatchPattern