Skip to main content

py-subconverter

Python-based proxy subscription converter for Clash. Convert proxy subscriptions to Clash configuration format with full support for subconverter INI configurations.

Features

  • ✅ Convert proxy subscriptions to Clash YAML format
  • ✅ Support for Shadowsocks, VMess, Trojan, VLESS protocols
  • ✅ Full subconverter INI configuration support
  • ✅ Custom proxy groups with regex matching
  • ✅ Rule-based routing with automatic rule set downloading
  • ✅ Filter unsupported rule types automatically
  • ✅ No external services required - 100% local conversion

Installation

pip install py-subconverter

Quick Start

Command Line Usage

Basic conversion:

py-sub-conv --output config.yaml

With environment variables (.env file):

DLER_EMAIL=your@email.com
DLER_PASSWORD=yourpassword
RULE_URL=https://example.com/config.ini

Then run:

py-sub-conv --output config.yaml

Python API Usage

from py_subconverter import SubscriptionConverter

converter = SubscriptionConverter()

# Convert subscription
config = converter.convert(
    subscription_url="https://example.com/subscription",
    rule_url="https://example.com/config.ini",  # Optional INI config
    output_file="config.yaml"
)

Supported Rule Types

py-subconverter automatically filters rules to only include types supported by standard Clash:

  • ✅ DOMAIN - Match exact domain
  • ✅ DOMAIN-SUFFIX - Match domain suffix
  • ✅ DOMAIN-KEYWORD - Match domain keyword
  • ✅ IP-CIDR - Match IPv4 CIDR
  • ✅ IP-CIDR6 - Match IPv6 CIDR
  • ✅ GEOIP - Match GeoIP database
  • ✅ MATCH - Match all (final rule)
  • ✅ PROCESS-NAME - Match process name

Automatically filtered (Clash Meta only):

  • ❌ USER-AGENT
  • ❌ URL-REGEX

INI Configuration Support

py-subconverter fully supports subconverter INI format:

[custom]
ruleset=🎯 Direct,https://example.com/rules/direct.list
ruleset=🚀 Proxy,https://example.com/rules/proxy.list
ruleset=🐟 Final,[]MATCH

custom_proxy_group=🚀 Proxy`select`[]♻️ Auto`[]🇭🇰 HK`[]DIRECT
custom_proxy_group=♻️ Auto`url-test`.*`http://www.gstatic.com/generate_204`300
custom_proxy_group=🇭🇰 HK`url-test`香港|HK`http://www.gstatic.com/generate_204`300

CLI Options

py-sub-conv [OPTIONS]

Options:
  -o, --output FILE         Output YAML file path (default: config.yaml)
  -s, --subscription URL    Subscription URL (overrides .env)
  -r, --rule URL           Custom rule URL (overrides .env)
  -v, --verbose            Show detailed conversion process
  -h, --help               Show this help message

Development

Setup Development Environment

git clone https://github.com/gencylee/py-subconverter.git
cd py-subconverter

# Install in development mode
pip install -e ".[dev]"

Run Tests

pytest

Build Package

python -m build

Differences from Original Subconverter

py-subconverter is a pure Python implementation that:

  1. No External Services - All conversion is done locally
  2. Better Performance - Direct Python implementation without HTTP overhead
  3. Rule Filtering - Automatically filters unsupported rule types
  4. Modern Python - Clean, maintainable codebase with type hints

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for subconverter-py 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for subconverter-py 0.1.2
File Size Uploaded
subconverter_py-0.1.2.tar.gz 28.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for subconverter-py 0.1.2
File Interpreter ABI Platform
subconverter_py-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 57.8 kB

Release files / subconverter_py-0.1.2.tar.gz

Download URL subconverter_py-0.1.2.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c68f0d2a2724d461c4b80b812048f2a43dca5a1f7caaf27cfec3d90c8f1ceadc
BLAKE2b-256 checksum
How to use checksums
ffdfc5a04f9135f366dbc49276256f4b0eb1646f6459b02d574aae14de49b2b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / subconverter_py-0.1.2-py3-none-any.whl

Download URL subconverter_py-0.1.2-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07a37e8d54af19d8efc5499a8691d7089fe1d3703f7272703b754836949d00c4
BLAKE2b-256 checksum
How to use checksums
3a1c9538406bb28167ad04a34ca5dfaacf7d4dc7f1fe36d2227c9d7f25774fce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page