This release is a pre-release and may not be stable for production use.
PySnapShot
This is a tiny helper package for saving code associated with an experiment, and reloading it at a later time. There are two main functions:
pysnapshot.capture: Captures the code associated with a module into a snapshot at a given path.pysnapshot.load: Loads the code from the snapshot into a module of a specified name. If no name is given, then the module name is whatever the folder name is for the snapshot.
Usage
Let's say I'm working on the code in examples/hello_world.py. Let's save the current version
(working in the examples/ directory):
import pysnapshot
import hello_world
# First let's take a snapshot of the
# hello_world package.
path = pysnapshot.capture(hello_world, '/tmp/hello_world_snap/', overwrite=True)
hello_world_snap = pysnapshot.load(path)
print(hello_world_snap.__file__)
# The snapshot is loaded from the specified directory. The code was all copied to
# and is under the snapshot:
print("From original package code", hello_world.func1())
print("From snapshot", hello_world_snap.hello_world.func1())
# You can import from the snapshot as if it were a regular package
from hello_world_snap import hello_world
print("From snapshot, overwriting the original package code", hello_world.func1())
This has the output:
❯ cd examples/
❯ python demo.py
/private/tmp/hello_world_snap/__init__.py
/Users/prem/research/snapshot/examples/hello_world/hello.py TEST
From original package code TEST
/private/tmp/hello_world_snap/hello_world/hello.py TEST
From snapshot TEST
/private/tmp/hello_world_snap/hello_world/hello.py TEST
From snapshot, overwriting the original package code TEST
And it created a Python module with this directory structure:
❯ tree '/tmp/hello_world_snap/'
/tmp/hello_world_snap/
├── __init__.py
└── hello_world
├── __init__.py
├── hello.py
└── nested
└── __init__.py
Releasing
Do the following steps:
python setup.py sdist
Upload it to test PyPI:
pip install twine
twine upload --repository testpypi dist/*
pip install -U --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U pysnapshot
Make sure you can install it and it works (e.g. run the examples). Now upload to actual PyPI:
twine upload dist/*
Metadata
Release files for pysnapshot 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pysnapshot-0.1.0a0.tar.gz | 3.7 kB | Without provenance | Details for pysnapshot-0.1.0a0.tar.gz |
Release files / pysnapshot-0.1.0a0.tar.gz
| Download URL | pysnapshot-0.1.0a0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9273c5b1db2fed47bfd2883be3059b4f494e492dc08c2d61dcc62c6dfd0dea73
|
|
BLAKE2b-256 checksum How to use checksums |
8fe65610df037db5ba6620756fd025b17d5eb2740d74a2f3dbcec0f7839ae993
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
|
Security for pysnapshot 0.1.0a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.