merge functions from other python files
Project description
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
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
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
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
merge_functions-0.0.4.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file merge_functions-0.0.4.tar.gz
.
File metadata
- Download URL: merge_functions-0.0.4.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.9.7 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3df436ec5cbc4a587e5f391e1ba5bc98265464fcf4dbe939ef1aa81a68ab8114 |
|
MD5 | b102b68e8d040e4fb800fa7c874cf021 |
|
BLAKE2b-256 | 8576202889d9f31194801e6895ca7aef56829603b8a3a8a09aff5d705851466d |
File details
Details for the file merge_functions-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: merge_functions-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.9.7 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4a97f22c3dca32b01057cae393f25c62a131b6a2326f79d202dfbd4341020ae |
|
MD5 | b6fa3195d94d9b89043a23605d5d8e30 |
|
BLAKE2b-256 | b04fba09753464cc617b7b49615db0b8d20f2f7a973b5630e08c0bbc74c054c1 |