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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01ed35f08b83e6b4513d4c9f6cca625cf39e1bffd03586a2ec37b55522154a84
|
|
| MD5 |
6230ae2d9375b0ce9368be13888c421e
|
|
| BLAKE2b-256 |
e6010790f2db4aef38e5ab511ba14cb49a0bdfbf752c836f6c3bf1ab3704892a
|
File details
Details for the file python_code_splitter-0.2.2-py3-none-any.whl.
File metadata
- Download URL: python_code_splitter-0.2.2-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91f65d15ae09969a50dd05a3a347c133cd1d6e53d968147cde3fed3913e17bd1
|
|
| MD5 |
ccf500ed3bec102238b10a08b45d8580
|
|
| BLAKE2b-256 |
bcabcc71261467fed388145f95d4f4979476092402478610e8ecda51cd0c6160
|