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.0.6.tar.gz (55.5 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.0.6-py3-none-any.whl (79.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparrow_python-0.0.6.tar.gz
  • Upload date:
  • Size: 55.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for sparrow_python-0.0.6.tar.gz
Algorithm Hash digest
SHA256 e5b8aa5ee81fdc087ca0a147c1d1ceab8a3778474440889f5d89703296519f32
MD5 1bffaf353ceb2755430b9cc5e9621c48
BLAKE2b-256 851ad6a27272759b7ca9ea8edbf4067db926a1af972321d9c877d9e390e218d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sparrow_python-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 79.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for sparrow_python-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 15956cfc1b7dc16b4e4d28b3b2c1a05a9c0607ebbb3e8f9d1e434d5a0e35a896
MD5 f98b48d1eb40565ef59d68309b90796c
BLAKE2b-256 3eacfd88d28f0bde9d75bd1eec5ece9dcc1371dcb477665fe00075dee3a06724

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