Skip to main content

Pyerarchy is a Python package for easy file system surfing and manipulation. It enables to interact with the file system directly as Python objects without making implicit calls to os package. Finally it makes the code much more readable and nice.

Basic Usage

The central point of Pyerarchy is the Node. The basic usage starts by initializing an entry point Node and manipulating it further:

node = Node('entry/point/path')  # Initialize a new node

children = node.ls()  # List all child entities of the node
node.mkdir('newdir').mkdir('anotherdir')  # Create a new directory under node, and another one under the new one :)

# Now access the newly created directories
anotherdir = node/'newdir'/'anotherdir'  # This is the most common way to access nodes
children = node.newdir.anotherdir.ls()  # This method can be used to invoke an operation on the result node

# What about files?
myfile = node.myfile

# And even...
myfile = node.myfile.open('w')

# Or...
contents = node.myfile.read()  # ...which handles everything

# What if the filename contains a dot, dash, etc?
# Well...
myfile_node = node/'filename.with.dots-and-dashes'

# And then do your stuff on myfile_node
with myfile_node.open('r') as f:
    ...

# Or again...
contents = myfile_node.read()

Another useful feature of Pyerarchy is very handy in Python modules to interact with static files included in the module:

static_data_node = ThisModuleNode()/'path/to/the/static/data/relative/to/module'

some_file_node = static_data_node/'some/static/text/file'

contents = some_file_node.read()

Release files for pyerarchy 0.1

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

Source distribution (sdist)

Source distribution for pyerarchy 0.1
File Size Uploaded
pyerarchy-0.1.tar.gz 5.2 kB Details

Release files / pyerarchy-0.1.tar.gz

Download URL pyerarchy-0.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3b6a8a386908c7a6317c62bd828502032a62e5fd3b89cf4c2d6d3bd2a0292600
BLAKE2b-256 checksum
How to use checksums
1185589cae03e63cb2fd19bf975b07da36012e6389ba23306d608795dc72eefa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

0.0

1 release file

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