pyseq


Namepyseq JSON
Version 0.8.0 PyPI version JSON
download
home_pagehttp://github.com/rsgalloway/pyseq
SummaryCompressed File Sequence String Module
upload_time2024-10-12 03:07:08
maintainerNone
docs_urlhttps://pythonhosted.org/pyseq/
authorRyan Galloway
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PySeq
=====

PySeq is a python module that finds groups of items that follow a naming convention containing 
a numerical sequence index (e.g. fileA.001.png, fileA.002.png, fileA.003.png...) and serializes
them into a compressed sequence string representing the entire sequence (e.g. fileA.1-3.png). It 
should work regardless of where the numerical sequence index is embedded in the name. For examples,
see basic usage below or http://rsgalloway.github.io/pyseq

Installation
------------

The easiest way to install pyseq:

```bash
$ pip install pyseq
```

Basic Usage
-----------

Using the "z1" file sequence example in the "tests" directory, we start by listing the directory
contents using `ls`:

```bash
$ ls tests/files/z1*
tests/files/z1_001_v1.1.png  tests/files/z1_001_v1.4.png  tests/files/z1_002_v1.3.png   tests/files/z1_002_v2.11.png
tests/files/z1_001_v1.2.png  tests/files/z1_002_v1.1.png  tests/files/z1_002_v1.4.png   tests/files/z1_002_v2.12.png
tests/files/z1_001_v1.3.png  tests/files/z1_002_v1.2.png  tests/files/z1_002_v2.10.png  tests/files/z1_002_v2.9.png
```

Now we list the same directory contents using `lss`, which will find the sequences and display them
in the default compressed format:

```bash
$ lss tests/files/z1*
   4 z1_001_v1.%d.png [1-4]
   4 z1_002_v1.%d.png [1-4]
   4 z1_002_v2.%d.png [9-12]
```

With a custom format:

```bash
$ lss tests/files/z1* -f "%h%r%t"
z1_001_v1.1-4.png
z1_002_v1.1-4.png
z1_002_v2.9-12.png
```

Recursive:

```bash
$ lss -r tests
tests
├── test_pyseq.py
└── files
    ├── 012_vb_110_v001.1-10.png
    ├── 012_vb_110_v002.1-10.png
    ├── a.1-14.tga
    ├── alpha.txt
    ├── bnc01_TinkSO_tx_0_ty_0.101-105.tif
    ├── bnc01_TinkSO_tx_0_ty_1.101-105.tif
    ├── bnc01_TinkSO_tx_1_ty_0.101-105.tif
    ├── bnc01_TinkSO_tx_1_ty_1.101-105.tif
    ├── file.1-2.tif
    ├── file.info.03.rgb
    ├── file01.1-4.j2k
    ├── file01_40-43.rgb
    ├── file02_44-47.rgb
    ├── file1-4.03.rgb
    ├── fileA.1-3.jpg
    ├── fileA.1-3.png
    ├── file_02.tif
    ├── z1_001_v1.1-4.png
    ├── z1_002_v1.1-4.png
    └── z1_002_v2.9-12.png
```


API Examples
------------

Compression, or serialization, of lists of items:

```python
>>> s = Sequence(['file.0001.jpg', 'file.0002.jpg', 'file.0003.jpg'])
>>> print(s)
file.1-3.jpg
>>> s.append('file.0006.jpg')
>>> print(s.format("%h%p%t %R"))
file.%04d.jpg [1-3, 6]
```

Uncompression, or deserialization, of compressed sequences strings:

```python
>>> s = uncompress('./tests/012_vb_110_v001.%04d.png 1-1001', fmt='%h%p%t %r')
>>> len(s)
1001
>>> print(s.format('%04l %h%p%t %R'))
1001 012_vb_110_v001.%04d.png [1-1001]
```

Testing
-------

To run the unit tests, simply run `pytest` in a shell:

```bash
$ pytest
```

Or if you don't have `pytest`, you can run:

