- Refreshed packaging.
- #197: Fixed default argument rendering in docs.
- #209: Refactored
write_lines
to re-use open semantics. Deprecated thelinesep
parameter.
- #207: Added type hints and declare the library as typed.
- Require Python 3.7 or later.
- #205: test_listdir_other_encoding now automatically skips itself on file systems where it's not appropriate.
- Deprecated passing bytes to
write_text
. Instead, users should callwrite_bytes
.
- #204: Improved test coverage across the package to 99%, fixing bugs in uncovered code along the way.
- #200:
TempDir
context now cleans up unconditionally, even if an exception occurs.
- #199: Fixed broken link in README.
- Refreshed package metadata.
- Added
ExtantPath
andExtantFile
objects that raise errors when they reference a non-existent path or file.
- Refreshed package metadata.
- Removed
__version__
property. To determine the version, useimportlib.metadata.version('path')
.
- Fixed regression on Python 3.7 and earlier where
lru_cache
did not support a user function.
- Removed
namebase
property. Usestem
instead. - Removed
update
parameter on method toPath.merge_tree
. Instead, to only copy newer files, provide a wrappedcopy
function, as described in the doc string. - Removed
FastPath
. Just usePath
. - Removed
path.CaseInsensitivePattern
. Instead usepath.matchers.CaseInsensitive
. - Removed
path.tempdir
. Usepath.TempDir
. - #154: Added
Traversal
class and support for customizing the behavior of aPath.walk
.
- #186: Fix test failures on Python 3.8 on Windows by relying on
realpath()
instead ofreadlink()
. - #189:
realpath()
now honors symlinks on Python 3.7 and earlier, approximating the behavior found on Python 3.8. - #187:
lines()
no longer relies on the deprecated.text()
.
- Require Python 3.6 or later.
- #170: Added
read_text
andread_bytes
methods to align withpathlib
behavior. Deprecatedtext
method. If you require newline normalization oftext
, usejaraco.text.normalize_newlines(Path.read_text())
.
- #169: Renamed package from
path.py
topath
. The docs make reference to a pet name "path pie" for easier discovery.
- #195: Project now depends on
path
.
- #169: Project now depends on
path < 13.2
. - Fixed typo in README.
- #169: Project is renamed to simply
path
. This release ofpath.py
simply depends onpath < 13.1
.
- #169: Moved project at GitHub from
jaraco/path.py
tojaraco/path
.
- #171: Fixed exception in
rmdir_p
when target is not empty. - #174: Rely on
importlib.metadata
on Python 3.8.
- Refreshed package metadata.
- #166: Removed 'universal' wheel support.
12.0 ---
- #148: Dropped support for Python 2.7 and 3.4.
- Moved 'path' into a package.
- #163: Corrected 'pymodules' typo in package declaration.
- Minor packaging refresh.
- #156: Re-wrote the handling of pattern matches for
listdir
,walk
, and related methods, allowing the pattern to be a more complex object. This approach drastically simplifies the code and obviates theCaseInsensitivePattern
andFastPath
classes. Now the mainPath
class should be as performant asFastPath
and case-insensitive matches can be readily constructed using the newpath.matchers.CaseInsensitive
class.
- #153: Skip intermittently failing performance test on Python 2.
- #130: Path.py now supports non-decodable filenames on
Linux and Python 2, leveraging the
backports.os
package (as an optional dependency). Currently, only
listdir
is patched, but otheros
primitives may be patched similarly in thepatch_for_linux_python2
function. - #141: For merge_tree, instead of relying on the deprecated
distutils module, implement merge_tree explicitly. The
update
parameter is deprecated, instead superseded by acopy_function
parameter and anonly_newer
wrapper for any copy function.
- #151: No longer use two techniques for splitting lines. Instead, unconditionally rely on io.open for universal newlines support and always use splitlines.
- #146: Rely on importlib_metadata instead of
setuptools/pkg_resources to load the version of the module.
Added tests ensuring a <100ms import time for the
path
module. This change adds an explicit dependency on the importlib_metadata package, but the project still supports copying of thepath.py
module without any dependencies.
- #143, #144: Add iglob method.
- #142, #145: Rename
tempdir
toTempDir
and declare it as part of__all__
. Retaintempdir
for compatibility for now. - #145:
TempDir.__enter__
no longer returns theTempDir
instance, but instead returns aPath
instance, suitable for entering to change the current working directory.
- #136: Fixed test failures on BSD.
- Refreshed package metadata.
- Drop support for Python 3.3.
Renamed
namebase
tostem
to match API of pathlib. Keptnamebase
as a deprecated alias for compatibility.Added new
with_suffix
method, useful for renaming the extension on a Path:orig = Path('mydir/mypath.bat') renamed = orig.rename(orig.with_suffix('.cmd'))
- Packaging refresh and readme updates.
- #130: Removed surrogate_escape handler as it's no longer used.
- #124: Fixed
rmdir_p
raisingFileNotFoundError
when directory does not exist on Windows.
#115: Added a new performance-optimized implementation for listdir operations, optimizing
listdir
,walk
,walkfiles
,walkdirs
, andfnmatch
, presented as theFastPath
class.Please direct feedback on this implementation to the ticket, especially if the performance benefits justify it replacing the default
Path
class.
- Symlink no longer requires the
newlink
parameter and will default to the basename of the target in the current working directory.
- #123: Implement
Path.__fspath__
per PEP 519.
- Once again as in 8.0 remove deprecated
path.path
.
- #121: Removed workaround for #61 added in 5.2.
path.py
now only supports file system paths that can be effectively decoded to text. It is the responsibility of the system implementer to ensure that filenames on the system are decodeable bysys.getfilesystemencoding()
.
- Drop support for Python 2.6 and 3.2 as integration dependencies (pip) no longer support these versions.
- Merge with latest skeleton, adding badges and test runs by default under tox instead of pytest-runner.
- Documentation is no longer hosted with PyPI.
- #112: Update Travis CI usage to only deploy on Python 3.5.
- Refreshed project metadata based on jaraco's project skeleton.
- Releases are now automatically published via Travis-CI.
- #111: More aggressively trap errors when importing
pkg_resources
.
- #105: By using unicode literals, avoid errors rendering the backslash in __get_owner_windows.
- #102: Reluctantly restored reference to path.path in
__all__
.
- #102: Restored
path.path
with a DeprecationWarning.
Removed path.path
. Clients must now refer to the canonical
name, path.Path
as introduced in 6.2.
#88: Added support for resolving certain directories on a system to platform-friendly locations using the appdirs library. The
Path.special
method returns anSpecialResolver
instance that will resolve a path in a scope (i.e. 'site' or 'user') and class (i.e. 'config', 'cache', 'data'). For example, to create a config directory for "My App":config_dir = Path.special("My App").user.config.makedirs_p()
config_dir
will exist in a user context and will be in a suitable platform-friendly location.As
path.py
does not currently have any dependencies, and to retain that expectation for a compatible upgrade path,appdirs
must be installed to avoid an ImportError when invokingspecial
.#88: In order to support "multipath" results, where multiple paths are returned in a single,
os.pathsep
-separated string, a new class MultiPath now represents those special results. This functionality is experimental and may change. Feedback is invited.
- Re-release of 7.6.1 without unintended feature.
- #101: Supress error when path.py is not present as a distribution.
- #100: Add
merge_tree
method for merging two existing directory trees. - Uses setuptools_scm for version management.
- #97:
__rdiv__
and__rtruediv__
are now defined.
- #93: chown now appears in docs and raises NotImplementedError if
os.chown
isn't present. - #92: Added compatibility support for
.samefile
on platforms withoutos.samefile
.
- #91: Releases now include a universal wheel.
- In chmod, added support for multiple symbolic masks (separated by commas).
- In chmod, fixed issue in setting of symbolic mask with '=' where unreferenced permissions were cleared.
- #23: Added support for symbolic masks to
.chmod
.
- The
open
method now usesio.open
and supports all of the parameters to that function.open
will always raise anOSError
on failure, even on Python 2.- Updated
write_text
to support additional newline patterns.- The
text
method now always returns text (never bytes), and thus requires an encoding parameter be supplied if the default encoding is not sufficient to decode the content of the file.
path
class renamed toPath
. Thepath
name remains as an alias for compatibility.
chown
now accepts names in addition to numeric IDs.
- Drop support for Python 2.5. Python 2.6 or later required.
- Installation now requires setuptools.
- Allow arbitrary callables to be passed to path.walk
errors
parameter. Enables workaround for issues such as #73 and #56.
- #61: path.listdir now decodes filenames from os.listdir when loading characters from a file. On Python 3, the behavior is unchanged. On Python 2, the behavior will now mimick that of Python 3, attempting to decode all filenames and paths using the encoding indicated by
sys.getfilesystemencoding()
, and escaping any undecodable characters using the 'surrogateescape' handler.
- #53: Added
path.in_place
for editing files in place.
path.fnmatch
now takes an optional parameternormcase
and this parameter defaults to self.module.normcase (using case normalization most pertinent to the path object itself). Note that this change means that any paths using a custom ntpath module on non-Windows systems will have different fnmatch behavior. Before:# on Unix >>> p = path('Foo') >>> p.module = ntpath >>> p.fnmatch('foo') FalseAfter:
# on any OS >>> p = path('Foo') >>> p.module = ntpath >>> p.fnmatch('foo') TrueTo maintain the original behavior, either don't define the 'module' for the path or supply explicit normcase function:
>>> p.fnmatch('foo', normcase=os.path.normcase) # result always varies based on OS, same as fnmatch.fnmatchFor most use-cases, the default behavior should remain the same.
Issue #50: Methods that accept patterns (
listdir
,files
,dirs
,walk
,walkdirs
,walkfiles
, andfnmatch
) will now use anormcase
attribute if it is present on thepattern
parameter. The path module now provides aCaseInsensitivePattern
wrapper for strings suitable for creating case-insensitive patterns for those methods.
- Issue #44: _hash method would open files in text mode, producing invalid results on Windows. Now files are opened in binary mode, producing consistent results.
- Issue #47: Documentation is dramatically improved with Intersphinx links to the Python os.path functions and documentation for all methods and properties.
- Issue #32: Add
chdir
andcd
methods.
open()
now passes all positional and keyword arguments through to the underlyingbuiltins.open
call.
- Native Python 2 and Python 3 support without using 2to3 during the build process.
- Added a
chunks()
method to a allow quick iteration over pieces of a file at a given path.- Issue #28: Fix missing argument to
samefile
.- Initializer no longer enforces isinstance basestring for the source object. Now any object that supplies
__unicode__
can be used by apath
(except None). Clients that depend on a ValueError being raised forint
and other non-string objects should trap these types internally.- Issue #30:
chown
no longer requires both uid and gid to be provided and will not mutate the ownership if nothing is provided.
- Issue #22:
__enter__
now returns self.
- Issue #20: relpath now supports a "start" parameter to match the signature of os.path.relpath.
- Minimum Python version is now 2.5.
Issue #5: Implemented path.tempdir, which returns a path object which is a temporary directory and context manager for cleaning up the directory.
Issue #12: One can now construct path objects from a list of strings by simply using path.joinpath. For example:
path.joinpath('a', 'b', 'c') # or path.joinpath(*path_elements)
- Issue #7: Add the ability to do chaining of operations that formerly only returned None.
- Issue #4: Raise a TypeError when constructed from None.