Skip to main content

autopaths is a python package for dealing with file paths and automation.

Project description

[![PyPI version](]( [![changelog](](

# autopaths version 1.2.6

autopaths is a python package for dealing with file paths and automation.

It contains several submodules that are useful when building pipelines. See below for examples and documentation.

# FilePath object

Here are a few example usages of this object:

from autopaths.file_path import FilePath f = FilePath(“input/raw/reads_56.fastq”) print(f.exists) print(f.extension) print(f.size) print(f.contains_binary) f.prepend(‘# This file was backed-upn’) f.gzip_to(‘backup/old_reads/reads_56.fastq’) f.move_to(f.parent) f.make_executable()

As you can see, once you have created a FilePath, many useful methods are available. No more need for long os.path or shutil commands of which you can never remember the syntax.

To see the complete list of utility methods and properties, look at the source code. You can find lots of the common things you would need to do with file paths f.make_executable() etc etc.

# DirectoryPath object

Similar to a file path object. Here is an example usage of this object:

from autopaths.dir_path import DirectoryPath d = DirectoryPath(“cleaned/reads/”) print(d.mod_time) d.create_if_not_exists() f = d + ‘new.fastq’

# AutoPaths object

You can use this class like this when making pipelines to quickly refer to a predefined file path with a simple attribute lookup. This example explains it:

class Sample(object):
all_paths = ‘’‘
/raw/raw.sff /raw/raw.fastq /clean/trim.fastq /clean/clean.fastq’‘’
def __init__(self, base_dir):
self.p = AutoPaths(base_dir, self.all_paths)
def clean(self):
shutil.move(self.p.raw_sff, self.p.clean_fastq)

Project details

Download files

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

Files for autopaths, version 1.2.6
Filename, size & hash File type Python version Upload date
autopaths-1.2.6.tar.gz (12.4 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page