python-hwpx 1.0__tar.gz → 1.1__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.
Files changed (35) hide show
  1. {python-hwpx-1.0/src/python_hwpx.egg-info → python-hwpx-1.1}/PKG-INFO +3 -6
  2. {python-hwpx-1.0 → python-hwpx-1.1}/README.md +2 -5
  3. {python-hwpx-1.0 → python-hwpx-1.1}/pyproject.toml +1 -1
  4. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/document.py +7 -0
  5. python-hwpx-1.1/src/hwpx/templates.py +33 -0
  6. {python-hwpx-1.0 → python-hwpx-1.1/src/python_hwpx.egg-info}/PKG-INFO +3 -6
  7. {python-hwpx-1.0 → python-hwpx-1.1}/src/python_hwpx.egg-info/SOURCES.txt +1 -0
  8. {python-hwpx-1.0 → python-hwpx-1.1}/LICENSE +0 -0
  9. {python-hwpx-1.0 → python-hwpx-1.1}/setup.cfg +0 -0
  10. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/__init__.py +0 -0
  11. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/opc/package.py +0 -0
  12. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/oxml/__init__.py +0 -0
  13. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/oxml/body.py +0 -0
  14. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/oxml/common.py +0 -0
  15. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/oxml/document.py +0 -0
  16. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/oxml/header.py +0 -0
  17. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/oxml/parser.py +0 -0
  18. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/oxml/schema.py +0 -0
  19. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/oxml/utils.py +0 -0
  20. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/package.py +0 -0
  21. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/tools/__init__.py +0 -0
  22. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/tools/_schemas/header.xsd +0 -0
  23. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/tools/_schemas/section.xsd +0 -0
  24. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/tools/object_finder.py +0 -0
  25. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/tools/text_extractor.py +0 -0
  26. {python-hwpx-1.0 → python-hwpx-1.1}/src/hwpx/tools/validator.py +0 -0
  27. {python-hwpx-1.0 → python-hwpx-1.1}/src/python_hwpx.egg-info/dependency_links.txt +0 -0
  28. {python-hwpx-1.0 → python-hwpx-1.1}/src/python_hwpx.egg-info/entry_points.txt +0 -0
  29. {python-hwpx-1.0 → python-hwpx-1.1}/src/python_hwpx.egg-info/requires.txt +0 -0
  30. {python-hwpx-1.0 → python-hwpx-1.1}/src/python_hwpx.egg-info/top_level.txt +0 -0
  31. {python-hwpx-1.0 → python-hwpx-1.1}/tests/test_document_formatting.py +0 -0
  32. {python-hwpx-1.0 → python-hwpx-1.1}/tests/test_integration_hwpx_compatibility.py +0 -0
  33. {python-hwpx-1.0 → python-hwpx-1.1}/tests/test_memo_and_style_editing.py +0 -0
  34. {python-hwpx-1.0 → python-hwpx-1.1}/tests/test_oxml_parsing.py +0 -0
  35. {python-hwpx-1.0 → python-hwpx-1.1}/tests/test_text_extractor_annotations.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-hwpx
3
- Version: 1.0
3
+ Version: 1.1
4
4
  Summary: Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음
5
5
  Author: python-hwpx Maintainers
6
6
  License: Non-Commercial License
@@ -45,13 +45,10 @@ python-hwpx는 Hancom HWPX 패키지를 분석하고 편집하기 위한 Python
45
45
 
46
46
  ### 1. 환경 준비
47
47
 
48
- 가상 환경을 만든 뒤 PyPI에 배포된 패키지를 설치하세요.
48
+ pip를 이용해 패키지를 설치합니다.
49
49
 
50
50
  ```bash
51
- python -m venv .venv
52
- source .venv/bin/activate
53
- python -m pip install --upgrade pip
54
- python -m pip install python-hwpx
51
+ python pip install python-hwpx
55
52
  ```
56
53
 
57
54
  최신 개발 버전을 사용하거나 소스 코드를 수정하려면 편집 가능한 설치를 권장합니다.
@@ -15,13 +15,10 @@ python-hwpx는 Hancom HWPX 패키지를 분석하고 편집하기 위한 Python
15
15
 
16
16
  ### 1. 환경 준비
17
17
 
18
- 가상 환경을 만든 뒤 PyPI에 배포된 패키지를 설치하세요.
18
+ pip를 이용해 패키지를 설치합니다.
19
19
 
20
20
  ```bash
21
- python -m venv .venv
22
- source .venv/bin/activate
23
- python -m pip install --upgrade pip
24
- python -m pip install python-hwpx
21
+ python pip install python-hwpx
25
22
  ```
26
23
 
27
24
  최신 개발 버전을 사용하거나 소스 코드를 수정하려면 편집 가능한 설치를 권장합니다.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-hwpx"
7
- version = "1.0"
7
+ version = "1.1"
8
8
  description = "Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  license = { text = "Non-Commercial License" }
@@ -22,6 +22,7 @@ from .oxml import (
22
22
  RunStyle,
23
23
  )
24
24
  from .package import HwpxPackage
25
+ from .templates import blank_document_bytes
25
26
 
26
27
  _HP_NS = "http://www.hancom.co.kr/hwpml/2011/paragraph"
27
28
  _HP = f"{{{_HP_NS}}}"
@@ -46,6 +47,12 @@ class HwpxDocument:
46
47
  root = HwpxOxmlDocument.from_package(package)
47
48
  return cls(package, root)
48
49
 
50
+ @classmethod
51
+ def new(cls) -> "HwpxDocument":
52
+ """Return a new blank document based on the default skeleton template."""
53
+
54
+ return cls.open(blank_document_bytes())
55
+
49
56
  @classmethod
50
57
  def from_package(cls, package: HwpxPackage) -> "HwpxDocument":
51
58
  """Create a document backed by an existing :class:`HwpxPackage`."""
@@ -0,0 +1,33 @@
1
+ """Embedded templates and sample payloads for HWPX documents."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from functools import lru_cache
6
+ from importlib import resources
7
+ from pathlib import Path
8
+
9
+
10
+ @lru_cache(maxsize=None)
11
+ def blank_document_bytes() -> bytes:
12
+ """Return the binary payload for a minimal blank HWPX document."""
13
+
14
+ # Prefer a packaged asset when available.
15
+ try:
16
+ data_pkg = resources.files("hwpx.data")
17
+ except (ModuleNotFoundError, AttributeError): # pragma: no cover - optional dependency
18
+ data_pkg = None
19
+ if data_pkg is not None:
20
+ skeleton = data_pkg / "Skeleton.hwpx"
21
+ if skeleton.is_file(): # type: ignore[call-arg]
22
+ with skeleton.open("rb") as stream: # type: ignore[call-arg]
23
+ return stream.read()
24
+
25
+ # Fall back to the repository examples folder during development.
26
+ root = Path(__file__).resolve().parent.parent.parent
27
+ fallback = root / "examples" / "Skeleton.hwpx"
28
+ if fallback.is_file():
29
+ return fallback.read_bytes()
30
+
31
+ raise FileNotFoundError(
32
+ "Could not locate Skeleton.hwpx; ensure the template asset is packaged."
33
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-hwpx
3
- Version: 1.0
3
+ Version: 1.1
4
4
  Summary: Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음
5
5
  Author: python-hwpx Maintainers
6
6
  License: Non-Commercial License
@@ -45,13 +45,10 @@ python-hwpx는 Hancom HWPX 패키지를 분석하고 편집하기 위한 Python
45
45
 
46
46
  ### 1. 환경 준비
47
47
 
48
- 가상 환경을 만든 뒤 PyPI에 배포된 패키지를 설치하세요.
48
+ pip를 이용해 패키지를 설치합니다.
49
49
 
50
50
  ```bash
51
- python -m venv .venv
52
- source .venv/bin/activate
53
- python -m pip install --upgrade pip
54
- python -m pip install python-hwpx
51
+ python pip install python-hwpx
55
52
  ```
56
53
 
57
54
  최신 개발 버전을 사용하거나 소스 코드를 수정하려면 편집 가능한 설치를 권장합니다.
@@ -4,6 +4,7 @@ pyproject.toml
4
4
  src/hwpx/__init__.py
5
5
  src/hwpx/document.py
6
6
  src/hwpx/package.py
7
+ src/hwpx/templates.py
7
8
  src/hwpx/opc/package.py
8
9
  src/hwpx/oxml/__init__.py
9
10
  src/hwpx/oxml/body.py
File without changes
File without changes
File without changes