Metadata-Version: 2.1
Name: merge-functions
Version: 0.0.4
Summary: merge functions from other python files
Home-page: https://github.com/idlewith/merge_functions
License: MIT
Author: idlewith
Author-email: newellzhou@163.com
Requires-Python: >=3.8,<4
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: black (==23.3.0)
Requires-Dist: isort (>=5.12.0,<6.0.0)
Description-Content-Type: text/markdown

# Merge functions from other python files

this is a dirty way to merge functions from other python files into one python file in order to deploy fast.


## install merge_functions

```
pip install merge_functions
```

## how to use

if you want to import from current directory python file, you need set environment:

if you current path is: `~/code` or `D:\code`

mac or linux: 

```
export PYTHONPATH=~/code
```

windows

```
set PYTHONPATH=D:\code
```

help info

```
mf -h
```

simple example: 

```
mf -i main.py -m demo
```

- -i: input file
- -m: modules or keywords in modules

**then, demo's functions will merge into `one.py`**

`main.py` below

```python
from demo import add, subtract, multiply, divide
import json


def run():
    a, b = 3, 4
    result1 = add(a, b)
    result2 = subtract(a, b)
    result3 = multiply(a, b)
    result4 = divide(a, b)
    result_dict = {
        "result1": result1,
        "result2": result2,
        "result3": result3,
        "result4": result4,
    }
    print(json.dumps(result_dict))


if __name__ == "__main__":
    run()

```

`demo.py` below

```python
def add(a, b):
    return a + b


def subtract(a, b):
    return a - b


def multiply(a, b):
    return a * b


def divide(a, b):
    return a / b if b else 0

```





