Skip to main content

Deploy Tools

Project description

remote_run_everthing 各类实用代码集合封装

安装

 pip install -U --index-url https://test.pypi.org/simple/ remote_run_everything

运维功能

# 服务端代码
from remote_run_everything import cherrypy_in_daemon,ByHttpServer
cherrypy_in_daemon(ByHttpServer,8888,"/deploy")

# 上推代码
from remote_run_everything import ByHttp ,BySftp
def test_up():
    host = "http://x.x.x.x:8888/deploy"
    local = "D://project/demand/shop"
    remote = "/data/mypy/shop"
    db = "D://wq/temp/shop.db"
    bh = ByHttp(host, local, remote, db)
    bh.up(['node_modules', ".pyc", ".idea"])
def test_up2():
    host = "http://x.x.x.x:8888/deploy"
    local = "D://project/demand/shop"
    remote = "/data/mypy/shop"
    db = "D://wq/temp/shop.db"
    by=BySftp(host,22,'root','pwd',local,remote,db)
    by.up(['node_modules', ".pyc", ".idea", ".pdf", ".docx", ".pickle", ".png", ".jpg",".venv","target","dist","build"])

# 下拉代码
def test_down():
    host = "http://x.x.x.x:8888/deploy"
    local = "D://project/demand/shop"
    remote = "/data/mypy/shop"
    db = "D://wq/temp/shop.db"
    bh = ByHttp(host, local, remote, db)
    bh.down(['node_modules', ".pyc", ".idea"])

缓存功能

from remote_run_everything import cache_by_1starg,cache_by_name,cache_by_rkey 
@cache_by_name("asdf", 1)
def test1():
    print("运行了函数!!!!!!!!!!!!!!!!")
    return {"a": "adaf"}
@cache_by_1starg("asdf", 1)
def test2(arg1):
    print("运行了函数!!!!!!!!!!!!!!!!")
    return {"a": "adaf"}
@cache_by_rkey(1)
def test2(rkey="xx"):
    print("运行了函数!!!!!!!!!!!!!!!!")
    return {"a": "adaf"}

KV数据库

from remote_run_everything import KvStore
kv = KvStore('test.db') 
print(len(kv))         
kv['hello1'] = 'you1'
del kv['hello1']
print(len(kv))        
print('hello1' in kv) 
kv['hello3'] = 'newvalue'
print(kv.keys())        
print(kv.values())     
print(kv.items())     
for k in kv:
    print(k, kv[k])

Mongodb like 数据库

from remote_run_everything import Nosql,NosqlPg,NosqlMysql
db = Nosql()
t = "test"
col = db['test']
dic = {"a": 2, "b": 456, 'c': "adf", "d": "2020-02-02"}
col.insert_one(dic)
dic = {"a": 56, "b": 456, 'c': "adf", "d": "2020-07-02"}
col.insert_one(dic)
q = {"a": 2,"b":{"$gt":1}}
print(col.find(q))
db.drop_db()

缓存装饰器

from remote_run_everything import cache_by_1starg,cache_by_name,cache_by_rkey,cache_by_nth_arg
@cache_by_name("asdf", 1)
def test_dec():
    print("运行了函数!!!!!!!!!!!!!!!!")
    return {"a": "adaf"}

关系型 数据库

from remote_run_everything import Crud,CrudeDuck
# 详情参见类方法

双目测距

from remote_run_everything.binocular.relative_pos import RelativePos,CamTool
import numpy as np
unit=0.006240084611316764
l=[[3838.36767578125, 50.56350326538086], [2636.24072265625, 88.38832092285156], [511.72705078125, 95.95327758789062], [2303.57666015625, 107.30072784423828], [2159.92626953125, 111.08320617675781], [2001.15478515625, 114.86569213867188], ]
r=[[3743.86083984375, 31.651092529296875], [2424.54541015625, 65.69342803955078], [231.98681640625, 69.47590637207031], [2076.76025390625, 84.6058349609375], [1921.76904296875, 88.38832092285156], [1759.21728515625, 92.1707992553711]]
l=np.array(l)
r=np.array(r)
path="./nik_insinc.txt"
dic = RelativePos(path,path,unit,unit).rel_one(l, r)
print (dic)

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

remote_run_everything-2.1.7.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.

remote_run_everything-2.1.7-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

Details for the file remote_run_everything-2.1.7.tar.gz.

File metadata

  • Download URL: remote_run_everything-2.1.7.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for remote_run_everything-2.1.7.tar.gz
Algorithm Hash digest
SHA256 7e5e38d8430b725de4e92f97f66f6140462732c2f7d62eb38d2ae678a5ec2336
MD5 bb418e4968984cbe4996aed253441d38
BLAKE2b-256 1f40945b6dcbb88d25739d67f96f8733bb634d74a1bde2dc210af836e943a1a8

See more details on using hashes here.

File details

Details for the file remote_run_everything-2.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for remote_run_everything-2.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e2d4dc3c2c84fe4256f49f696cb177f7069416d293240a4e4ee414513c44cd8a
MD5 b4439c0878ee362058a7e48b716373c4
BLAKE2b-256 7970f30f76eab4a1cfe50a5f443c47b9c287bdbe968c7c3bd4d57bcb8320588b

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