superpdf 0.1.0__py3-none-any.whl

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.
superpdf/__init__.py ADDED
@@ -0,0 +1,70 @@
1
+ """superPDF for Python: PDFs to Markdown, HTML or JSON on your computer.
2
+
3
+ A thin wrapper around the superPDF command-line tool (npm package @superpdf/cli), so the results are the
4
+ same as `superpdf export`. Node.js comes with the package (nodejs-wheel-binaries).
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import json
10
+ import os
11
+ import re
12
+ from typing import Any
13
+
14
+ from ._cli import CLI_VERSION, SuperPDFError, install_cli, run
15
+
16
+ __all__ = ["CLI_VERSION", "SuperPDFError", "export", "export_json", "export_pages", "install_cli"]
17
+ __version__ = "0.1.0"
18
+
19
+ _PAGE_END = re.compile(r"^<!-- end of page (\d+) -->\s*$", re.MULTILINE)
20
+
21
+
22
+ def _args(path: str | os.PathLike[str], fmt: str, pages: str | None, tables: str | None, ocr: bool) -> list[str]:
23
+ args = ["export", os.fspath(path), "--format", fmt]
24
+ if pages:
25
+ args += ["--pages", pages]
26
+ if tables:
27
+ args += ["--tables", tables]
28
+ if not ocr:
29
+ args.append("--no-ocr")
30
+ return args
31
+
32
+
33
+ def export(
34
+ path: str | os.PathLike[str],
35
+ format: str = "markdown",
36
+ *,
37
+ pages: str | None = None,
38
+ tables: str | None = None,
39
+ ocr: bool = True,
40
+ timeout: float | None = 600,
41
+ ) -> str:
42
+ """Read a PDF and return it as Markdown, HTML or JSON text.
43
+
44
+ pages: a selection such as "1,3-5" (all pages when omitted).
45
+ tables: "html" writes Markdown tables as HTML, keeping merged header cells (Markdown only).
46
+ ocr: read scanned pages with superPDF OCR (Tesseract, 15 languages); False skips it.
47
+ """
48
+ if format not in ("markdown", "html", "json"):
49
+ raise ValueError("format must be 'markdown', 'html' or 'json'.")
50
+ if tables not in (None, "markdown", "html"):
51
+ raise ValueError("tables must be 'markdown' or 'html'.")
52
+ if tables and format != "markdown":
53
+ raise ValueError("tables applies to Markdown only.")
54
+ return run(_args(path, format, pages, tables, ocr), timeout=timeout)
55
+
56
+
57
+ def export_json(path: str | os.PathLike[str], **options: Any) -> dict[str, Any]:
58
+ """The document's structure as a dict: title, pageCount, pages (blocks with type and bbox) and sections."""
59
+ structure: dict[str, Any] = json.loads(export(path, "json", **options))
60
+ return structure
61
+
62
+
63
+ def export_pages(path: str | os.PathLike[str], **options: Any) -> list[dict[str, Any]]:
64
+ """Markdown per page: a list of {"page": number, "markdown": text}."""
65
+ text = export(path, "markdown", **options)
66
+ result, start = [], 0
67
+ for match in _PAGE_END.finditer(text):
68
+ result.append({"page": int(match.group(1)), "markdown": text[start : match.start()].strip()})
69
+ start = match.end()
70
+ return result
superpdf/__main__.py ADDED
@@ -0,0 +1,37 @@
1
+ """The `superpdf` command (and `python -m superpdf`): the superPDF CLI, run with the bundled Node.js.
2
+
3
+ uvx superpdf export report.pdf --output report.md
4
+ pipx run superpdf help
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import os
10
+ import subprocess
11
+ import sys
12
+
13
+ from ._cli import SuperPDFError, command
14
+
15
+ # Set for the CLI it starts, so SUPERPDF_BIN pointing back at this command fails instead of starting itself forever.
16
+ _GUARD = "SUPERPDF_PYTHON_WRAPPER"
17
+
18
+
19
+ def main(argv: list[str] | None = None) -> int:
20
+ args = sys.argv[1:] if argv is None else argv
21
+ if os.environ.get(_GUARD):
22
+ print(
23
+ "superPDF: SUPERPDF_BIN points to the Python superpdf command; point it to the Node.js CLI.",
24
+ file=sys.stderr,
25
+ )
26
+ return 1
27
+ try:
28
+ return subprocess.call([*command(), *args], env={**os.environ, _GUARD: "1"})
29
+ except SuperPDFError as error:
30
+ print(f"superPDF: {error}", file=sys.stderr)
31
+ return 1
32
+ except KeyboardInterrupt:
33
+ return 130
34
+
35
+
36
+ if __name__ == "__main__":
37
+ sys.exit(main())
superpdf/_cli.py ADDED
@@ -0,0 +1,157 @@
1
+ """Install and run the superPDF command-line tool (the npm package @superpdf/cli).
2
+
3
+ Node.js comes from the `nodejs-wheel-binaries` package, so `pip install superpdf` is all a user needs. The CLI
4
+ itself is installed once, at a pinned version, into a per-user cache folder.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import os
10
+ import shutil
11
+ import subprocess
12
+ import sys
13
+ import tempfile
14
+ from pathlib import Path
15
+
16
+ # The @superpdf/cli version this package is tested with.
17
+ CLI_VERSION = "0.1.3"
18
+ NODE_MAJOR = 22
19
+
20
+
21
+ class SuperPDFError(RuntimeError):
22
+ """The superPDF command failed, or the CLI couldn't be found or installed."""
23
+
24
+
25
+ def _bundled(root: Path, windows: bool) -> tuple[str, list[str] | None] | None:
26
+ """Node.js and npm inside a nodejs-wheel-binaries folder, or None if its node binary is missing.
27
+
28
+ The wheel puts node.exe at the top on Windows and bin/node elsewhere; npm is under lib/node_modules on every
29
+ platform (node_modules is checked too, for older layouts).
30
+ """
31
+ node = root / "node.exe" if windows else root / "bin" / "node"
32
+ if not node.exists():
33
+ return None
34
+ candidates = (root / "lib" / "node_modules" / "npm", root / "node_modules" / "npm")
35
+ npm = next((c / "bin" / "npm-cli.js" for c in candidates if (c / "bin" / "npm-cli.js").exists()), None)
36
+ return str(node), [str(node), str(npm)] if npm else None
37
+
38
+
39
+ def _node() -> tuple[str, list[str] | None]:
40
+ """The Node.js binary and the npm command: from nodejs-wheel-binaries, else Node.js 22+ on PATH."""
41
+ try:
42
+ import nodejs_wheel
43
+
44
+ found = _bundled(Path(nodejs_wheel.__file__).parent, windows=os.name == "nt")
45
+ except ImportError:
46
+ found = None
47
+ if found is not None:
48
+ return found
49
+ node_path = shutil.which("node")
50
+ if node_path is None:
51
+ raise SuperPDFError(
52
+ "Node.js wasn't found. Reinstall superpdf (it brings Node.js through nodejs-wheel-binaries), "
53
+ "or install Node.js 22 or later from https://nodejs.org."
54
+ )
55
+ version = _output([node_path, "--version"], timeout=30).strip()
56
+ major = version.lstrip("v").split(".")[0]
57
+ if not major.isdigit() or int(major) < NODE_MAJOR:
58
+ raise SuperPDFError(
59
+ f"superPDF needs Node.js {NODE_MAJOR} or later; this computer has {version or 'an unknown version'}."
60
+ )
61
+ npm_path = shutil.which("npm")
62
+ return node_path, [npm_path] if npm_path else None
63
+
64
+
65
+ def _output(cmd: list[str], timeout: float | None) -> str:
66
+ # The CLI writes UTF-8 on every platform; Python's default encoding on Windows is not UTF-8.
67
+ return subprocess.run(
68
+ cmd, capture_output=True, timeout=timeout, check=False, encoding="utf-8", errors="replace"
69
+ ).stdout
70
+
71
+
72
+ def cache_dir() -> Path:
73
+ """Where the CLI is installed: SUPERPDF_CACHE_DIR, else the platform's per-user cache folder."""
74
+ configured = os.environ.get("SUPERPDF_CACHE_DIR")
75
+ if configured:
76
+ return Path(configured)
77
+ if sys.platform == "darwin":
78
+ return Path.home() / "Library" / "Caches" / "superpdf"
79
+ if os.name == "nt":
80
+ return Path(os.environ.get("LOCALAPPDATA", Path.home() / "AppData" / "Local")) / "superpdf" / "Cache"
81
+ return Path(os.environ.get("XDG_CACHE_HOME", Path.home() / ".cache")) / "superpdf"
82
+
83
+
84
+ def _script(prefix: Path) -> Path:
85
+ return prefix / "node_modules" / "@superpdf" / "cli" / "bin" / "superpdf.js"
86
+
87
+
88
+ def install_cli(version: str = CLI_VERSION, *, timeout: float = 600) -> Path:
89
+ """Install @superpdf/cli (once) and return the path to its superpdf.js. Safe to call repeatedly."""
90
+ target = cache_dir() / f"cli-{version}"
91
+ if _script(target).exists():
92
+ return _script(target)
93
+ _, npm = _node()
94
+ if npm is None:
95
+ raise SuperPDFError("npm wasn't found to install the superPDF CLI. Set SUPERPDF_BIN to an installed superpdf.")
96
+ target.parent.mkdir(parents=True, exist_ok=True)
97
+ # Install into a temporary folder, then move it into place, so a failed or concurrent install never leaves a
98
+ # half-written CLI behind.
99
+ staging = Path(tempfile.mkdtemp(prefix=f".cli-{version}-", dir=target.parent))
100
+ try:
101
+ command = [
102
+ *npm,
103
+ "install",
104
+ "--prefix",
105
+ str(staging),
106
+ "--omit=dev",
107
+ "--ignore-scripts",
108
+ "--no-audit",
109
+ "--no-fund",
110
+ "--no-package-lock",
111
+ "--loglevel=error",
112
+ f"@superpdf/cli@{version}",
113
+ ]
114
+ result = subprocess.run(
115
+ command, capture_output=True, timeout=timeout, check=False, encoding="utf-8", errors="replace"
116
+ )
117
+ if result.returncode != 0 or not _script(staging).exists():
118
+ detail = (result.stderr or result.stdout).strip().splitlines()[-1:] or ["no output"]
119
+ raise SuperPDFError(f"Couldn't install @superpdf/cli@{version} from npm: {detail[0]}")
120
+ try:
121
+ os.replace(staging, target)
122
+ except OSError:
123
+ if not _script(target).exists(): # another process finished first; otherwise it is a real error
124
+ raise
125
+ except subprocess.TimeoutExpired as error:
126
+ raise SuperPDFError(f"Installing @superpdf/cli@{version} took longer than {timeout:.0f} seconds.") from error
127
+ finally:
128
+ shutil.rmtree(staging, ignore_errors=True)
129
+ return _script(target)
130
+
131
+
132
+ def command() -> list[str]:
133
+ """The command that runs superPDF: SUPERPDF_BIN if set, else the pinned CLI with the bundled Node.js."""
134
+ configured = os.environ.get("SUPERPDF_BIN")
135
+ if configured:
136
+ path = Path(configured)
137
+ if not path.exists():
138
+ raise SuperPDFError(f"SUPERPDF_BIN points to {configured}, which doesn't exist.")
139
+ return [_node()[0], str(path)] if path.suffix == ".js" else [str(path)]
140
+ script = install_cli()
141
+ return [_node()[0], str(script)]
142
+
143
+
144
+ def run(args: list[str], timeout: float | None = 600) -> str:
145
+ """Run superPDF with `args` and return what it printed. Raises SuperPDFError on failure."""
146
+ try:
147
+ result = subprocess.run(
148
+ [*command(), *args], capture_output=True, timeout=timeout, check=False, encoding="utf-8", errors="replace"
149
+ )
150
+ except subprocess.TimeoutExpired as error:
151
+ raise SuperPDFError(f"superPDF didn't finish within {timeout:.0f} seconds.") from error
152
+ if result.returncode != 0:
153
+ # Progress notes (OCR) come first; the error is the last line.
154
+ lines = [line for line in result.stderr.splitlines() if line.strip()]
155
+ message = lines[-1].removeprefix("superPDF: ") if lines else f"superPDF exited with code {result.returncode}."
156
+ raise SuperPDFError(message)
157
+ return result.stdout
superpdf/langchain.py ADDED
@@ -0,0 +1,33 @@
1
+ """LangChain document loader: one Document per PDF page, read by superPDF.
2
+
3
+ pip install "superpdf[langchain]"
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import os
9
+ from collections.abc import Iterator
10
+ from typing import Any
11
+
12
+ try:
13
+ from langchain_core.document_loaders import BaseLoader
14
+ from langchain_core.documents import Document
15
+ except ImportError as error: # pragma: no cover
16
+ raise ImportError('SuperPDFLoader needs langchain-core: pip install "superpdf[langchain]"') from error
17
+
18
+ from . import export_pages
19
+
20
+
21
+ class SuperPDFLoader(BaseLoader):
22
+ """Loads a PDF as Markdown, one Document per page, with `source` and `page` in the metadata.
23
+
24
+ Options are passed to superpdf.export: pages="1-3", tables="html", ocr=False.
25
+ """
26
+
27
+ def __init__(self, file_path: str | os.PathLike[str], **options: Any) -> None:
28
+ self.file_path = os.fspath(file_path)
29
+ self.options = options
30
+
31
+ def lazy_load(self) -> Iterator[Document]:
32
+ for page in export_pages(self.file_path, **self.options):
33
+ yield Document(page_content=page["markdown"], metadata={"source": self.file_path, "page": page["page"]})
@@ -0,0 +1,38 @@
1
+ """LlamaIndex reader: one Document per PDF page, read by superPDF.
2
+
3
+ pip install "superpdf[llama-index]"
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import os
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+ try:
13
+ from llama_index.core.readers.base import BaseReader
14
+ from llama_index.core.schema import Document
15
+ except ImportError as error: # pragma: no cover
16
+ raise ImportError('SuperPDFReader needs llama-index-core: pip install "superpdf[llama-index]"') from error
17
+
18
+ from . import export_pages
19
+
20
+
21
+ class SuperPDFReader(BaseReader):
22
+ """Reads a PDF as Markdown, one Document per page, with `file_path` and `page` in the metadata.
23
+
24
+ Options are passed to superpdf.export: pages="1-3", tables="html", ocr=False.
25
+ """
26
+
27
+ def __init__(self, **options: Any) -> None:
28
+ super().__init__()
29
+ self._options = options
30
+
31
+ def load_data(
32
+ self, file: str | os.PathLike[str] | Path, extra_info: dict[str, Any] | None = None
33
+ ) -> list[Document]:
34
+ path = os.fspath(file)
35
+ return [
36
+ Document(text=page["markdown"], metadata={"file_path": path, "page": page["page"], **(extra_info or {})})
37
+ for page in export_pages(path, **self._options)
38
+ ]
superpdf/py.typed ADDED
File without changes
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.5
2
+ Name: superpdf
3
+ Version: 0.1.0
4
+ Summary: PDFs to Markdown, HTML or JSON on your computer: headings, tables, charts as data and OCR. Python wrapper for the superPDF CLI.
5
+ Project-URL: Homepage, https://superpdf.ai
6
+ Project-URL: Documentation, https://github.com/arjunprabhulal/superpdf/tree/main/python#readme
7
+ Project-URL: Source, https://github.com/arjunprabhulal/superpdf
8
+ Project-URL: Issues, https://github.com/arjunprabhulal/superpdf/issues
9
+ Project-URL: Changelog, https://github.com/arjunprabhulal/superpdf/blob/main/python/CHANGELOG.md
10
+ Author-email: Arjun Prabhulal <arjun.prabhulal@gmail.com>
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: charts,langchain,llama-index,ocr,pdf,pdf-parser,pdf-to-markdown,rag,tables
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
26
+ Classifier: Typing :: Typed
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: nodejs-wheel-binaries>=22
29
+ Provides-Extra: langchain
30
+ Requires-Dist: langchain-core>=0.3; extra == 'langchain'
31
+ Provides-Extra: llama-index
32
+ Requires-Dist: llama-index-core>=0.12; extra == 'llama-index'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # superpdf (Python)
36
+
37
+ [![PyPI](https://img.shields.io/pypi/v/superpdf?style=flat-square&color=4338ca)](https://pypi.org/project/superpdf/) [![Python](https://img.shields.io/pypi/pyversions/superpdf?style=flat-square)](https://pypi.org/project/superpdf/) [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-555555?style=flat-square)](LICENSE)
38
+
39
+ Read PDFs into Markdown, HTML or JSON on your computer: headings, tables, charts as data and OCR for scanned
40
+ pages. Nothing is uploaded.
41
+
42
+ This package is a thin Python wrapper around the [superPDF command-line tool](https://github.com/arjunprabhulal/superpdf)
43
+ (npm package `@superpdf/cli`), so you get exactly what `superpdf export` produces. It includes a LangChain document
44
+ loader and a LlamaIndex reader.
45
+
46
+ ## Requirements
47
+
48
+ Python 3.10 or later on macOS, Linux or Windows. Nothing else: Node.js comes with the package through
49
+ [`nodejs-wheel-binaries`](https://pypi.org/project/nodejs-wheel-binaries/).
50
+
51
+ The first call installs the superPDF reader (`@superpdf/cli`, about 185 MB with its PDF engine and OCR language
52
+ data) from npm into your cache folder, once. To do that ahead of time, for example in a Docker image or before going offline:
53
+
54
+ ```bash
55
+ python -c "import superpdf; superpdf.install_cli()"
56
+ ```
57
+
58
+ ## Install
59
+
60
+ ```bash
61
+ pip install superpdf
62
+ pip install "superpdf[langchain]" # with the LangChain loader
63
+ pip install "superpdf[llama-index]" # with the LlamaIndex reader
64
+ uv add superpdf # in a uv project
65
+ ```
66
+
67
+ Or run the command without installing anything:
68
+
69
+ ```bash
70
+ uvx superpdf export report.pdf --output report.md
71
+ pipx run superpdf export report.pdf --output report.md
72
+ ```
73
+
74
+ ## Use
75
+
76
+ ```python
77
+ import superpdf
78
+
79
+ markdown = superpdf.export("report.pdf") # the whole document as Markdown
80
+ html = superpdf.export("report.pdf", "html")
81
+ structure = superpdf.export_json("report.pdf") # pages, blocks with type and position, sections
82
+
83
+ for page in superpdf.export_pages("report.pdf"): # Markdown per page
84
+ print(page["page"], page["markdown"][:80])
85
+
86
+ superpdf.export("report.pdf", pages="1,3-5", tables="html", ocr=False)
87
+ ```
88
+
89
+ | Option | Meaning |
90
+ |---|---|
91
+ | `format` | `"markdown"` (default), `"html"` or `"json"` |
92
+ | `pages` | A selection such as `"1,3-5"`; all pages when omitted |
93
+ | `tables` | `"html"` writes Markdown tables as HTML, keeping merged header cells (Markdown only) |
94
+ | `ocr` | `True` (default) reads scanned pages with OCR in 15 languages; `False` skips it |
95
+ | `timeout` | Seconds before giving up (default 600) |
96
+
97
+ Errors raise `superpdf.SuperPDFError` with superPDF's own message, for example `No file at report.pdf.`
98
+
99
+ ### LangChain
100
+
101
+ ```python
102
+ from superpdf.langchain import SuperPDFLoader
103
+
104
+ docs = SuperPDFLoader("report.pdf").load() # one Document per page
105
+ docs[0].metadata # {"source": "report.pdf", "page": 1}
106
+ ```
107
+
108
+ ### LlamaIndex
109
+
110
+ ```python
111
+ from superpdf.llama_index import SuperPDFReader
112
+
113
+ docs = SuperPDFReader(tables="html").load_data("report.pdf") # one Document per page
114
+ ```
115
+
116
+ ## Command line
117
+
118
+ The package installs a `superpdf` command that runs the full CLI (the same as `python -m superpdf`):
119
+
120
+ ```bash
121
+ superpdf export report.pdf --output report.md
122
+ superpdf export report.pdf --tables html --output report.md
123
+ superpdf help
124
+ ```
125
+
126
+ `uvx superpdf …` and `pipx run superpdf …` run it in a temporary environment, with nothing to install first.
127
+
128
+ ## How it works
129
+
130
+ Each call runs `superpdf export` in a subprocess (no shell) with the bundled Node.js and reads its output as UTF-8.
131
+ The reader is `@superpdf/cli` at the version this package is tested with, installed once into your cache folder:
132
+ `~/Library/Caches/superpdf` on macOS, `~/.cache/superpdf` on Linux and `%LOCALAPPDATA%\superpdf\Cache` on Windows
133
+ (set `SUPERPDF_CACHE_DIR` to change it). To use your own build instead, set `SUPERPDF_BIN` to a `superpdf` command or
134
+ `superpdf.js`. The reader, its tables, charts and OCR are described in the
135
+ [main README](https://github.com/arjunprabhulal/superpdf#readme).
136
+
137
+ ## License
138
+
139
+ [Apache-2.0](LICENSE).
@@ -0,0 +1,11 @@
1
+ superpdf/__init__.py,sha256=OFfNSMTOm8-ik6OM7kn7A3aaul9LlFotOBME8tUCPUg,2622
2
+ superpdf/__main__.py,sha256=eeC7dEU4JxJkdN0wDtisgltCSh_KnT4n7Z11ttLz1lY,1057
3
+ superpdf/_cli.py,sha256=Gm6NDxmtQb7PQYiSmCn9ggO30sWKprrlYwLMe6Y13Pw,6679
4
+ superpdf/langchain.py,sha256=7xZBgSi8Lvsu5WHe0uYlYEdftiy2sg67FeBMEzMDvFY,1136
5
+ superpdf/llama_index.py,sha256=nO0OoQxEazdfGgxpD2W4298CVwXDxHY76YgE7L_jyXk,1211
6
+ superpdf/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ superpdf-0.1.0.dist-info/METADATA,sha256=HxgAolMmfDDa4qeu2bQnI604q2fex00SEP2Lu0xEXxk,5678
8
+ superpdf-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
9
+ superpdf-0.1.0.dist-info/entry_points.txt,sha256=d-qtpF-4mpnLvLoBQZpY_l60CK4N7naTo5cdab3j0JQ,52
10
+ superpdf-0.1.0.dist-info/licenses/LICENSE,sha256=d80yR0DAWqNIvFUaehCT3owf_ESgvMxlxiOGEF0NyU8,10205
11
+ superpdf-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ superpdf = superpdf.__main__:main
@@ -0,0 +1,178 @@
1
+ Copyright 2026 Arjun Prabhulal
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS