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.2.3.1.tar.gz (847.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.2.3.1-py3-none-any.whl (881.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparrow_python-0.2.3.1.tar.gz
  • Upload date:
  • Size: 847.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for sparrow_python-0.2.3.1.tar.gz
Algorithm Hash digest
SHA256 2202dee3864baf6970d1b797fececa07add380a5fc85cc1fcc5c9a1a5eb337c4
MD5 dda39b501974d0709b796e328e7575ea
BLAKE2b-256 628ef6a5c5edb666b6ff706706083e87f6f93b70bf4df0e811051462a6da3ace

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sparrow_python-0.2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0dc642d73df03e02ac6dfb5e1d780be60c777ee1ab3553d5391a5cb55a7d04e9
MD5 912d0b0b9c6061543e215bba4f209768
BLAKE2b-256 af0fa32c74e28d616d72a935a36c0bfc9a5c19972dfaf71523175cc8ba8d4ff1

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