Skip to main content

A pathlib-like library for working with file sequences.

Project description

Documentation Github Build Status PyPI Version Supported Python Versions

A pathlib-first library for working with path sequences.

  • Multi-dimension ranges (e.g. animated udims)

  • pathlib-first API

  • Support for UDIM tokens

Getting Started

The following section demonstrates how to install pathseq and some basic usage. Full documentation is available here: https://pathseq.readthedocs.io/en/latest/

Installation

pathseq can be installed from PyPI:

pip install pathseq

Usage

For more detailed usage, see the documentation: https://pathseq.readthedocs.io/en/latest/

Now, let’s get started:

>>> from pathseq import PathSequence
>>> seq = PathSequence("tests/fixtures/simple/images.1-5####.exr")
>>> for path in seq:
...     path
...
PosixPath('tests/fixtures/simple/images.0001.exr')
PosixPath('tests/fixtures/simple/images.0002.exr')
PosixPath('tests/fixtures/simple/images.0003.exr')
PosixPath('tests/fixtures/simple/images.0004.exr')
PosixPath('tests/fixtures/simple/images.0005.exr')

>>> seq = PathSequence("tests/fixtures/simple/images.1-5####.exr")
>>> for path in seq:
...     path.touch(exist_ok=True)
...
>>> seq2 = PathSequence("tests/fixtures/simple/images.####.exr")
>>> for path in seq2.iter_existing_paths():
...    path
...
PosixPath('tests/fixtures/simple/images.0001.exr')
PosixPath('tests/fixtures/simple/images.0002.exr')
PosixPath('tests/fixtures/simple/images.0003.exr')
PosixPath('tests/fixtures/simple/images.0004.exr')
PosixPath('tests/fixtures/simple/images.0005.exr')

>>> seq = PathSequence("tests/fixtures/simple/images.1-5####.exr")
>>> seq.parent
PosixPath('tests/fixtures/simple')
>>> seq.parent / PathSequence("images.1-5####.exr")
... PathSequence("tests/fixtures/simple/images.1-5####.exr")

>>> anim_udims = PathSequence("/path/to/textures.1011-1012<UDIM>_1-3#.tex")
>>> for path in anim_udims:
...     path
...
PosixPath('/path/to/textures.1011_1.tex')
PosixPath('/path/to/textures.1011_2.tex')
PosixPath('/path/to/textures.1011_3.tex')
PosixPath('/path/to/textures.1012_1.tex')
PosixPath('/path/to/textures.1012_2.tex')
PosixPath('/path/to/textures.1012_3.tex')

A wide range of sequence string formats are supported:

>>> from pathseq import LoosePathSequence
>>> seq = LoosePathSequence("/path/to/images.1-5####.exr")

>>> seq = LoosePathSequence("/path/to/1-5####_images.exr")
>>> seq[0]
PosixPath('/path/to/0001_images.exr')
>>> seq.suffixes
('.exr',)

>>> LoosePathSequence("/path/to/1-5####_archives.tar.gz").suffixes
('.tar', '.gz')

>>> seq = LoosePathSequence("/path/to/images.exr.1-5####")
>>> seq[0]
PosixPath('/path/to/images.exr.0001')
>>> seq.suffixes
('.exr',)

>>> LoosePathSequence("/path/to/images.1001-1005<UDIM>.exr")[0]
PosixPath('/path/to/images.1001.exr')

>>> LoosePathSequence("/path/to/images.1001-1005<UVTILE>.exr")[0]
PosixPath('/path/to/images.u1_v1.exr')

Contributing

Running the tests

Tests are executed through tox.

tox

Code Style

Code is formatted using ruff.

You can check your formatting using ruff’s check mode:

tox -e format

You can also get ruff to format your changes for you:

tox -e autoformat

Release Notes

Release notes are managed through towncrier. When making a pull request you will need to create a news fragment to document your change:

tox -e release_notes -- create --help

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License. See the LICENSE.rst file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pathseq-1.0.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

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

pathseq-1.0.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file pathseq-1.0.0.tar.gz.

File metadata

  • Download URL: pathseq-1.0.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pathseq-1.0.0.tar.gz
Algorithm Hash digest
SHA256 23dee08a5d8af811a693a0fce300db8d196df287d85c2e007abfbe858afe8f56
MD5 b2e8ecedb9a111b124a3e8c4d054f68b
BLAKE2b-256 b1e078c16fd6de158abd348bf14006b342d0bc0059d97f5b2ee37de6deccbc3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pathseq-1.0.0.tar.gz:

Publisher: release.yml on AWhetter/pathseq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pathseq-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pathseq-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pathseq-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2488f464db3bc5b80865e0b0c1dfd74501a67bd71acaa64094f24dcc838ddcee
MD5 3a7c2eebd9200998d8dc383fb76cb058
BLAKE2b-256 7d0ac63945f25ae64554e593502c79241971c3b23860a9cbb8947b76c1b5c5a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pathseq-1.0.0-py3-none-any.whl:

Publisher: release.yml on AWhetter/pathseq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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