Skip to content

Commit 51255a3

Browse files
authored
Add minor improvements (#8)
* Add is_symlink to __repr__ * Add ProperPath alias 'P' * Explain 'kind' with simple words * Fix formatting * Fix alias 'P' * Update copyright message - Add "MIT" copyright badge * Update version to 0.2.6
1 parent ede708d commit 51255a3

File tree

10 files changed

+183
-111
lines changed

10 files changed

+183
-111
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.6] - 2025-09-29
9+
10+
Release with minor improvements.
11+
12+
### Added
13+
14+
- Added alias `P` for `ProperPath`
15+
- Improved documentation
16+
- Show `is_symlink()` in `__repr__` output
817

918
## [0.2.5] - 2025-09-28
1019

README.md

Lines changed: 68 additions & 51 deletions
Large diffs are not rendered by default.

docs/apis/properpath.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1-
# `ProperPath`
1+
# `ProperPath`
22

33
::: properpath
4+
5+
### Other `pathlib.Path` methods and attributes
6+
7+
As a subclass of `pathlib.Path`, a `properpath` instance supports all other [
8+
`pathlib.Path` methods and attributes](https://docs.python.org/3.12/library/pathlib.html#pathlib.Path) that
9+
are not listed here.
10+
11+
## `P`
12+
13+
`P` is an alias for `ProperPath`. `P` is the preferred way to import `ProperPath` as it is much shorter and easier to
14+
type.
15+
16+
```python
17+
from properpath import P, ProperPath
18+
19+
assert P == ProperPath
20+
```

docs/index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<a href="https://pypi.org/project/properpath"><img alt="Package version" src="https://badge.fury.io/py/properpath.svg/?branch=main" /></a>
44
<img alt="Static Badge" src="https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-%230d7dbe">
55
<a href="https://github.com/uhd-urz/properpath/actions"><img alt="GitHub Action test workflow" src="https://github.com/uhd-urz/properpath/actions/workflows/test.yml/badge.svg"></a>
6+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
67

78
An opinionated OS-path module for people who take paths too seriously. `ProperPath`, as a subclass of Python's popular [
89
`pathlib.Path`](https://docs.python.org/3.12/library/pathlib.html#pathlib.Path), is a drop-in replacement with some
@@ -41,17 +42,17 @@ uv add properpath
4142
Open a Python REPL and try the following:
4243

4344
```{ .pycon .no-copy title="Python REPL" linenums="0" }
44-
>>> from properpath import ProperPath
45+
>>> from properpath import P # "P" is a shorthand for "ProperPath"
4546
46-
>>> ProperPath("~")
47-
ProperPath(path=/Users/username, actual=('~',), kind=dir, exists=True, err_logger=<RootLogger root (WARNING)>)
47+
>>> P("~")
48+
ProperPath(path=/Users/username, actual=('~',), kind=dir, exists=True, is_symlink=False, err_logger=<RootLogger root (WARNING)>)
4849
```
4950

5051
If you already have a script or a project where you've used `from pathlib import Path`, and if you're feeling
5152
adventurous (!), you can try the following:
5253

5354
```python
54-
from properpath import ProperPath as Path
55+
from properpath import P as Path
5556
```
5657

5758
Head over to the [Tutorial](tutorial.md) page for more hands-on examples.

docs/tutorial.md

Lines changed: 74 additions & 49 deletions
Large diffs are not rendered by default.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ plugins:
8383
show_signature_annotations: true
8484
allow_inspection: true
8585
docstring_style: "google"
86-
copyright: ProperPath package is copyrighted under the MIT license.
86+
copyright: ©2025 University Computing Center Heidelberg

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "properpath"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
authors = [{ name = "Alexander Haller, Mahadi Xion", email = "[email protected]" }]
55
maintainers = [{ name = "Mahadi Xion", email = "[email protected]" }]
66
readme = "README.md"

src/properpath/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .properpath import NoException, ProperPath
1+
from .properpath import NoException, P, ProperPath
22

3-
__all__ = ["ProperPath", "NoException"]
3+
__all__ = ["ProperPath", "NoException", "P"]

src/properpath/properpath.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def __repr__(self):
184184
"""
185185
return (
186186
f"{self.__class__.__name__}(path={self}, actual={self.actual}, "
187-
f"kind={self.kind}, exists={self.exists()}, "
187+
f"kind={self.kind}, exists={self.exists()}, is_symlink={self.is_symlink()}, "
188188
f"err_logger={self.err_logger})"
189189
)
190190

@@ -573,3 +573,6 @@ def open(self, mode="r", encoding=None, *args, **kwargs):
573573
)
574574
self.PathException = os_exception
575575
raise e
576+
577+
578+
P = ProperPath

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)