MCPcopy Index your code
hub / github.com/capyfile/capyfile

github.com/capyfile/capyfile @v1.2.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.5 ↗ · + Follow
503 symbols 1,599 edges 82 files 30 documented · 6%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Capyfile logo

Capyfile - highly customizable file processing pipeline with built-in HTTP server, CLI, and worker interfaces.

What we are pursuing here: * Easy setup * High customization * Wide range of file processing operations

How to use?

File processing pipeline can be set up in two simple steps.

Step 1: Write configuration file that describes the file processing pipeline

---
version: '1.2'
name: photos
processors:
  - name: archive
    operations:
      # read the files from the directory
      - name: filesystem_input_read
        params:
          target:
            sourceType: value
            source: "/home/user/Photos/*"
      # check the file type
      - name: file_type_validate
        params:
          allowedMimeTypes:
            sourceType: value
            source:
              - image/jpeg
              - image/x-canon-cr2
              - image/heic
              - image/heif
      # if the file type is right, upload the file to S3
      - name: s3_upload
        targetFiles: without_errors
        params:
          accessKeyId:
            sourceType: env_var
            source: AWS_ACCESS_KEY_ID
          secretAccessKey:
            sourceType: env_var
            source: AWS_SECRET_ACCESS_KEY
          endpoint:
            sourceType: value
            source: "s3.amazonaws.com"
          region:
            sourceType: value
            source: "us-east-1"
          bucket:
            sourceType: env_var
            source: AWS_PHOTOS_BUCKET
      # if the file type is right, and it is successfully uploaded to S3,
      # remove the file from the filesystem
      - name: filesystem_input_remove
        targetFiles: without_errors

Both YAML and JSON formats are supported.

Step 2: Run the file processing pipeline

# set the environment variables if you use any
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_PHOTOS_BUCKET=...

# run the file processing pipeline via capycmd command line application,
# enable concurrency to make it faster
capycmd -f photos.pipeline.yml --concurrency photos:archive

That's it 🎉

Want to know more?

Also check out the following articles: * Do whatever you want with your files, and do it quickly * Integrate any command into your file-processing pipeline

Why?

This project was created to with the following goals in mind: 1. Reduce the amount of boilerplate code and custom scripts. 2. Cover as many use cases as possible. 3. Provide declarative way to describe file processing pipelines.

Extension points exported contracts — how you extend this code

FileProcessingError (Interface)
(no doc) [29 implementers]
files/error.go
OperationHandler (Interface)
(no doc) [13 implementers]
operations/operation.go
Error (Interface)
(no doc) [4 implementers]
capyerr/error.go
Context (Interface)
(no doc) [3 implementers]
capysvc/context.go
ParameterLoader (Interface)
ParameterLoader Interface to implement parameter loaders. [1 implementers]
parameters/parameter_loader.go
PutObjectAPI (Interface)
PutObjectAPI The interface to implement PutObjectWithContext that we need to upload the files to S3.
operations/s3_upload.go
TimeStatProvider (Interface)
(no doc) [2 implementers]
operations/filetime/file_time_provider.go
CommandExecutor (Interface)
(no doc)
operations/command_exec.go

Core symbols most depended-on inside this repo

Name
called by 106
files/processable_file.go
Code
called by 58
capyerr/error.go
NewProcessableFile
called by 52
files/processable_file.go
AppendToOut
called by 42
operations/operation.go
InitCopyOnWriteFilesystem
called by 40
capyfs/fs.go
SetFileProcessingError
called by 32
files/processable_file.go
Failed
called by 30
operations/operation_notification.go
Error
called by 28
operations/operation_error.go

Shape

Method 235
Function 144
Struct 112
Interface 9
FuncType 3

Languages

Go100%

Modules by API surface

operations/generic_file_processing_error.go35 symbols
operations/file_time_validate_error.go25 symbols
capyerr/error.go22 symbols
capysvc/service_definition.go20 symbols
files/processable_file.go19 symbols
capysvc/context.go19 symbols
operations/command_exec.go14 symbols
capysvr/httpio/http_output_writer.go13 symbols
operations/s3_upload.go12 symbols
capysvc/service_definition_test.go11 symbols
operations/s3_upload_error.go10 symbols
operations/file_type_validate_error.go10 symbols

For agents

$ claude mcp add capyfile \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact