Skip to main content

No project description provided

Project description

sparrow-python

image image image image


Install

pip install sparrow-python
# Or dev version
pip install sparrow-python[dev]
# Or
pip install -e .
# Or
pip install -e .[dev]

Usage

Multiprocessing SyncManager

Open server first:

$ spr start-server

The defualt port 50001.

(Process1) productor:

from sparrow.multiprocess.client import Client

client = Client(port=50001)
client.update_dict({'a': 1, 'b': 2})

(Process2) consumer:

from sparrow.multiprocess.client import Client

client = Client(port=50001)
print(client.get_dict_data())

>> > {'a': 1, 'b': 2}

Common tools

  • Kill process by port
$ spr kill {port}
  • pack & unpack
    support archive format: "zip", "tar", "gztar", "bztar", or "xztar".
$ spr pack pack_dir
$ spr unpack filename extract_dir
  • Scaffold
$ spr create awosome-project

Some useful functions

sparrow.relp
Relative path, which is used to read or save files more easily.

sparrow.performance.MeasureTime
For measuring time (including gpu time)

sparrow.performance.get_process_memory
Get the memory size occupied by the process

sparrow.performance.get_virtual_memory
Get virtual machine memory information

sparrow.add_env_path
Add python environment variable (use relative file path)

Safe logger in multiprocessing

from sparrow.log import Logger
import numpy as np

logger = Logger(name='train-log', log_dir='./logs', )
logger.info("hello", "numpy:", np.arange(10))

logger2 = Logger.get_logger('train-log')
print(id(logger2) == id(logger))
>> > True

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

sparrow_python-0.1.10.tar.gz (843.1 kB view details)

Uploaded Source

Built Distribution

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

sparrow_python-0.1.10-py3-none-any.whl (876.2 kB view details)

Uploaded Python 3

File details

Details for the file sparrow_python-0.1.10.tar.gz.

File metadata

  • Download URL: sparrow_python-0.1.10.tar.gz
  • Upload date:
  • Size: 843.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for sparrow_python-0.1.10.tar.gz
Algorithm Hash digest
SHA256 4e98e4326141a195b035646c12bbaf72cd9dd1deaa22f14a9fff392657bb541d
MD5 2772de203fecf1254443f267a35ff14c
BLAKE2b-256 ac3f01508a8c8699f04d4c1b7b88800ac29094ef990be97c9d9214c9c927243e

See more details on using hashes here.

File details

Details for the file sparrow_python-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for sparrow_python-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 d2fd357b96fafe95f4e5f3c4ea289b821d03bab74571720783b7be09c80908e6
MD5 ffc76d2e4b6d1f9d4a0410c34d0f6327
BLAKE2b-256 7cb9e6f33ef6538ce3071bcecfec2256cef24281e1da1b0c2f0cf06976811526

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