major changes

This commit is contained in:
2026-09-16 23:31:13 +05:30
parent 4e40263f69
commit ecb149971b
16 changed files with 500 additions and 117 deletions
+65
View File
@@ -0,0 +1,65 @@
---
title: Unique - Build from Source
---
# Unique - Build from Source
Open a terminal and change the active directory to the project root folder for `unique`.
Follow the given steps in order to create a clean Python sandbox, activate it, install the build
tool, and then use that tool to compile `unique` into distributable artifacts.
__Step 1: Create an isolated virtual environment.__
```sh
python3 -m venv .venv
```
The virtual environment is created in a folder called `.venv` under the project root folder. This
gives the project its own Python interpreter and package space, so dependencies don't conflict with
the system Python or other projects.
__Step 2: Activate the virtual environment.__
```sh
source .venv/bin/activate
```
Activation happens for the current shell session only. It prepends `.venv/bin/` to your `PATH`, so
`python` and `pip` now resolve to the environment's copies. Your prompt typically changes to show
`(.venv)`.
__Step 3: Install (or upgrade) the build package.__
```sh
pip install --upgrade build
```
The virtual environment now has the latest `build` package. `build` is the PyPA-recommended PEP 517
build frontend — it reads the project's `pyproject.toml`, sets up an isolated build environment, and
invokes the configured build backend (`setuptools`) to produce distribution artifacts.
__Step 4: Install unique.__
```sh
pip install -e .
```
This installs unique in editable mode. In the process, all required depedencies (`scott` and
`uuid6`) are also installed in the virtual environment.
__Step 5: Create a binary distributable.__
Firstly install `pyinstaller` in the virtual environment.
```sh
pip install pyinstaller
```
Then create the executable:
```sh
pyinstaller unique.spec
```
This creates an executable file named `unique` that is placed in `/dist` under project root folder.
+96
View File
@@ -0,0 +1,96 @@
---
title: Unique - Usage
---
# Using Unique
`Unique` is organized around a small set of commands. You can get a list of available commands by
invoking `unique` with help option.
```sh
$ ./unique -h
usage: unique [-h] {install,create,touch,retouch,duplicate} ...
Append a suffix to files and folders to ensure unique names
positional arguments:
{install,create,touch,retouch,duplicate}
install installs unique so that it can be used from the command line
create Create a new file or directory with a unique name
touch appends a prefix to the original file name to create a unique name
retouch
duplicate Creates an exact copy of a file, preserving its contents, but with an unique name
options:
-h, --help show this help message and exit
```
## Command: create
```sh
$ ./unique create -h
usage: unique create [-h] (-f | -d) [-m METHOD] PATH
positional arguments:
PATH The path to the file or directory to be created with a unique name
options:
-h, --help show this help message and exit
-f, --file Indicates that the target is a file
-d, --dir Indicates that the target is a folder
-m METHOD, --method METHOD
Select the method to generate the suffix:
'datetime' : Use the current date and time as a unique suffix
'epoch' : Use the timestamp (milliseconds since epoch) as a unique suffix
'uuid' : Use the v4 universally unique identifier as a unique suffix
'uuid7' : Use the v7 universally unique identifier as a unique suffix
'uuid-b36' : Use the base36 representation of a UUID as a unique suffix
'uuid7-b36' : Use the base36 representation of a UUID7 as a unique suffix
Default is 'datetime'.
```
## Command: touch
```sh
$ ./unique touch -h
usage: unique touch [-h] [-m METHOD] PATH
positional arguments:
PATH The path to the file or directory that needs a unique name
options:
-h, --help show this help message and exit
-m METHOD, --method METHOD
Select the method to generate the suffix:
'datetime' : Use the current date and time as a unique suffix
'epoch' : Use the timestamp (milliseconds since epoch) as a unique suffix
'uuid' : Use the v4 universally unique identifier as a unique suffix
'uuid7' : Use the v7 universally unique identifier as a unique suffix
'uuid-b36' : Use the base36 representation of a UUID as a unique suffix
'uuid7-b36' : Use the base36 representation of a UUID7 as a unique suffix
Default is 'datetime'.
```
## Command: duplicate
```sh
$ ./unique duplicate -h
usage: unique duplicate [-h] [-m METHOD] PATH
positional arguments:
PATH The path to the file or directory to be created with a unique name
options:
-h, --help show this help message and exit
-m METHOD, --method METHOD
Select the method to generate the suffix:
'datetime' : Use the current date and time as a unique suffix
'epoch' : Use the timestamp (milliseconds since epoch) as a unique suffix
'uuid' : Use the v4 universally unique identifier as a unique suffix
'uuid7' : Use the v7 universally unique identifier as a unique suffix
'uuid-b36' : Use the base36 representation of a UUID as a unique suffix
'uuid7-b36' : Use the base36 representation of a UUID7 as a unique suffix
Default is 'datetime'.
```