pyUSPTO 0.3.4__tar.gz → 0.4.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 (132) hide show
  1. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/workflows/publish-docs.yaml +3 -3
  2. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/workflows/publish-to-test-pypi.yml +5 -5
  3. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/workflows/python-tests.yml +5 -5
  4. {pyuspto-0.3.4 → pyuspto-0.4.1}/ADVANCED.md +74 -12
  5. {pyuspto-0.3.4 → pyuspto-0.4.1}/PKG-INFO +77 -123
  6. {pyuspto-0.3.4 → pyuspto-0.4.1}/README.md +73 -119
  7. {pyuspto-0.3.4 → pyuspto-0.4.1}/examples/bulk_data_example.py +5 -10
  8. {pyuspto-0.3.4 → pyuspto-0.4.1}/examples/error_handling_example.py +3 -2
  9. {pyuspto-0.3.4 → pyuspto-0.4.1}/examples/ifw_example.py +3 -2
  10. {pyuspto-0.3.4 → pyuspto-0.4.1}/examples/patent_data_example.py +5 -3
  11. {pyuspto-0.3.4 → pyuspto-0.4.1}/examples/petition_decisions_example.py +3 -1
  12. {pyuspto-0.3.4 → pyuspto-0.4.1}/examples/ptab_appeals_example.py +3 -1
  13. {pyuspto-0.3.4 → pyuspto-0.4.1}/examples/ptab_interferences_example.py +3 -1
  14. {pyuspto-0.3.4 → pyuspto-0.4.1}/examples/ptab_trials_example.py +4 -1
  15. {pyuspto-0.3.4 → pyuspto-0.4.1}/pyproject.toml +3 -3
  16. {pyuspto-0.3.4 → pyuspto-0.4.1}/requirements-dev.txt +9 -9
  17. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/clients/base.py +145 -119
  18. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/clients/bulk_data.py +31 -33
  19. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/clients/patent_data.py +15 -8
  20. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/clients/petition_decisions.py +14 -8
  21. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/clients/ptab_appeals.py +14 -8
  22. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/clients/ptab_interferences.py +14 -8
  23. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/clients/ptab_trials.py +14 -8
  24. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/config.py +90 -5
  25. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/http_config.py +6 -3
  26. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/models/bulk_data.py +13 -7
  27. pyuspto-0.4.1/src/pyUSPTO/utils/__init__.py +4 -0
  28. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO.egg-info/PKG-INFO +77 -123
  29. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO.egg-info/SOURCES.txt +1 -3
  30. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO.egg-info/requires.txt +2 -2
  31. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/clients/test_base.py +422 -105
  32. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/clients/test_bulk_data_clients.py +71 -52
  33. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/clients/test_patent_data_clients.py +27 -29
  34. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/clients/test_petition_decision_clients.py +26 -36
  35. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/clients/test_ptab_appeals_client.py +69 -65
  36. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/clients/test_ptab_interferences_client.py +95 -69
  37. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/clients/test_ptab_trials_client.py +93 -98
  38. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/conftest.py +5 -5
  39. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/test_config.py +39 -0
  40. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/test_http_config.py +3 -0
  41. {pyuspto-0.3.4 → pyuspto-0.4.1}/tox.ini +5 -1
  42. pyuspto-0.3.4/src/pyUSPTO/utils/__init__.py +0 -11
  43. pyuspto-0.3.4/src/pyUSPTO/utils/http.py +0 -50
  44. pyuspto-0.3.4/tests/utils/test_http.py +0 -73
  45. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/ISSUE_TEMPLATE/bug-report.yml +0 -0
  46. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  47. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/ISSUE_TEMPLATE/documentation-updates.yml +0 -0
  48. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/ISSUE_TEMPLATE/feature-request.yml +0 -0
  49. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  50. {pyuspto-0.3.4 → pyuspto-0.4.1}/.github/dependabot.yml +0 -0
  51. {pyuspto-0.3.4 → pyuspto-0.4.1}/.gitignore +0 -0
  52. {pyuspto-0.3.4 → pyuspto-0.4.1}/.readthedocs.yaml +0 -0
  53. {pyuspto-0.3.4 → pyuspto-0.4.1}/CHANGELOG.md +0 -0
  54. {pyuspto-0.3.4 → pyuspto-0.4.1}/CODE_OF_CONDUCT.md +0 -0
  55. {pyuspto-0.3.4 → pyuspto-0.4.1}/CONTRIBUTING.md +0 -0
  56. {pyuspto-0.3.4 → pyuspto-0.4.1}/LICENSE +0 -0
  57. {pyuspto-0.3.4 → pyuspto-0.4.1}/_version.pyi +0 -0
  58. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/Makefile +0 -0
  59. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/_static/.gitkeep +0 -0
  60. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/advanced.rst +0 -0
  61. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/clients/bulk_data.rst +0 -0
  62. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/clients/index.rst +0 -0
  63. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/clients/patent_data.rst +0 -0
  64. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/clients/petition_decisions.rst +0 -0
  65. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/clients/ptab_appeals.rst +0 -0
  66. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/clients/ptab_interferences.rst +0 -0
  67. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/clients/ptab_trials.rst +0 -0
  68. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/config/config.rst +0 -0
  69. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/config/http_config.rst +0 -0
  70. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/config/index.rst +0 -0
  71. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/exceptions.rst +0 -0
  72. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/index.rst +0 -0
  73. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/models/base.rst +0 -0
  74. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/models/bulk_data.rst +0 -0
  75. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/models/index.rst +0 -0
  76. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/models/patent_data.rst +0 -0
  77. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/models/petition_decisions.rst +0 -0
  78. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/models/ptab.rst +0 -0
  79. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/models/utils.rst +0 -0
  80. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/api/warnings.rst +0 -0
  81. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/conf.py +0 -0
  82. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/configuration.rst +0 -0
  83. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/development.rst +0 -0
  84. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/examples/bulk_data.rst +0 -0
  85. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/examples/ifw_example.rst +0 -0
  86. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/examples/index.rst +0 -0
  87. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/examples/patent_data.rst +0 -0
  88. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/examples/petition_decisions.rst +0 -0
  89. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/examples/ptab_appeals.rst +0 -0
  90. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/examples/ptab_interferences.rst +0 -0
  91. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/examples/ptab_trials.rst +0 -0
  92. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/index.rst +0 -0
  93. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/installation.rst +0 -0
  94. {pyuspto-0.3.4 → pyuspto-0.4.1}/docs/source/quickstart.rst +0 -0
  95. {pyuspto-0.3.4 → pyuspto-0.4.1}/pyUSPTO.code-workspace +0 -0
  96. {pyuspto-0.3.4 → pyuspto-0.4.1}/requirements.txt +0 -0
  97. {pyuspto-0.3.4 → pyuspto-0.4.1}/setup.cfg +0 -0
  98. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/__init__.py +0 -0
  99. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/clients/__init__.py +0 -0
  100. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/exceptions.py +0 -0
  101. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/models/__init__.py +0 -0
  102. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/models/base.py +0 -0
  103. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/models/patent_data.py +0 -0
  104. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/models/petition_decisions.py +0 -0
  105. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/models/ptab.py +0 -0
  106. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/models/utils.py +0 -0
  107. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/py.typed +0 -0
  108. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO/warnings.py +0 -0
  109. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO.egg-info/dependency_links.txt +0 -0
  110. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO.egg-info/top_level.txt +0 -0
  111. {pyuspto-0.3.4 → pyuspto-0.4.1}/src/pyUSPTO.egg-info/zip-safe +0 -0
  112. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/__init__.py +0 -0
  113. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/clients/__init__.py +0 -0
  114. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/integration/__init__.py +0 -0
  115. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/integration/conftest.py +0 -0
  116. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/integration/test_bulk_data_integration.py +0 -0
  117. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/integration/test_patent_data_integration.py +0 -0
  118. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/integration/test_petition_decisions_integration.py +0 -0
  119. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/integration/test_ptab_appeals_integration.py +0 -0
  120. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/integration/test_ptab_interferences_integration.py +0 -0
  121. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/integration/test_ptab_trials_integration.py +0 -0
  122. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/models/__init__.py +0 -0
  123. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/models/test_bulk_data_models.py +0 -0
  124. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/models/test_patent_data_models.py +0 -0
  125. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/models/test_petition_decision_models.py +0 -0
  126. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/models/test_ptab_models.py +0 -0
  127. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/models/test_utils.py +0 -0
  128. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/test_edge_cases.py +0 -0
  129. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/test_exceptions.py +0 -0
  130. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/test_init.py +0 -0
  131. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/test_version.py +0 -0
  132. {pyuspto-0.3.4 → pyuspto-0.4.1}/tests/utils/__init__.py +0 -0
