HowdenParser 7.0.0__tar.gz → 7.0.2__tar.gz

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.
@@ -50,8 +50,7 @@ class LlamaParser(BaseParser, name="llamaparser"):
50
50
  if not api_key:
51
51
  raise EnvironmentError("Missing LLAMA-PARSER-API-TOKEN in .env file.")
52
52
 
53
- rt_lower = str(
54
- self.result_type).lower() # Possible values for LlamaCloud expand: ["markdown", "markdown_full", "text", "metadata", "items"]
53
+ rt_lower = str(self.result_type).lower() # Possible values for LlamaCloud expand: ["markdown", "markdown_full", "text", "metadata", "items"]
55
54
  if rt_lower in ("md", "markdown"):
56
55
  self.rt = 'markdown'
57
56
  elif rt_lower in ("md_full", "markdown_full"):
@@ -91,31 +90,37 @@ class LlamaParser(BaseParser, name="llamaparser"):
91
90
  },
92
91
  expand=[self.rt,"job_metadata","usage"],
93
92
  )
94
-
95
- usage = Usage(
96
- type="parser",
97
- provider=self.provider_and_model,
98
- model=self.version + " " + self.tier,
99
- operation=self.name,
100
- pages = documents.job_metadata["pdf-pages"]
101
- )
102
-
93
+ pages = -1
103
94
  if self.rt == 'markdown':
104
95
  if include_pagenumbers:
105
96
  result = "\n".join(page_break(page.markdown, idx) for idx, page in enumerate(documents.markdown.pages, start=1))
106
97
  else:
107
98
  result = "\n".join(page.markdown for page in documents.markdown.pages)
99
+ pages = len(documents.markdown.pages)
108
100
  elif self.rt == 'markdown_full':
109
101
  result = documents.markdown_full
102
+ pages = len(documents.markdown.pages)
110
103
  elif self.rt == 'text':
111
104
  if include_pagenumbers:
112
105
  result = "\n".join(page_break(page.text, idx) for idx, page in enumerate(documents.text.pages, start=1))
113
106
  else:
114
107
  result = "\n".join(page.text for page in documents.text.pages)
108
+ pages = len(documents.text.pages)
115
109
  elif self.rt == 'items':
116
110
  result = documents.model_dump()
111
+ pages = len(documents.items.pages)
117
112
  else:
118
113
  raise NotImplementedError(f"Result type {self.result_type} is not supported.")
114
+
115
+ usage = Usage(
116
+ type="parser",
117
+ provider=self.provider_and_model,
118
+ model=self.version + " " + self.tier,
119
+ operation=self.name,
120
+ pages = pages
121
+ )
122
+ print(usage.pages)
123
+
119
124
  return HowdenResult(result,usage)
120
125
 
121
126
  def __call__(self, file_path: Path) -> HowdenResult:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: HowdenParser
3
- Version: 7.0.0
3
+ Version: 7.0.2
4
4
  Summary: A simple configuration manager with Pydantic and JSON export.
5
5
  License: MIT
6
6
  Keywords: config,configuration,pydantic,json
@@ -13,10 +13,11 @@ Classifier: Programming Language :: Python :: 3.12
13
13
  Classifier: Programming Language :: Python :: 3.13
14
14
  Requires-Dist: dotenv (>=0.9.9,<0.10.0)
15
15
  Requires-Dist: howdencommonobjects (>=1.1.0)
16
+ Requires-Dist: howdenconfig (>=1.0.6)
16
17
  Requires-Dist: langchain (>=1.1.3,<2.0.0)
17
18
  Requires-Dist: llama-cloud (==2.16.0)
18
19
  Requires-Dist: mistralai (>=1.9.3,<2.0.0)
19
- Requires-Dist: pdf2image (>=1.17.0,<2.0.0)
20
+ Requires-Dist: pydantic (>=2.13.4)
20
21
  Requires-Dist: pypdf2 (>=3.0.1,<4.0.0)
21
22
  Requires-Dist: pytest (>=9.0.2,<10.0.0)
22
23
  Requires-Dist: tomli-w (>=1.2.0,<2.0.0)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "HowdenParser"
3
- version = "7.0.0"
3
+ version = "7.0.2"
4
4
  description = "A simple configuration manager with Pydantic and JSON export."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12,<3.14"
@@ -17,15 +17,16 @@ homepage = "https://github.com/yourusername/config"
17
17
  repository = "https://github.com/yourusername/config"
18
18
  documentation = "https://github.com/yourusername/config"
19
19
  dependencies = [
20
+ "howdenconfig>=1.0.6",
21
+ "howdencommonobjects>=1.1.0",
20
22
  "mistralai (>=1.9.3,<2.0.0)",
21
23
  "llama-cloud==2.16.0",
22
- "pypdf2 (>=3.0.1,<4.0.0)",
23
- "pdf2image (>=1.17.0,<2.0.0)",
24
+ "pypdf2>=3.0.1,<4.0.0",
24
25
  "langchain (>=1.1.3,<2.0.0)",
25
26
  "pytest (>=9.0.2,<10.0.0)",
26
27
  "tomli-w (>=1.2.0,<2.0.0)",
27
28
  "dotenv (>=0.9.9,<0.10.0)",
28
- "howdencommonobjects>=1.1.0",
29
+ "pydantic>=2.13.4",
29
30
  ]
30
31
 
31
32
  [project.license]
File without changes