nice-path 0.1.0__tar.gz → 0.1.3__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.
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: nice-path
3
+ Version: 0.1.3
4
+ Summary: Nice formatting of paths
5
+ Author: Tom Koelman
6
+ Author-email: Tom Koelman <tkoelman@xs4all.nl>
7
+ License-Expression: MIT-0
8
+ License-File: LICENSE
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Requires-Python: >=3.10
15
+ Project-URL: repository, https://github.com/tomkoelman/nice-path.git
16
+ Project-URL: issues, https://github.com/tomkoelman/nice-path/issues
17
+ Description-Content-Type: text/markdown
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.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nice-path"
3
- version = "0.1.0"
3
+ version = "0.1.3"
4
4
  description = "Nice formatting of paths"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -18,6 +18,10 @@ classifiers = [
18
18
  license = "MIT-0"
19
19
  license-files = [ "LICENSE" ]
20
20
 
21
+ [project.urls]
22
+ repository = "https://github.com/tomkoelman/nice-path.git"
23
+ issues = "https://github.com/tomkoelman/nice-path/issues"
24
+
21
25
  [build-system]
22
26
  requires = ["uv_build>=0.10.7,<0.11.0"]
23
27
  build-backend = "uv_build"
@@ -8,6 +8,9 @@ def nice_path(path: Path | str) -> str:
8
8
  try:
9
9
  rel = p.relative_to(home)
10
10
  rel_str = str(rel)
11
- return "~/" + (rel_str if rel_str != "." else "")
11
+ if rel_str == ".":
12
+ return "~"
13
+ else:
14
+ return "~/" + rel_str
12
15
  except ValueError:
13
16
  return str(p)
nice_path-0.1.0/PKG-INFO DELETED
@@ -1,16 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: nice-path
3
- Version: 0.1.0
4
- Summary: Nice formatting of paths
5
- Author: Tom Koelman
6
- Author-email: Tom Koelman <tkoelman@xs4all.nl>
7
- License-Expression: MIT-0
8
- License-File: LICENSE
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Development Status :: 5 - Production/Stable
12
- Classifier: Intended Audience :: Developers
13
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
- Requires-Python: >=3.10
15
- Description-Content-Type: text/markdown
16
-
nice_path-0.1.0/README.md DELETED
File without changes
File without changes