docpipe 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2810fcfcccc804f977849e785bc1691d828be4779c06a84d3ae2d8bf5a5d360c
4
+ data.tar.gz: 92950288f5911e04a37add2cddcd16a3b53e25f15b1c476ec2e1a2e6c2aeab44
5
+ SHA512:
6
+ metadata.gz: 579a978ce43ff951d2274e6a3b4a72d50f2380ff2b39ca232402df655a3c753ec0585cd81d5eaada1bcf0a4fde0df20bb7b843813cebf7889087045899291dcf
7
+ data.tar.gz: 3c03100b12e75c8fe1b10209b3b3450ee868e2e0401b77516d5f763dcc4ee0b8618d18452968e1acae32868e77e29825b6d6ff99881bb5a91e84ac9931de7212
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zayn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # docpipe
2
+
3
+ Ruby wrapper for Docpipe. Requires the Python package `docpipe-core` to be installed and available to `python3`.
4
+ Set `DOCPIPE_PYTHON=/path/to/python` when the Python engine is installed in a virtualenv.
5
+
6
+ ```ruby
7
+ require "docpipe"
8
+
9
+ doc = Docpipe.parse("invoice.pdf")
10
+ puts doc.markdown
11
+ ```
@@ -0,0 +1,29 @@
1
+ module Docpipe
2
+ class Document
3
+ attr_reader :data
4
+
5
+ def initialize(data)
6
+ @data = data
7
+ end
8
+
9
+ def markdown
10
+ data.fetch("markdown")
11
+ end
12
+
13
+ def text
14
+ data.fetch("text")
15
+ end
16
+
17
+ def pages
18
+ data.fetch("pages")
19
+ end
20
+
21
+ def metadata
22
+ data.fetch("metadata")
23
+ end
24
+
25
+ def backend
26
+ data.fetch("backend")
27
+ end
28
+ end
29
+ end
data/lib/docpipe.rb ADDED
@@ -0,0 +1,27 @@
1
+ require "json"
2
+ require "open3"
3
+ require_relative "docpipe/document"
4
+
5
+ module Docpipe
6
+ class Error < StandardError; end
7
+
8
+ def self.parse(path, ocr: "auto")
9
+ python = ENV.fetch("DOCPIPE_PYTHON", "python3")
10
+ stdout, stderr, status = Open3.capture3(
11
+ python, "-m", "docpipe_core.cli", path.to_s, "--format", "json", "--ocr", ocr.to_s
12
+ )
13
+ raise Error, stderr.strip unless status.success?
14
+
15
+ Document.new(JSON.parse(stdout))
16
+ end
17
+
18
+ def self.parse_markdown(path, ocr: "auto")
19
+ python = ENV.fetch("DOCPIPE_PYTHON", "python3")
20
+ stdout, stderr, status = Open3.capture3(
21
+ python, "-m", "docpipe_core.cli", path.to_s, "--format", "markdown", "--ocr", ocr.to_s
22
+ )
23
+ raise Error, stderr.strip unless status.success?
24
+
25
+ stdout
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: docpipe
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Zayn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-09-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Ruby wrapper for Docpipe, a local-first document parser.
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - LICENSE
20
+ - README.md
21
+ - lib/docpipe.rb
22
+ - lib/docpipe/document.rb
23
+ homepage: https://github.com/iamzayn19/docpipe
24
+ licenses:
25
+ - MIT
26
+ metadata:
27
+ source_code_uri: https://github.com/iamzayn19/docpipe
28
+ bug_tracker_uri: https://github.com/iamzayn19/docpipe/issues
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '3.0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubygems_version: 3.5.22
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Document parsing to Markdown and JSON from Ruby.
48
+ test_files: []