Registry / devops / unify
library0.5pypypi✓ verified 81d ago

Unify is a Python command-line tool designed to standardize string literal quoting within Python source files. It modifies strings to consistently use either single or double quotes where possible, configurable by the user. The current version is 0.5, released on August 7, 2019, and its release cadence is infrequent as it's a mature, focused utility.

pip install unify
INSTALL
IMPORT
SIG · UNIFY
U
unify
devopspythonv0.5
Install
3.1s avg
Import
15ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.015s · 19.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.1s · import 0.014s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

format_code
from unify import format_code
import subprocess
format_file
from unify import format_file
import subprocess
unify_quotes
from unify import unify_quotes
import subprocess

This quickstart demonstrates how to use the `unify` CLI tool programmatically via Python's `subprocess` module to standardize string quotes in a file. It first creates a sample Python file, applies `unify` to enforce single quotes, then reapplies it to enforce double quotes, and finally cleans up the temporary file.

import subprocess import os # Create a dummy Python file for demonstration file_content = """x = \"abc\" y = 'hello' z = \"world\"""" with open('example.py', 'w') as f: f.write(file_content) print('Original content of example.py:') with open('example.py', 'r') as f: print(f.read()) # Run unify to enforce single quotes in-place try: # Using --quote ' to enforce single quotes result = subprocess.run(['unify', '--in-place', '--quote', "'", 'example.py'], capture_output=True, text=True, check=True) print('\nUnify output:', result.stdout) if result.stderr: print('Unify errors:', result.stderr) print('\nContent of example.py after unify (single quotes):') with open('example.py', 'r') as f: print(f.read()) # Run unify again to enforce double quotes in-place result = subprocess.run(['unify', '--in-place', '--quote', '"', 'example.py'], capture_output=True, text=True, check=True) print('\nUnify output:', result.stdout) if result.stderr: print('Unify errors:', result.stderr) print('\nContent of example.py after unify (double quotes):') with open('example.py', 'r') as f: print(f.read()) except subprocess.CalledProcessError as e: print(f"Error running unify: {e.stderr}") except FileNotFoundError: print("Error: 'unify' command not found. Make sure it's installed and in your PATH.") finally: # Clean up the dummy file if os.path.exists('example.py'): os.remove('example.py') print('\nCleaned up example.py')
unify --version
Debug
Known issues
gotchaThe `unify` library is primarily a command-line tool. While you can invoke it from Python using `subprocess`, it does not offer a direct, high-level Python API for manipulating strings or files in memory, unlike some other formatting tools.
fix
Use `subprocess.run()` to interact with the `unify` command-line tool from Python scripts.
affects: 0.1 - 0.5
breakingWhen using the `--in-place` flag, `unify` modifies files directly without creating backups. Accidental or unintended changes can lead to data loss if not managed carefully.
fix
Always commit your code to version control (e.g., Git) before running `unify --in-place`, or use a separate script to create backups of files before processing them. Consider using `unify` without `--in-place` and reviewing the output before applying.
affects: 0.1 - 0.5
gotchaDue to its generic name, `unify` can be confused with other Python packages such as `unifyai`, `unifi`, `unificontrol`, `python-unifi-client`, or `unifi-python-api`. Ensure you are installing and using `myint/unify` if your intention is string quote unification.
fix
Verify the PyPI page (pypi.org/project/unify) and GitHub repository (github.com/myint/unify) to confirm you are working with the correct project.
affects: All versions
Upgrade
Version history
0.5latest on PyPI · released Aug 7, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
unify — pip install unify · libregistry