Skip to main content

Trawl - Another tool in the shed

This is as straight of a clone of Rake that I could come up with.

Briefly:

# Trawlfile
@task
def bar():
    print "BAR!"

Does as you might expect:

$ trawl -T
bar
$ trawl bar
** Execute bar
BAR

And with dependencies:

# Trawlfile
@task
def bar():
    print "BAR!"

@task([bar])
def foo():
    print "FOO!"

Also does what you’d expect:

$ trawl -T
bar
foo
$ trawl bar
** Execute bar
BAR!
$ trawl foo
** Execute bar
BAR!
** Execute foo
FOO!

Which is awesome sauce, but what about files?

# Trawlfile
@build("myfile.txt", recreate=False)
def run(task):
    with open(task.name) as out:
        out.write("MUNCTIONAL!")

@build("yup.cfg", ["myfile.txt"])
def more(task):
    with open(task.name) as out:
        with open(task.source) as src:
            out.write(src.read() + "!!!1!")

Will cause “myfile.txt” to be created but not overwritten if it exists. “yup.cfg” will then only be rebuilt when “myfile.txt” changes as determined by the file’s mtime:

$ trawl yup.cfg
** Execute myfile.txt
** Execute yup.cfg
$ trawl yup.cfg
$

The last major bit is in defining rules:

@rule('.o', '.c'):
def compile(task):
    subprocess.check_call(["gcc", "-o", task.name, "-c", task.source])

objects = FileList("*.c").sub(".c$", ".o")
@build("appname", objects)
def link(task):
    subprocess.check_call(["gcc", "-o", task.name] + task.sources)

# Add a helpful handle for running
task("run", ["appname"])

TODO

Some things that need to be done yet:

  • Task descriptions

  • Argument support

  • Test and add methods to FileList

  • Add a function to import tasks programatically

Release files for Trawl 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Trawl 0.2.1
File Size Uploaded
Trawl-0.2.1.tar.gz 27.6 kB Details

Release files / Trawl-0.2.1.tar.gz

Download URL Trawl-0.2.1.tar.gz
Size 27.6 kB
Tags Source
SHA-256 checksum
How to use checksums
902f0e37a168fe107632e8fff658a882e658b5d5cd50f1c4dbbe4588a73ca7a2
BLAKE2b-256 checksum
How to use checksums
c6875dc23a17bc9ea02962afd771293c7bca079580fa4585b6d544e4fb924e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page