Install & Compatibility
Where this runs
tested against v1.6.0 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
convert
✓ import csv2md
✗ from csv2md import convert
This quickstart demonstrates both command-line and programmatic usage. It creates a temporary CSV file and then uses `csv2md` to convert it. For CLI usage, ensure `csv2md` is installed and in your system's PATH. For programmatic use, the `convert` function expects a file-like object (e.g., `io.StringIO`).
import os
import subprocess
import tempfile
import io
# 1. Create a dummy CSV file for demonstration
csv_content = """Name,Age,City
Alice,30,New York
Bob,24,London
Charlie,22,"San Francisco|CA""" # Includes a pipe for testing escaping
csv_file_path = None
try:
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix=".csv", encoding="utf-8") as temp_csv_file:
csv_file_path = temp_csv_file.name
temp_csv_file.write(csv_content)
temp_csv_file.flush() # Ensure content is written to disk
print(f"--- CLI Usage (requires csv2md installed): {csv_file_path} ---")
# This will only work if csv2md is installed and in PATH
try:
# Check if csv2md command is available
subprocess.run(["csv2md", "--version"], capture_output=True, check=True)
cmd_output = subprocess.run(
["csv2md", "--", csv_file_path], # Use -- to separate options from filename
capture_output=True, text=True, check=True, encoding="utf-8"
)
print(cmd_output.stdout.strip())
except FileNotFoundError:
print("Skipping CLI example: 'csv2md' command not found. Please 'pip install csv2md'.")
except subprocess.CalledProcessError as e:
print(f"CLI Error: {e.stderr.strip()}")
print(f"Output: {e.stdout.strip()}")
print("\n--- Programmatic Usage (importing convert function) ---")
try:
from csv2md import convert
# The 'convert' function expects a file-like object.
input_stream = io.StringIO(csv_content)
markdown_output = convert(input_stream)
print(markdown_output.strip())
except ImportError:
print("Error: 'csv2md' library not found. Please 'pip install csv2md'.")
except Exception as e:
print(f"Programmatic Error: {e}")
finally:
if csv_file_path and os.path.exists(csv_file_path):
os.remove(csv_file_path)
print(f"\nCleaned up temporary CSV: {csv_file_path}")
csv2md --version
Upgrade
Version history
1.6.0latest on PyPI · released Apr 25, 2026
Audit
Dependencies
No dependency data recorded yet.