Skip to main content

Comprehensive directory & file manager with backup/restore and FS tools for ESP32 running MicroPython

Project description

libraryManager

Comprehensive library manager for Python projects.
Supports directory backup & restore, and filesystem tools like create/remove folders, copy files/directories, list files, and get file names.


Installation

pip install libraryManager

Importing

from libraryManager import LibraryManager, BackupError, RestoreError

Initialize library manager for a target directory

lm = LibraryManager(target_dir="services", backup_root=".backup")

---------- Backup & Restore ----------

Check if backup exists

if lm.has_backup():
    print("Backup is available")

Clear backup

lm.clear_backup()

Create a snapshot backup

try:
    lm.backup()
except BackupError as e:
    print("Backup failed:", e)

Restore from backup

try:
    lm.restore()
except RestoreError as e:
    print("Restore failed:", e)

---------- Filesystem Tools ----------

Make directory (including parents)

lm.make_dir("services/new_folder")

Remove directory recursively

lm.remove_dir("services/old_folder")

Copy single file to a directory

lm.copy_file_to("example.txt", "services/new_folder")

Copy entire directory

lm.copy_dir_to("services/source", "services/destination")

List files in a directory

files = lm.list_files("services")
print(files)

Get filename from path

filename = lm.get_filename("/home/user/file.txt")
print(filename)  # "file.txt"

Get name without extension

name = lm.get_name("/home/user/file.txt")
print(name)  # "file"

Exceptions

  • BackupError → Raised when backup fails

  • RestoreError → Raised when restore fails

  • LibraryManagerError → Base exception for library manager

Documentation Summary

Method Description
__init__(target_dir, root="/", backup_root=".backup") Initialize LibraryManager
has_backup() Returns True if backup exists
clear_backup() Clears backup directory
backup() Create snapshot backup
restore() Restore snapshot
make_dir(path) Create folder recursively
remove_dir(path) Remove folder recursively
copy_file_to(src, dst) Copy file to destination folder
copy_dir_to(src, dst) Copy folder recursively
list_files(path) List files in folder
get_filename(path) Get file name from path
get_name(path) Get file/folder name without extension

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esp32_librarymanager-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

esp32_librarymanager-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file esp32_librarymanager-1.0.0.tar.gz.

File metadata

  • Download URL: esp32_librarymanager-1.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for esp32_librarymanager-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dd35b76d0bda10be05d57b070211490b3b25fda8c5b4cd82f239930c68cc0e44
MD5 8a325f77b12c45487cd53439790ff7c3
BLAKE2b-256 08e5b6870f5cccf53b2f259512660df0e3e83fe212f8d0532225031975fdada0

See more details on using hashes here.

File details

Details for the file esp32_librarymanager-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for esp32_librarymanager-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6411aa9600a85d629d67dfde2ab2bf07a11b82c8a4419813a86593703f30ba0b
MD5 5141501872a195f1736c888167be0bae
BLAKE2b-256 7b22bc883ef925466f9586daf4890c5fdd663fec13fe3c175ba6262967c2febc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page