Applies tagging to organize files.
Project description
Taggit
A Python library for tagging files.
Author: Grant Savage
Installation
pip install pytaggit
Current Package Limitations
This package currently works on Mac OS X 10.9 and newer. It was developed on Mac OS X 12.2 There is currently no functionality for Linux or Windows.
Package Structure
taggit
| README.md
| LICENSE
| .gitignore
| poetry.lock
| pyproject.toml
|───taggit
| | __init__.py
| | taggit.py
|───tests
| | test_taggit_macOS.py
|───docs
| | Functional_Specs.md
| | Design_Specs.md
|───sample_folder
| | sample_file.txt
Tutorial
Add tag to file:
from pytaggit import tag_manager as tm
>> > file_location = "sample_folder/sample_file.txt"
# Add tag via Tag object
>> > tag = tm.Tag(name="green_tag", color="green")
>> > tm.add_tag(tag, file_location)
# Add tag via string
>> > tm.add_tag("blue_tag\nblue", file_location)
# Add colorless tag via string
>> > tm.add_tag("no_color_tag", file_location)
# Add tag via tuple
>> > tm.add_tag(("purple_tag", 'purple'), file_location)
# Add multiple tags via list of tuples
>> > red_list = [('first_red', 'red'), ('second_red', 'red')]
>> > tm.add_tag(red_list, file_location)
Return tags by file:
>>> tm.get_tags(file_location)
[Tag("blue_tag", "BLUE"), Tag("green_tag", "GREEN"), Tag("no_color_tag", "NONE"), Tag("purple_tag", "PURPLE"), Tag("first_red", "RED"), Tag("second_red", "RED")]
Remove tags from file:
# Remove tag via Tag object
>>> blue_tag = tm.Tag("blue_tag", "blue")
>>> tm.remove_tag(blue_tag, file_location)
# Remove tag via string
>>> tm.remove_tag("green_tag\ngreen", file_location)
# Remove colorless tag via string
>>> tm.remove_tag("no_color_tag", file_location)
# Remove tag via tuple
>>> tm.remove_tag(("purple_tag", "purple"), file_location)
# Remove multiple tags via list of tuples
>>> red_list = [('first_red', 'red'), ('second_red', 'red')]
>>> tm.remove_tag(red_list, file_location)
# Adding one tag back to show tags were removed
>>> tm.add_tag("new_tag", file_location)
>>> tm.get_tags(file_location)
[Tag("new_tag", "NONE")]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytaggit-1.0.0.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytaggit-1.0.0.tar.gz.
File metadata
- Download URL: pytaggit-1.0.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.11 Darwin/21.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67a5fc44f48ef9106c6da23c70a62978588c9100efb08e923ce862a6cfdb3bcf
|
|
| MD5 |
ed539475e77976e7d8cac76374957824
|
|
| BLAKE2b-256 |
c929dc4cc2529da86b53fb1e89630918bc139bc708367c03f9f42995f2d595dd
|
File details
Details for the file pytaggit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pytaggit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.11 Darwin/21.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8d97120201bab59a431a3fbfdd362fdb1fd3e4671ddaa81a42d5f6e96ebc2cd
|
|
| MD5 |
be271e68aa8982156201e8594db78b94
|
|
| BLAKE2b-256 |
f8e43e5ef3f273362dbcc1d054d3c2a4c5e562c290e4fc8d325848ab04115b6b
|