@@ -15,9 +15,9 @@ jobs:
15
15
  name: Build documentation
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: actions/checkout@v2
18
+ - uses: actions/checkout@v6
19
19
  - name: Set up Python
20
- uses: actions/setup-python@v2
20
+ uses: actions/setup-python@v6
21
21
  with:
22
22
  python-version: "3.10"
23
23
  - name: Install dependencies
@@ -31,7 +31,7 @@ jobs:
31
31
  cd docs
32
32
  make html
33
33
  - name: Archive documentation
34
- uses: actions/upload-artifact@v2
34
+ uses: actions/upload-artifact@v6
35
35
  with:
36
36
  name: documentation
37
37
  path: docs/build/html/
@@ -16,11 +16,11 @@ jobs:
16
16
  runs-on: ubuntu-latest
17
17
 
18
18
  steps:
19
- - uses: actions/checkout@v4
19
+ - uses: actions/checkout@v6
20
20
  with:
21
21
  persist-credentials: false
22
22
  - name: Set up Python
23
- uses: actions/setup-python@v5
23
+ uses: actions/setup-python@v6
24
24
  with:
25
25
  python-version: "3.x"
26
26
  - name: Install pypa/build
@@ -32,7 +32,7 @@ jobs:
32
32
  - name: Build a binary wheel and a source tarball
