Skip to main content

In short

This libray propose to extend the capabilities of pathlib. The Path class provided here is a sub-class of the original pathlib.Path class.

It especially enable an easy interaction with widespread file formats like json, pickle or tsv files, plain or compressed.

Options are mostly not setable, this package was meant to fit my needs, not all :D.

from cc_pathlib import Path

In detail

Path.make_dirs(self, umask='shared') is an equivalent of Path.mkdir(parents=True, exists_ok=True), with the added possibility to set a umask to each directory created in-between. Especially, the default value is 'shared' for a mask value of 0o2770 (which means: available for read and write access to user and group but not others, and gid set such as each new file or directory created subsequently keep this properties).

Path.make_parents(self, umask='shared') same as Path.make_dirs(self, umask='shared') but works on files, it create the whole directory structure above it. It does not create the file though.

Path.delete(self, content_only=False) delete recursively if the Path is a directory. If content_only=True it keeps the root directory once emptied.

Path.or_archive return the name of a corresponding archive if it exists. Looking at the following extensions, in this order, .br, .lz, .gz. This function is meant to work on files, not on complex archives like .tar files.

Path.load(self, encoding='utf-8') is an auto-loader. The type of file is guessed from the extension

The auto-loader

The auto-loader works in two steps :

  1. if the file is compressed with one of the following extensions, it is first unzipped :
    • .gz for gzip
    • .br for brotli
    • .lz for lzip
  2. if the file match one of the following filter, the content is properly parsed, and only the resulting object is returned:
    • .pickle for a pickled file
    • .json for a json data structure
    • .tsv for a tab separated value type of file, returned as a list() of list() of str(). The complete spec of a .tsv file is described below

Metadata

Release files for cc-pathlib 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cc-pathlib 0.1.0
File Size Uploaded
cc-pathlib-0.1.0.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cc-pathlib 0.1.0
File Interpreter ABI Platform
cc_pathlib-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / cc-pathlib-0.1.0.tar.gz

Download URL cc-pathlib-0.1.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6602330a59078969474c39f6172d03da372b0ef44b0baa0bcc5033237b9e1564
BLAKE2b-256 checksum
How to use checksums
58531acf66813945b84f062f077024497e729ffc258d561a510d556902f0c37e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / cc_pathlib-0.1.0-py3-none-any.whl

Download URL cc_pathlib-0.1.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f545d61cc74f5830f623d7d8a773f2ba3591fb08323e350e4a2074c443df046b
BLAKE2b-256 checksum
How to use checksums
bfbe7f3bbb1b4ec100189716103827108e55febea0e00d11e6669eb1ffbcfb65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page