nice-path 0.1.1__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nice-path
3
- Version: 0.1.1
3
+ Version: 0.1.4
4
4
  Summary: Nice formatting of paths
5
5
  Author: Tom Koelman
6
6
  Author-email: Tom Koelman <tkoelman@xs4all.nl>
@@ -16,3 +16,26 @@ Project-URL: repository, https://github.com/tomkoelman/nice-path.git
16
16
  Project-URL: issues, https://github.com/tomkoelman/nice-path/issues
17
17
  Description-Content-Type: text/markdown
18
18
 
19
+ # nice_path
20
+
21
+ A Python library for formatting a path in a nice way. If a path is
22
+ relative to the users home directory it will rewrite it to use `~`.
23
+
24
+ ## Examples
25
+
26
+ ```python
27
+ from nice_path import nice_path
28
+ from pathlib import Path
29
+
30
+ nice_path("/Users/<user>/.config/something") # "~/.config/something"
31
+
32
+ nice_path("/Users/<user>/") # "~"
33
+
34
+ nice_path("/tmp") # "/tmp"
35
+
36
+ nice_path(Path("/Users/<user>/Documents")) # "~/Documents"
37
+ ```
38
+
39
+ ## License
40
+
41
+ This project is licensed under the MIT License.
@@ -0,0 +1,23 @@
1
+ # nice_path
2
+
3
+ A Python library for formatting a path in a nice way. If a path is
4
+ relative to the users home directory it will rewrite it to use `~`.
5
+
6
+ ## Examples
7
+
8
+ ```python
9
+ from nice_path import nice_path
10
+ from pathlib import Path
11
+
12
+ nice_path("/Users/<user>/.config/something") # "~/.config/something"
13
+
14
+ nice_path("/Users/<user>/") # "~"
15
+
16
+ nice_path("/tmp") # "/tmp"
17
+
18
+ nice_path(Path("/Users/<user>/Documents")) # "~/Documents"
19
+ ```
20
+
21
+ ## License
22
+
23
+ This project is licensed under the MIT License.
@@ -0,0 +1,31 @@
1
+ [project]
2
+ name = "nice-path"
3
+ version = "0.1.4"
4
+ description = "Nice formatting of paths"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = []
8
+ classifiers = [
9
+ "Programming Language :: Python :: 3",
10
+ "Operating System :: OS Independent",
11
+ "Development Status :: 5 - Production/Stable",
12
+ "Intended Audience :: Developers",
13
+ "Topic :: Software Development :: Libraries :: Python Modules",
14
+ ]
15
+ license = "MIT-0"
16
+ license-files = ["LICENSE"]
17
+
18
+ [[project.authors]]
19
+ name = "Tom Koelman"
20
+ email = "tkoelman@xs4all.nl"
21
+
22
+ [project.urls]
23
+ repository = "https://github.com/tomkoelman/nice-path.git"
24
+ issues = "https://github.com/tomkoelman/nice-path/issues"
25
+
26
+ [build-system]
27
+ requires = ["uv_build>=0.13.7,<0.14.0"]
28
+ build-backend = "uv_build"
29
+
30
+ [dependency-groups]
31
+ dev = ["pytest>=9.0.2"]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nice-path"
3
- version = "0.1.1"
3
+ version = "0.1.4"
4
4
  description = "Nice formatting of paths"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -23,7 +23,7 @@ repository = "https://github.com/tomkoelman/nice-path.git"
23
23
  issues = "https://github.com/tomkoelman/nice-path/issues"
24
24
 
25
25
  [build-system]
26
- requires = ["uv_build>=0.10.7,<0.11.0"]
26
+ requires = ["uv_build>=0.13.7,<0.14.0"]
27
27
  build-backend = "uv_build"
28
28
 
29
29
  [dependency-groups]
@@ -7,7 +7,9 @@ def nice_path(path: Path | str) -> str:
7
7
  home = Path.home()
8
8
  try:
9
9
  rel = p.relative_to(home)
10
- rel_str = str(rel)
11
- return "~/" + (rel_str if rel_str != "." else "")
10
+ if str(rel) == ".":
11
+ return "~"
12
+ else:
13
+ return str(Path("~") / rel)
12
14
  except ValueError:
13
15
  return str(p)
nice_path-0.1.1/README.md DELETED
File without changes
File without changes