33
33
  run: python3 -m build
34
34
  - name: Store the distribution packages
35
- uses: actions/upload-artifact@v4
35
+ uses: actions/upload-artifact@v6
36
36
  with:
37
37
  name: python-package-distributions
38
38
  path: dist/
@@ -53,7 +53,7 @@ jobs:
53
53
 
54
54
  steps:
55
55
  - name: Download all the dists
56
- uses: actions/download-artifact@v4
56
+ uses: actions/download-artifact@v7
57
57
  with:
58
58
  name: python-package-distributions
59
59
  path: dist/
@@ -76,7 +76,7 @@ jobs:
76
76
 
77
77
  steps:
78
78
  - name: Download all the dists
79
- uses: actions/download-artifact@v4
79
+ uses: actions/download-artifact@v7
80
80
  with:
81
81
  name: python-package-distributions
82
82
  path: dist/
@@ -14,10 +14,10 @@ jobs:
14
14
  python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
15
15
 
16
16
  steps:
17
- - uses: actions/checkout@v3
17
+ - uses: actions/checkout@v6
18
18
 
19
19
  - name: Set up Python ${{ matrix.python-version }}
20
- uses: actions/setup-python@v4
20
+ uses: actions/setup-python@v6
21
21
  with:
22
22
  python-version: ${{ matrix.python-version }}
23
23
 
@@ -33,7 +33,7 @@ jobs:
33
33
  pytest tests/ --cov=src/pyUSPTO
34
34
 
35
35
  - name: Upload coverage report
36
- uses: codecov/codecov-action@v3
36
+ uses: codecov/codecov-action@v5
37
37
  with:
38
38
  fail_ci_if_error: false
39
39
 
@@ -41,10 +41,10 @@ jobs:
41
41
  runs-on: ubuntu-latest
42
42
 
43
43
  steps:
44
- - uses: actions/checkout@v3
44
+ - uses: actions/checkout@v6
45
45
 
46
46
  - name: Set up Python
47
- uses: actions/setup-python@v4
47
+ uses: actions/setup-python@v6
48
48
  with:
49
49
  python-version: "3.10"
50
50
 
