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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.015s · 19.2MB
glibcpy 3.10–3.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
Upgrade
Version history
0.5latest on PyPI · released Aug 7, 2019
Audit
Dependencies
No dependency data recorded yet.