Skip to main content

split Python code by classes and functions

Project description

python-code-splitter

A tool to split Python code by classes and functions.

Install

pip install python-code-splitter

Usage

python-code-splitter path/to/file.py

Class and function definitions are extracted from the target file and written into separate new files (including decorators and comments). The new file name will be {class name or function name converted to snake_case}.py. The remaining content of the target file is moved to __init__.py. Necessary import statements are added to the top of each file.

The command has a --git option.

python-code-splitter path/to/file.py --git

It automatically creates a git branch based on the target file path, and commits in review-friendly units.

You can also use the --targets option to move only classes or functions.

python-code-splitter path/to/file.py --targets class

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_code_splitter-0.2.2.tar.gz (40.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_code_splitter-0.2.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file python_code_splitter-0.2.2.tar.gz.

File metadata

  • Download URL: python_code_splitter-0.2.2.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for python_code_splitter-0.2.2.tar.gz
Algorithm Hash digest
SHA256 01ed35f08b83e6b4513d4c9f6cca625cf39e1bffd03586a2ec37b55522154a84
MD5 6230ae2d9375b0ce9368be13888c421e
BLAKE2b-256 e6010790f2db4aef38e5ab511ba14cb49a0bdfbf752c836f6c3bf1ab3704892a

See more details on using hashes here.

File details

Details for the file python_code_splitter-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_code_splitter-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 91f65d15ae09969a50dd05a3a347c133cd1d6e53d968147cde3fed3913e17bd1
MD5 ccf500ed3bec102238b10a08b45d8580
BLAKE2b-256 bcabcc71261467fed388145f95d4f4979476092402478610e8ecda51cd0c6160

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page