@@ -31,7 +31,28 @@ config = USPTOConfig(
31
31
  client = PatentDataClient(config=config)
32
32
  ```
33
33
 
34
- Configure HTTP settings via environment variables:
34
+ ## Session Lifecycle
35
+
36
+ `USPTOConfig` manages an underlying `requests.Session`. For short-lived scripts this is cleaned up automatically, but for long-running applications or tests you may close it explicitly:
37
+
38
+ ```python
39
+ from pyUSPTO import PatentDataClient, USPTOConfig
40
+
41
+ # Option 1: Context manager
42
+ with USPTOConfig(api_key="your_key") as config:
43
+ client = PatentDataClient(config=config)
44
+ response = client.search_applications(limit=1)
45
+
46
+ # Option 2: Explicit close
47
+ config = USPTOConfig(api_key="your_key")
48
+ try:
49
+ client = PatentDataClient(config=config)
50
+ response = client.search_applications(limit=1)
51
+ finally:
52
+ config.close()
53
+ ```
54
+
55
+ ## HTTP Configuration via Environment Variables
35
56
 
36
57
  ```bash
37
58
  export USPTO_REQUEST_TIMEOUT=60.0 # Read timeout
@@ -75,24 +96,32 @@ All clients support configuration via environment variables. This is the recomme
75
96
  | `USPTO_PATENT_DATA_BASE_URL` | Base URL for Patent Data API | `https://api.uspto.gov` |
76
97
  | `USPTO_PETITION_DECISIONS_BASE_URL` | Base URL for Petition Decisions API | `https://api.uspto.gov` |
77
98
  | `USPTO_PTAB_BASE_URL` | Base URL for PTAB APIs | `https://api.uspto.gov` |
78
- | `USPTO_DOWNLOAD_CHUNK_SIZE` | Chunk size in bytes for file downloads | `8192` |
99
+
100
+ > [!NOTE]
101
+ > The base URL variables are provided in case the USPTO introduces alternate environments (e.g., a development or testing endpoint) in the future. Currently there are no such endpoints, and these defaults should not be changed.
79
102
 
80
103
  ### HTTP Transport Configuration
81
104
 
82
- | Environment Variable | Description | Default |
83
- | -------------------------- | ------------------------------------------ | -------- |
84
- | `USPTO_REQUEST_TIMEOUT` | Read timeout in seconds | `30.0` |
85
- | `USPTO_CONNECT_TIMEOUT` | Connection timeout in seconds | `10.0` |
86
- | `USPTO_MAX_RETRIES` | Maximum number of retry attempts | `3` |
87
- | `USPTO_BACKOFF_FACTOR` | Exponential backoff multiplier for retries | `2.0` |
88
- | `USPTO_POOL_CONNECTIONS` | Number of connection pools to cache | `10` |
89
- | `USPTO_POOL_MAXSIZE` | Maximum connections per pool | `10` |
105
+ | Environment Variable | Description | Default |
106
+ | ----------------------------- | ------------------------------------------ | --------------- |
107
+ | `USPTO_REQUEST_TIMEOUT` | Read timeout in seconds | `30.0` |
108
+ | `USPTO_CONNECT_TIMEOUT` | Connection timeout in seconds | `10.0` |
109
+ | `USPTO_MAX_RETRIES` | Maximum number of retry attempts | `3` |
110
+ | `USPTO_BACKOFF_FACTOR` | Exponential backoff multiplier for retries | `2.0` |
111
+ | `USPTO_POOL_CONNECTIONS` | Number of connection pools to cache | `10` |
112
+ | `USPTO_POOL_MAXSIZE` | Maximum connections per pool | `10` |
113
+ | `USPTO_DOWNLOAD_CHUNK_SIZE` | Chunk size in bytes for file downloads | `8192` |
114
+ | `USPTO_MAX_EXTRACT_SIZE` | Maximum bytes to extract from archives | None (no limit) |
90
115
 
91
116
  ### Example: Configuration
92
117
 
93
118
  ```bash
94
119
  # API Configuration
95
120
  export USPTO_API_KEY="your_api_key"
121
+ export USPTO_BULK_DATA_BASE_URL="https://api.uspto.gov"
122
+ export USPTO_PATENT_DATA_BASE_URL="https://api.uspto.gov"
123
+ export USPTO_PETITION_DECISIONS_BASE_URL="https://api.uspto.gov"
124
+ export USPTO_PTAB_BASE_URL="https://api.uspto.gov"
96
125
 
97
126
  # Increase timeouts for large downloads
98
127
  export USPTO_REQUEST_TIMEOUT=120.0
@@ -108,6 +137,9 @@ export USPTO_POOL_MAXSIZE=20
108
137
 
109
138
  # Larger chunk size for faster downloads
110
139
  export USPTO_DOWNLOAD_CHUNK_SIZE=65536
140
+
141
+ # Limit total bytes extracted from archives
142
+ export USPTO_MAX_EXTRACT_SIZE=10737418240
111
143
  ```
112
144
 
113
145
  ## Debugging with Raw Data Preservation
@@ -150,7 +182,7 @@ if response.raw_data:
150
182
  - Raw data is stored in the `raw_data` attribute of response objects
151
183
  - This increases memory usage as both parsed and raw data are kept
152
184
  - Only enable when needed for debugging - disable for better performance
153
- - All response models support `raw_data` when this flag is enabled
185
+ - Response models support `raw_data` when this flag is enabled (except StatusCodeSearchResponse)
154
186
 
155
187
  **Example: Debugging a missing field**
156
188
 
@@ -180,6 +212,7 @@ All warnings inherit from `USPTODataWarning`:
180
212
  - `USPTOBooleanParseWarning`: Y/N boolean string parsing failures
181
213
  - `USPTOTimezoneWarning`: Timezone-related issues
182
214
  - `USPTOEnumParseWarning`: Enum value parsing failures
215
+ - `USPTODataMismatchWarning`: API returns data with different identifier than requested
183
216
 
184
217
  **Controlling Warnings**
185
218
 
@@ -190,7 +223,8 @@ from pyUSPTO.warnings import (
190
223
  USPTODateParseWarning,
191
224
  USPTOBooleanParseWarning,
192
225
  USPTOTimezoneWarning,
193
- USPTOEnumParseWarning
226
+ USPTOEnumParseWarning,
227
+ USPTODataMismatchWarning
194
228
  )
195
229
 
196
230
  # Suppress all pyUSPTO data warnings
@@ -210,3 +244,31 @@ warnings.filterwarnings('always', category=USPTODataWarning)
210
244
  ```
211
245
 
212
246
  The library's permissive parsing philosophy returns `None` for fields that cannot be parsed, allowing you to retrieve partial data even when some fields have issues. Warnings inform you when this happens without stopping execution.
247
+
248
+ ## Archive Extraction Safety
249
+
250
+ Download methods that accept `extract=True` (e.g., `BulkDataClient.download_file`) automatically extract archive files (tar.gz, zip). The extraction includes the following protections:
251
+
252
+ - **Path traversal protection**: Archive members with paths that resolve outside the extraction directory are rejected.
253
+ - **Size limits**: Set `max_extract_size` on `HTTPConfig` to cap the total bytes extracted, protecting against zip bombs or file system size limitations.
254
+
255
+ ```python
256
+ from pyUSPTO import USPTOConfig, HTTPConfig, BulkDataClient
257
+
258
+ http_config = HTTPConfig(
259
+ max_extract_size=10 * 1024 * 1024 * 1024 # 10 GB
260
+ )
261
+ config = USPTOConfig(api_key="your_key", http_config=http_config)
262
+ client = BulkDataClient(config=config)
263
+
264
+ # Extraction will raise ValueError if total extracted size exceeds 10 GB
265
+ client.download_file(product_file, destination="/tmp", extract=True)
266
+ ```
267
+
268
+ Or via environment variable:
269
+
270
+ ```bash
271
+ export USPTO_MAX_EXTRACT_SIZE=10737418240 # 10 GB
272
+ ```
273
+
274
+ By default, `extract` is `False` on `BulkDataClient.download_file` and there is no size limit.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyUSPTO
3
- Version: 0.3.4
4
- Summary: A Modern Python client for accessing United Stated Patent and Trademark Office (USPTO) Open Data Portal (ODP) APIs.
3
+ Version: 0.4.1
4
+ Summary: A Modern Python client for accessing the United States Patent and Trademark Office (USPTO) Open Data Portal (ODP) APIs.
5
5
  Author-email: Andrew Piechocki <apiechocki@dunlapcodding.com>
6
6
  License-Expression: MIT
7
7
  Project-URL: GitHub, https://github.com/DunlapCoddingPC/pyUSPTO
@@ -42,7 +42,7 @@ Description-Content-Type: text/markdown
42
42
  License-File: LICENSE
43
43
  Requires-Dist: requests>=2.32.5
44
44
  Requires-Dist: typing-extensions>=4.15.0; python_version < "3.11"
45
- Requires-Dist: tzdata>=2025.2
45
+ Requires-Dist: tzdata>=2025.3
46
46
  Provides-Extra: dev
47
47
  Requires-Dist: pytest>=9.0.2; extra == "dev"
48
48
  Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
@@ -55,7 +55,7 @@ Requires-Dist: sphinx-copybutton>=0.5.2; extra == "dev"
55
55
  Requires-Dist: myst-parser>=4.0.1; extra == "dev"
56
56
  Requires-Dist: mypy>=1.19.0; extra == "dev"
57
57
  Requires-Dist: types-requests>=2.32.4; extra == "dev"
58
- Requires-Dist: ruff>=0.8.0; extra == "dev"
58
+ Requires-Dist: ruff>=0.15.0; extra == "dev"
59
59
  Dynamic: license-file
60
60
 
61
61
  # pyUSPTO
@@ -70,7 +70,7 @@ A Python client library for interacting with the United Stated Patent and Tradem
70
70
  This package provides clients for interacting with the USPTO Bulk Data API, Patent Data API, Final Petition Decisions API, and PTAB (Patent Trial and Appeal Board) APIs.
71
71
 
72
72
  > [!IMPORTANT]
73
- > The USPTO is in the process of moving their API. This package is only concerned with the new API. The [old API](https://developer.uspto.gov/) will be retired at the end of 2025.
73
+ > The USPTO is in the process of moving their Developer API. This package is only concerned with the new API. The [old API](https://developer.uspto.gov/) was officially retired at the end of 2025; however, some products have not yet been fully transitioned to the Open Data Portal API. The USPTO expects the remaining products to be transitioned to the Open Data Portal in early 2026.
74
74
 
75
75
  ## Quick Start
76
76
 
@@ -84,10 +84,11 @@ pip install pyUSPTO
84
84
  > You must have an API key for the [USPTO Open Data Portal API](https://data.uspto.gov/myodp/landing).
85
85
 
86
86
  ```python
87
- from pyUSPTO import PatentDataClient
87
+ from pyUSPTO import PatentDataClient, USPTOConfig
88
88
 
89
- # Initialize with your API key
90
- client = PatentDataClient(api_key="your_api_key_here")
89
+ # Initialize with config
90
+ config = USPTOConfig(api_key="your_api_key_here")
91
+ client = PatentDataClient(config=config)
91
92
 
92
93
  # Search for patent applications
93
94
  results = client.search_applications(inventor_name_q="Smith", limit=10)
@@ -96,56 +97,12 @@ print(f"Found {results.count} applications")
96
97
 
97
98
  ## Configuration
98
99
 
99
- All clients can be configured using one of three methods:
100
-
101
- ### Method 1: Direct API Key Initialization
102
-
103
- > [!NOTE]
104
- > This method is convenient for quick scripts but not recommended. Consider using environment variables instead.
100
+ All clients require a `USPTOConfig` object. You can create one from environment variables (recommended) or by passing the API key directly.
105
101
 
106
- ```python
107
- from pyUSPTO import (
108
- BulkDataClient,
109
- PatentDataClient,
110
- FinalPetitionDecisionsClient,
111
- PTABTrialsClient,
112
- PTABAppealsClient,
113
- PTABInterferencesClient
114
- )
115
-
116
- patent_client = PatentDataClient(api_key="your_api_key_here")
117
- bulk_client = BulkDataClient(api_key="your_api_key_here")
118
- petition_client = FinalPetitionDecisionsClient(api_key="your_api_key_here")
119
- trials_client = PTABTrialsClient(api_key="your_api_key_here")
120
- appeals_client = PTABAppealsClient(api_key="your_api_key_here")
121
- interferences_client = PTABInterferencesClient(api_key="your_api_key_here")
122
- ```
123
-
124
- ### Method 2: Using USPTOConfig
125
-
126
- ```python
127
- from pyUSPTO import (
128
- BulkDataClient,
129
- PatentDataClient,
130
- FinalPetitionDecisionsClient,
131
- PTABTrialsClient,
132
- PTABAppealsClient,
133
- PTABInterferencesClient
134
- )
135
-
136
- from pyUSPTO.config import USPTOConfig
137
-
138
- config = USPTOConfig(api_key="your_api_key_here")
139
-
140
- patent_client = PatentDataClient(config=config)
141
- bulk_client = BulkDataClient(config=config)
142
- petition_client = FinalPetitionDecisionsClient(config=config)
143
- trials_client = PTABTrialsClient(config=config)
144
- appeals_client = PTABAppealsClient(config=config)
145
- interferences_client = PTABInterferencesClient(config=config)
146
- ```
102
+ > [!TIP]
103
+ > `USPTOConfig` manages an underlying HTTP session. For long-running applications, use it as a context manager (`with USPTOConfig(...) as config:`) or call `config.close()` when done. See [ADVANCED.md](ADVANCED.md#session-lifecycle) for details.
147
104
 
148
- ### Method 3: Environment Variables (Recommended)
105
+ ### Environment Variables (Recommended)
149
106
 
150
107
  Set the environment variable in your shell:
151
108
 
@@ -162,9 +119,9 @@ from pyUSPTO import (
162
119
  FinalPetitionDecisionsClient,
163
120
  PTABTrialsClient,
164
121
  PTABAppealsClient,
165
- PTABInterferencesClient
122
+ PTABInterferencesClient,
123
+ USPTOConfig,
166
124
  )
167
- from pyUSPTO.config import USPTOConfig
168
125
 
169
126
  # Load configuration from environment
170
127
  config = USPTOConfig.from_env()
@@ -177,7 +134,17 @@ appeals_client = PTABAppealsClient(config=config)
177
134
  interferences_client = PTABInterferencesClient(config=config)
178
135
  ```
179
136
 
180
- ## API Usage Examples
137
+ ### Direct API Key
138
+
139
+ Alternatively, you can pass your API key directly when creating the config:
140
+
141
+ ```python
142
+ from pyUSPTO import USPTOConfig
143
+
144
+ config = USPTOConfig(api_key="your_api_key_here")
145
+ ```
146
+
147
+ ## Client Usage Examples
181
148
 
182
149
  > [!TIP]
183
150
  > For comprehensive examples with detailed explanations, see the [`examples/`](examples/) directory.
@@ -185,9 +152,10 @@ interferences_client = PTABInterferencesClient(config=config)
185
152
  ### Patent Data API
186
153
 
187
154
  ```python
188
- from pyUSPTO import PatentDataClient
155
+ from pyUSPTO import PatentDataClient, USPTOConfig
189
156
 
190
- client = PatentDataClient(api_key="your_api_key_here")
157
+ config = USPTOConfig(api_key="your_api_key_here")
158
+ client = PatentDataClient(config=config)
191
159
 
192
160
  # Search for applications by inventor name
193
161
  response = client.search_applications(inventor_name_q="Smith", limit=2)
@@ -199,14 +167,50 @@ if app.application_meta_data:
199
167
  print(f"Title: {app.application_meta_data.invention_title}")
200
168
  ```
201
169
 
170
+ `PatentDataClient` also provides convenience methods for common lookups:
171
+
172
+ ```python
173
+ # Look up a patent wrapper by any identifier type (you must use keyword names).
174
+ wrapper = client.get_IFW_metadata(application_number="18/045,436")
175
+ wrapper = client.get_IFW_metadata(patent_number="11,234,567")
176
+ wrapper = client.get_IFW_metadata(publication_number="2023/0012345")
177
+ wrapper = client.get_IFW_metadata(PCT_app_number="PCT/US24/12345")
178
+
179
+ # Look up USPTO status codes
180
+ status_codes = client.get_status_codes()
181
+ ```
182
+
202
183
  See [`examples/patent_data_example.py`](examples/patent_data_example.py) for detailed examples including downloading documents and publications.
203
184
 
185
+ ### Bulk Data API
186
+
187
+ ```python
188
+ from pyUSPTO import BulkDataClient, USPTOConfig
189
+
190
+ config = USPTOConfig(api_key="your_api_key_here")
191
+ client = BulkDataClient(config=config)
192
+
193
+ # Search for bulk data products
194
+ response = client.search_products(query="patent", limit=5)
195
+ print(f"Found {response.count} products matching 'patent'")
196
+
197
+ for product in response.bulk_data_product_bag:
198
+ print(f" {product.product_title_text} ({product.product_identifier})")
199
+
200
+ # Get a specific product with its files
201
+ product = client.get_product_by_id("PTGRXML", include_files=True, latest=True)
202
+ print(f"Product: {product.product_title_text}")
203
+ ```
204
+
205
+ See [`examples/bulk_data_example.py`](examples/bulk_data_example.py) for detailed examples including file downloads and archive extraction.
206
+
204
207
  ### Final Petition Decisions API
205
208
 
206
209
  ```python
207
- from pyUSPTO import FinalPetitionDecisionsClient
210
+ from pyUSPTO import FinalPetitionDecisionsClient, USPTOConfig
208
211
 
209
- client = FinalPetitionDecisionsClient(api_key="your_api_key_here")
212
+ config = USPTOConfig(api_key="your_api_key_here")
213
+ client = FinalPetitionDecisionsClient(config=config)
210
214
 
211
215
  # Search for petition decisions
212
216
  response = client.search_decisions(
@@ -227,9 +231,10 @@ See [`examples/petition_decisions_example.py`](examples/petition_decisions_examp
227
231
  ### PTAB Trials API
228
232
 
229
233
  ```python
230
- from pyUSPTO import PTABTrialsClient
234
+ from pyUSPTO import PTABTrialsClient, USPTOConfig
231
235
 
232
- client = PTABTrialsClient(api_key="your_api_key_here")
236
+ config = USPTOConfig(api_key="your_api_key_here")
237
+ client = PTABTrialsClient(config=config)
233
238
 
234
239
  # Search for IPR proceedings
235
240
  response = client.search_proceedings(
@@ -254,9 +259,10 @@ See [`examples/ptab_trials_example.py`](examples/ptab_trials_example.py) for det
254
259
  ### PTAB Appeals API
255
260
 
256
261
  ```python
257
- from pyUSPTO import PTABAppealsClient
262
+ from pyUSPTO import PTABAppealsClient, USPTOConfig
258
263
 
259
- client = PTABAppealsClient(api_key="your_api_key_here")
264
+ config = USPTOConfig(api_key="your_api_key_here")
265
+ client = PTABAppealsClient(config=config)
260
266
 
261
267
  # Search for appeal decisions
262
268
  response = client.search_decisions(
@@ -273,9 +279,10 @@ See [`examples/ptab_appeals_example.py`](examples/ptab_appeals_example.py) for d
273
279
  ### PTAB Interferences API
274
280
 
275
281
  ```python
276
- from pyUSPTO import PTABInterferencesClient
282
+ from pyUSPTO import PTABInterferencesClient, USPTOConfig
277
283
 
278
- client = PTABInterferencesClient(api_key="your_api_key_here")
284
+ config = USPTOConfig(api_key="your_api_key_here")
285
+ client = PTABInterferencesClient(config=config)
279
286
 
280
287
  # Search for interference decisions
281
288
  response = client.search_decisions(
@@ -293,60 +300,7 @@ Full documentation may be found on [Read the Docs](https://pyuspto.readthedocs.i
293
300
 
294
301
  ## Data Models
295
302
 
296
- The library uses Python dataclasses to represent API responses. All data models include type annotations for attributes and methods, making them fully compatible with static type checkers.
297
-
298
- #### Bulk Data API
299
-
300
- - `BulkDataResponse`: Top-level response from the API
301
- - `BulkDataProduct`: Information about a specific product
302
- - `ProductFileBag`: Container for file data elements
303
- - `FileData`: Information about an individual file
304
-
305
- #### Patent Data API
306
-
307
- - `PatentDataResponse`: Top-level response from the API
308
- - `PatentFileWrapper`: Information about a patent application
309
- - `ApplicationMetaData`: Metadata about a patent application
310
- - `Address`: Represents an address in the patent data
311
- - `Person`, `Applicant`, `Inventor`, `Attorney`: Person-related data classes
312
- - `Assignment`, `Assignor`, `Assignee`: Assignment-related data classes
313
- - `Continuity`, `ParentContinuity`, `ChildContinuity`: Continuity-related data classes
314
- - `PatentTermAdjustmentData`: Patent term adjustment information
315
- - And many more specialized classes for different aspects of patent data
316
-
317
- #### Final Petition Decisions API
318
-
319
- - `PetitionDecisionResponse`: Top-level response from the API
320
- - `PetitionDecision`: Complete information about a petition decision
321
- - `PetitionDecisionDocument`: Document associated with a petition decision
322
- - `DocumentDownloadOption`: Download options for petition documents
323
- - `DecisionTypeCode`: Enum for petition decision types
324
- - `DocumentDirectionCategory`: Enum for document direction categories
325
-
326
- #### PTAB Trials API
327
-
328
- - `PTABTrialProceedingResponse`: Top-level response from the API
329
- - `PTABTrialProceeding`: Information about a PTAB trial proceeding (IPR, PGR, CBM, DER)
330
- - `PTABTrialDocument`: Document associated with a trial proceeding
331
- - `PTABTrialDecision`: Decision information for a trial proceeding
332
- - `RegularPetitionerData`, `RespondentData`, `DerivationPetitionerData`: Party data for different trial types
333
- - `PTABTrialMetaData`: Trial metadata and status information
334
-
335
- #### PTAB Appeals API
336
-
337
- - `PTABAppealResponse`: Top-level response from the API
338
- - `PTABAppealDecision`: Ex parte appeal decision information
339
- - `AppellantData`: Appellant information and application details
340
- - `PTABAppealMetaData`: Appeal metadata and filing information
341
- - `PTABAppealDocumentData`: Document and decision details
342
-
343
- #### PTAB Interferences API
344
-
345
- - `PTABInterferenceResponse`: Top-level response from the API
346
- - `PTABInterferenceDecision`: Interference proceeding decision information
347
- - `SeniorPartyData`, `JuniorPartyData`, `AdditionalPartyData`: Party data classes
348
- - `PTABInterferenceMetaData`: Interference metadata and status information
349
- - `PTABInterferenceDocumentData`: Document and outcome details
303
+ The library uses Python dataclasses to represent API responses. All data models include type annotations and are fully compatible with static type checkers. For a complete list of all data models, see the [API Reference documentation](https://pyuspto.readthedocs.io/en/latest/api/models/index.html).
350
304
 
351
305
  ## Advanced Topics
352
306