```bash
$ python tests/test_pyseq.py
```
            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/rsgalloway/pyseq",
    "name": "pyseq",
    "maintainer": null,
    "docs_url": "https://pythonhosted.org/pyseq/",
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ryan Galloway",
    "author_email": "ryan@rsgalloway.com",
    "download_url": "https://files.pythonhosted.org/packages/f0/ea/e37720141ca2ad1a54ba19353382b0ea8447c517edffd0563c41cd5d6f00/pyseq-0.8.0.tar.gz",
    "platform": null,
    "description": "PySeq\n=====\n\nPySeq is a python module that finds groups of items that follow a naming convention containing \na numerical sequence index (e.g. fileA.001.png, fileA.002.png, fileA.003.png...) and serializes\nthem into a compressed sequence string representing the entire sequence (e.g. fileA.1-3.png). It \nshould work regardless of where the numerical sequence index is embedded in the name. For examples,\nsee basic usage below or http://rsgalloway.github.io/pyseq\n\nInstallation\n------------\n\nThe easiest way to install pyseq:\n\n```bash\n$ pip install pyseq\n```\n\nBasic Usage\n-----------\n\nUsing the \"z1\" file sequence example in the \"tests\" directory, we start by listing the directory\ncontents using `ls`:\n\n```bash\n$ ls tests/files/z1*\ntests/files/z1_001_v1.1.png  tests/files/z1_001_v1.4.png  tests/files/z1_002_v1.3.png   tests/files/z1_002_v2.11.png\ntests/files/z1_001_v1.2.png  tests/files/z1_002_v1.1.png  tests/files/z1_002_v1.4.png   tests/files/z1_002_v2.12.png\ntests/files/z1_001_v1.3.png  tests/files/z1_002_v1.2.png  tests/files/z1_002_v2.10.png  tests/files/z1_002_v2.9.png\n```\n\nNow we list the same directory contents using `lss`, which will find the sequences and display them\nin the default compressed format:\n\n```bash\n$ lss tests/files/z1*\n   4 z1_001_v1.%d.png [1-4]\n   4 z1_002_v1.%d.png [1-4]\n   4 z1_002_v2.%d.png [9-12]\n```\n\nWith a custom format:\n\n```bash\n$ lss tests/files/z1* -f \"%h%r%t\"\nz1_001_v1.1-4.png\nz1_002_v1.1-4.png\nz1_002_v2.9-12.png\n```\n\nRecursive:\n\n```bash\n$ lss -r tests\ntests\n\u251c\u2500\u2500 test_pyseq.py\n\u2514\u2500\u2500 files\n    \u251c\u2500\u2500 012_vb_110_v001.1-10.png\n    \u251c\u2500\u2500 012_vb_110_v002.1-10.png\n    \u251c\u2500\u2500 a.1-14.tga\n    \u251c\u2500\u2500 alpha.txt\n    \u251c\u2500\u2500 bnc01_TinkSO_tx_0_ty_0.101-105.tif\n    \u251c\u2500\u2500 bnc01_TinkSO_tx_0_ty_1.101-105.tif\n    \u251c\u2500\u2500 bnc01_TinkSO_tx_1_ty_0.101-105.tif\n    \u251c\u2500\u2500 bnc01_TinkSO_tx_1_ty_1.101-105.tif\n    \u251c\u2500\u2500 file.1-2.tif\n    \u251c\u2500\u2500 file.info.03.rgb\n    \u251c\u2500\u2500 file01.1-4.j2k\n    \u251c\u2500\u2500 file01_40-43.rgb\n    \u251c\u2500\u2500 file02_44-47.rgb\n    \u251c\u2500\u2500 file1-4.03.rgb\n    \u251c\u2500\u2500 fileA.1-3.jpg\n    \u251c\u2500\u2500 fileA.1-3.png\n    \u251c\u2500\u2500 file_02.tif\n    \u251c\u2500\u2500 z1_001_v1.1-4.png\n    \u251c\u2500\u2500 z1_002_v1.1-4.png\n    \u2514\u2500\u2500 z1_002_v2.9-12.png\n```\n\n\nAPI Examples\n------------\n\nCompression, or serialization, of lists of items:\n\n```python\n>>> s = Sequence(['file.0001.jpg', 'file.0002.jpg', 'file.0003.jpg'])\n>>> print(s)\nfile.1-3.jpg\n>>> s.append('file.0006.jpg')\n>>> print(s.format(\"%h%p%t %R\"))\nfile.%04d.jpg [1-3, 6]\n```\n\nUncompression, or deserialization, of compressed sequences strings:\n\n```python\n>>> s = uncompress('./tests/012_vb_110_v001.%04d.png 1-1001', fmt='%h%p%t %r')\n>>> len(s)\n1001\n>>> print(s.format('%04l %h%p%t %R'))\n1001 012_vb_110_v001.%04d.png [1-1001]\n```\n\nTesting\n-------\n\nTo run the unit tests, simply run `pytest` in a shell:\n\n```bash\n$ pytest\n```\n\nOr if you don't have `pytest`, you can run:\n\n```bash\n$ python tests/test_pyseq.py\n```",
    "bugtrack_url": null,
    "license": null,
    "summary": "Compressed File Sequence String Module",
    "version": "0.8.0",
    "project_urls": {
        "Homepage": "http://github.com/rsgalloway/pyseq"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f0eae37720141ca2ad1a54ba19353382b0ea8447c517edffd0563c41cd5d6f00",
                "md5": "60223152ce30d4f3f3af19646d31da4b",
                "sha256": "acaa89be360e373103d7fd45f1c2e36cdd19db3fa7743081ac6861a33f316259"
            },
            "downloads": -1,
            "filename": "pyseq-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "60223152ce30d4f3f3af19646d31da4b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 15747,
            "upload_time": "2024-10-12T03:07:08",
            "upload_time_iso_8601": "2024-10-12T03:07:08.094907Z",
            "url": "https://files.pythonhosted.org/packages/f0/ea/e37720141ca2ad1a54ba19353382b0ea8447c517edffd0563c41cd5d6f00/pyseq-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-12 03:07:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rsgalloway",
    "github_project": "pyseq",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyseq"
}
        
Elapsed time: 0.35138s