fastagsdata 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FastAgsData
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.
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastagsdata
3
+ Version: 0.1.0
4
+ Summary: Python client for FastAgsData — single source for cleaned alternative ags data
5
+ Author-email: FastAgsData <support@fastagsdata.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://fastagsdata.com
8
+ Project-URL: Documentation, https://fastagsdata.com/docs
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Financial and Insurance Industry
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: requests
18
+ Requires-Dist: pyarrow
19
+ Requires-Dist: pandas
20
+ Dynamic: license-file
21
+
22
+ # fastagsdata
23
+
24
+ Single source for cleaned alternative ags data.
25
+
26
+ Python client for the [FastAgsData](https://fastagsdata.com) API — cleaned USDA agricultural fundamentals delivered as pandas DataFrames.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ pip install fastagsdata
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ ```python
37
+ import fastagsdata
38
+
39
+ fastagsdata.set_key('your-api-key')
40
+
41
+ # Get WASDE corn ending stocks
42
+ df = fastagsdata.get('wasde', comdty='c', param='stx')
43
+
44
+ # Get NASS yields for Illinois
45
+ df = fastagsdata.get('nass', comdty='c', param='yld', shape_id='us.il')
46
+
47
+ # Multiple commodities and years
48
+ df = fastagsdata.get('wasde', comdty=['c', 's', 'w'], year=[2023, 2024])
49
+
50
+ # Wildcard params
51
+ df = fastagsdata.get('nass', comdty='c', param='prg%')
52
+ ```
53
+
54
+ ## API key
55
+
56
+ Set your key in one of three ways:
57
+
58
+ ```python
59
+ # 1. Set globally
60
+ fastagsdata.set_key('your-api-key')
61
+
62
+ # 2. Environment variable
63
+ export FASTAGSDATA_API_KEY=your-api-key
64
+
65
+ # 3. Per-request
66
+ df = fastagsdata.get('wasde', api_key='your-api-key')
67
+ ```
68
+
69
+ Get your API key at [fastagsdata.com](https://fastagsdata.com).
70
+
71
+ ## Parameters
72
+
73
+ | Parameter | Description | Example |
74
+ |------------|-------------|---------|
75
+ | `source` | Data source | `wasde`, `nass`, `nass_txt`, `export_sales`, `inspections`, `flashsales` |
76
+ | `comdty` | Commodity | `c`, `s`, `w`, `w.win`, `w.spr`, `b`, `sg`, `fs`, `mx`, `o`, `ry`, `sf` |
77
+ | `param` | Parameter | `yld`, `ap`, `stx`, `prg%` (supports `%` wildcards) |
78
+ | `shape_id` | Geography | `us`, `us.il`, `us.ia` |
79
+ | `shape_lvl`| Administrative level | `0` (national), `1` (state), `2` (county) |
80
+ | `year` | Matches source, generally marketing year | `2024`, `[2023, 2024]` |
81
+
82
+ All parameters support comma-separated strings or Python lists.
83
+
84
+ ## Sources
85
+
86
+ | Source | Description | Link | Parameters |
87
+ |--------|-------------|------|------------|
88
+ | `wasde` | World Agricultural Supply and Demand Estimates. Monthly balance sheet projections for major crops. | [USDA WASDE](https://www.usda.gov/oce/commodity/wasde) | `stx` (ending stocks), `prd` (production), `yld` (yield), `ap` (area planted), `ah` (area harvested), and more |
89
+ | `nass` | Final values from NASS QuickStats. No revision history — always reflects the latest number. Updated day after each text release. | [USDA QuickStats](https://quickstats.nass.usda.gov/) | `yld`, `ap`, `ah`, `prd`, `stx`, `prg%` (crop progress) |
90
+ | `nass_txt` | Parsed directly from NASS text releases (Stocks, Acreage, Crop Progress & Conditions, Crush, Grind). Available on release day and preserves revision history across subsequent releases. | [USDA NASS](https://www.nass.usda.gov/) | Same as `nass` |
91
+ | `export_sales` | Weekly export sales and shipments by commodity and destination. | [USDA FAS](https://apps.fas.usda.gov/esrquery/) | `net_sales`, `exports`, `outstanding` |
92
+ | `inspections` | Weekly grain inspections for export by port and commodity. | [USDA AMS](https://www.ams.usda.gov/) | `inspections` |
93
+ | `flashsales` | Large single-day export sales reported under daily reporting requirements. | [USDA FAS](https://apps.fas.usda.gov/esrquery/) | `flash_sales` |
94
+
95
+ > **Note:** Not all commodity/param combinations from QuickStats are currently saved. If you need a combination that isn't available, reach out to support@fastagsdata.com and it will be added within 24 hours.
96
+
97
+ > **Note:** Not all NASS text reports are currently being parsed. To request additional reports, reach out to support@fastagsdata.com.
98
+
99
+ ## Response
100
+
101
+ Returns a pandas DataFrame with columns: `date_ref`, `date_release`, `source`, `comdty`, `shape_id`, `param`, `value`, `year`. Date columns are `datetime64` type.
@@ -0,0 +1,80 @@
1
+ # fastagsdata
2
+
3
+ Single source for cleaned alternative ags data.
4
+
5
+ Python client for the [FastAgsData](https://fastagsdata.com) API — cleaned USDA agricultural fundamentals delivered as pandas DataFrames.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install fastagsdata
11
+ ```
12
+
13
+ ## Quick start
14
+
15
+ ```python
16
+ import fastagsdata
17
+
18
+ fastagsdata.set_key('your-api-key')
19
+
20
+ # Get WASDE corn ending stocks
21
+ df = fastagsdata.get('wasde', comdty='c', param='stx')
22
+
23
+ # Get NASS yields for Illinois
24
+ df = fastagsdata.get('nass', comdty='c', param='yld', shape_id='us.il')
25
+
26
+ # Multiple commodities and years
27
+ df = fastagsdata.get('wasde', comdty=['c', 's', 'w'], year=[2023, 2024])
28
+
29
+ # Wildcard params
30
+ df = fastagsdata.get('nass', comdty='c', param='prg%')
31
+ ```
32
+
33
+ ## API key
34
+
35
+ Set your key in one of three ways:
36
+
37
+ ```python
38
+ # 1. Set globally
39
+ fastagsdata.set_key('your-api-key')
40
+
41
+ # 2. Environment variable
42
+ export FASTAGSDATA_API_KEY=your-api-key
43
+
44
+ # 3. Per-request
45
+ df = fastagsdata.get('wasde', api_key='your-api-key')
46
+ ```
47
+
48
+ Get your API key at [fastagsdata.com](https://fastagsdata.com).
49
+
50
+ ## Parameters
51
+
52
+ | Parameter | Description | Example |
53
+ |------------|-------------|---------|
54
+ | `source` | Data source | `wasde`, `nass`, `nass_txt`, `export_sales`, `inspections`, `flashsales` |
55
+ | `comdty` | Commodity | `c`, `s`, `w`, `w.win`, `w.spr`, `b`, `sg`, `fs`, `mx`, `o`, `ry`, `sf` |
56
+ | `param` | Parameter | `yld`, `ap`, `stx`, `prg%` (supports `%` wildcards) |
57
+ | `shape_id` | Geography | `us`, `us.il`, `us.ia` |
58
+ | `shape_lvl`| Administrative level | `0` (national), `1` (state), `2` (county) |
59
+ | `year` | Matches source, generally marketing year | `2024`, `[2023, 2024]` |
60
+
61
+ All parameters support comma-separated strings or Python lists.
62
+
63
+ ## Sources
64
+
65
+ | Source | Description | Link | Parameters |
66
+ |--------|-------------|------|------------|
67
+ | `wasde` | World Agricultural Supply and Demand Estimates. Monthly balance sheet projections for major crops. | [USDA WASDE](https://www.usda.gov/oce/commodity/wasde) | `stx` (ending stocks), `prd` (production), `yld` (yield), `ap` (area planted), `ah` (area harvested), and more |
68
+ | `nass` | Final values from NASS QuickStats. No revision history — always reflects the latest number. Updated day after each text release. | [USDA QuickStats](https://quickstats.nass.usda.gov/) | `yld`, `ap`, `ah`, `prd`, `stx`, `prg%` (crop progress) |
69
+ | `nass_txt` | Parsed directly from NASS text releases (Stocks, Acreage, Crop Progress & Conditions, Crush, Grind). Available on release day and preserves revision history across subsequent releases. | [USDA NASS](https://www.nass.usda.gov/) | Same as `nass` |
70
+ | `export_sales` | Weekly export sales and shipments by commodity and destination. | [USDA FAS](https://apps.fas.usda.gov/esrquery/) | `net_sales`, `exports`, `outstanding` |
71
+ | `inspections` | Weekly grain inspections for export by port and commodity. | [USDA AMS](https://www.ams.usda.gov/) | `inspections` |
72
+ | `flashsales` | Large single-day export sales reported under daily reporting requirements. | [USDA FAS](https://apps.fas.usda.gov/esrquery/) | `flash_sales` |
73
+
74
+ > **Note:** Not all commodity/param combinations from QuickStats are currently saved. If you need a combination that isn't available, reach out to support@fastagsdata.com and it will be added within 24 hours.
75
+
76
+ > **Note:** Not all NASS text reports are currently being parsed. To request additional reports, reach out to support@fastagsdata.com.
77
+
78
+ ## Response
79
+
80
+ Returns a pandas DataFrame with columns: `date_ref`, `date_release`, `source`, `comdty`, `shape_id`, `param`, `value`, `year`. Date columns are `datetime64` type.
@@ -0,0 +1,69 @@
1
+ """FastAgsData - Single Source for Cleaned Alternative Ags Data."""
2
+
3
+ import base64, gzip, os, requests, pyarrow as pa, pandas as pd
4
+ from io import BytesIO
5
+
6
+ URL = 'https://api.fastagsdata.com/fundamentals'
7
+ _api_key = os.environ.get('FASTAGSDATA_API_KEY', '')
8
+
9
+
10
+ def set_key(key):
11
+ global _api_key
12
+ _api_key = key
13
+
14
+
15
+ def get(source=None, comdty=None, param=None, shape_id=None, shape_lvl=None, year=None,
16
+ api_key=None):
17
+ """Query USDA agricultural fundamentals. Returns a pandas DataFrame.
18
+
19
+ Args:
20
+ source: Data source (nass, wasde, basis, export_sales, inspections, flashsales)
21
+ comdty: Commodity code (c, s, w, w.win, w.spr, b, sg, fs, mx, o, ry, sf)
22
+ param: Parameter code (e.g. yld, ap, stx, prg%). Use % for wildcards.
23
+ shape_id: Geography ID (e.g. us, us.il, us.ia)
24
+ shape_lvl: Administrative level (0=national, 1=state, 2=county)
25
+ year: Matches source, generally marketing year (e.g. 2024)
26
+ api_key: Override the global API key for this request
27
+
28
+ All params support comma-separated lists or Python lists:
29
+ comdty='c,s,w' or comdty=['c', 's', 'w']
30
+ year='2023,2024' or year=[2023, 2024]
31
+
32
+ Use % for wildcards: param='prg%'
33
+
34
+ Examples:
35
+ df = fastagsdata.get('wasde')
36
+ df = fastagsdata.get('wasde', comdty='c', year=2025)
37
+ df = fastagsdata.get('nass', comdty='c', param='cnd%', shape_lvl=1)
38
+ df = fastagsdata.get('nass', comdty=['c','s'], year=[2023,2024])
39
+ """
40
+ key = api_key or _api_key
41
+ if not key:
42
+ raise ValueError("Set API key: fastagsdata.set_key('...'), export FASTAGSDATA_API_KEY, or pass api_key=")
43
+
44
+ _fmt = lambda v: ','.join(str(x) for x in v) if isinstance(v, (list, tuple)) else str(v)
45
+ params = {}
46
+ if source: params['source'] = _fmt(source)
47
+ if comdty: params['comdty'] = _fmt(comdty)
48
+ if param: params['param'] = _fmt(param)
49
+ if shape_id: params['shape_id'] = _fmt(shape_id)
50
+ if shape_lvl is not None: params['shape_lvl'] = _fmt(shape_lvl)
51
+ if year: params['year'] = _fmt(year)
52
+
53
+ headers = {'X-API-Key': key, 'Accept': 'application/vnd.apache.arrow.stream'}
54
+ dfs, cursor = [], None
55
+ while True:
56
+ p = {**params, **({'cursor': cursor} if cursor else {})}
57
+ r = requests.get(URL, headers=headers, params=p)
58
+ if r.status_code != 200:
59
+ raise RuntimeError(f"API error {r.status_code}: {r.text[:200]}")
60
+ raw = gzip.decompress(base64.b64decode(r.content))
61
+ dfs.append(pa.ipc.open_stream(BytesIO(raw)).read_all().to_pandas())
62
+ if r.headers.get('X-Has-More') != 'true':
63
+ break
64
+ cursor = r.headers.get('X-Next-Cursor')
65
+ df = pd.concat(dfs, ignore_index=True) if dfs else pd.DataFrame()
66
+ for col in ('date_ref', 'date_release'):
67
+ if col in df.columns:
68
+ df[col] = pd.to_datetime(df[col])
69
+ return df
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastagsdata
3
+ Version: 0.1.0
4
+ Summary: Python client for FastAgsData — single source for cleaned alternative ags data
5
+ Author-email: FastAgsData <support@fastagsdata.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://fastagsdata.com
8
+ Project-URL: Documentation, https://fastagsdata.com/docs
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Financial and Insurance Industry
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: requests
18
+ Requires-Dist: pyarrow
19
+ Requires-Dist: pandas
20
+ Dynamic: license-file
21
+
22
+ # fastagsdata
23
+
24
+ Single source for cleaned alternative ags data.
25
+
26
+ Python client for the [FastAgsData](https://fastagsdata.com) API — cleaned USDA agricultural fundamentals delivered as pandas DataFrames.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ pip install fastagsdata
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ ```python
37
+ import fastagsdata
38
+
39
+ fastagsdata.set_key('your-api-key')
40
+
41
+ # Get WASDE corn ending stocks
42
+ df = fastagsdata.get('wasde', comdty='c', param='stx')
43
+
44
+ # Get NASS yields for Illinois
45
+ df = fastagsdata.get('nass', comdty='c', param='yld', shape_id='us.il')
46
+
47
+ # Multiple commodities and years
48
+ df = fastagsdata.get('wasde', comdty=['c', 's', 'w'], year=[2023, 2024])
49
+
50
+ # Wildcard params
51
+ df = fastagsdata.get('nass', comdty='c', param='prg%')
52
+ ```
53
+
54
+ ## API key
55
+
56
+ Set your key in one of three ways:
57
+
58
+ ```python
59
+ # 1. Set globally
60
+ fastagsdata.set_key('your-api-key')
61
+
62
+ # 2. Environment variable
63
+ export FASTAGSDATA_API_KEY=your-api-key
64
+
65
+ # 3. Per-request
66
+ df = fastagsdata.get('wasde', api_key='your-api-key')
67
+ ```
68
+
69
+ Get your API key at [fastagsdata.com](https://fastagsdata.com).
70
+
71
+ ## Parameters
72
+
73
+ | Parameter | Description | Example |
74
+ |------------|-------------|---------|
75
+ | `source` | Data source | `wasde`, `nass`, `nass_txt`, `export_sales`, `inspections`, `flashsales` |
76
+ | `comdty` | Commodity | `c`, `s`, `w`, `w.win`, `w.spr`, `b`, `sg`, `fs`, `mx`, `o`, `ry`, `sf` |
77
+ | `param` | Parameter | `yld`, `ap`, `stx`, `prg%` (supports `%` wildcards) |
78
+ | `shape_id` | Geography | `us`, `us.il`, `us.ia` |
79
+ | `shape_lvl`| Administrative level | `0` (national), `1` (state), `2` (county) |
80
+ | `year` | Matches source, generally marketing year | `2024`, `[2023, 2024]` |
81
+
82
+ All parameters support comma-separated strings or Python lists.
83
+
84
+ ## Sources
85
+
86
+ | Source | Description | Link | Parameters |
87
+ |--------|-------------|------|------------|
88
+ | `wasde` | World Agricultural Supply and Demand Estimates. Monthly balance sheet projections for major crops. | [USDA WASDE](https://www.usda.gov/oce/commodity/wasde) | `stx` (ending stocks), `prd` (production), `yld` (yield), `ap` (area planted), `ah` (area harvested), and more |
89
+ | `nass` | Final values from NASS QuickStats. No revision history — always reflects the latest number. Updated day after each text release. | [USDA QuickStats](https://quickstats.nass.usda.gov/) | `yld`, `ap`, `ah`, `prd`, `stx`, `prg%` (crop progress) |
90
+ | `nass_txt` | Parsed directly from NASS text releases (Stocks, Acreage, Crop Progress & Conditions, Crush, Grind). Available on release day and preserves revision history across subsequent releases. | [USDA NASS](https://www.nass.usda.gov/) | Same as `nass` |
91
+ | `export_sales` | Weekly export sales and shipments by commodity and destination. | [USDA FAS](https://apps.fas.usda.gov/esrquery/) | `net_sales`, `exports`, `outstanding` |
92
+ | `inspections` | Weekly grain inspections for export by port and commodity. | [USDA AMS](https://www.ams.usda.gov/) | `inspections` |
93
+ | `flashsales` | Large single-day export sales reported under daily reporting requirements. | [USDA FAS](https://apps.fas.usda.gov/esrquery/) | `flash_sales` |
94
+
95
+ > **Note:** Not all commodity/param combinations from QuickStats are currently saved. If you need a combination that isn't available, reach out to support@fastagsdata.com and it will be added within 24 hours.
96
+
97
+ > **Note:** Not all NASS text reports are currently being parsed. To request additional reports, reach out to support@fastagsdata.com.
98
+
99
+ ## Response
100
+
101
+ Returns a pandas DataFrame with columns: `date_ref`, `date_release`, `source`, `comdty`, `shape_id`, `param`, `value`, `year`. Date columns are `datetime64` type.
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ fastagsdata/__init__.py
5
+ fastagsdata.egg-info/PKG-INFO
6
+ fastagsdata.egg-info/SOURCES.txt
7
+ fastagsdata.egg-info/dependency_links.txt
8
+ fastagsdata.egg-info/requires.txt
9
+ fastagsdata.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ requests
2
+ pyarrow
3
+ pandas
@@ -0,0 +1 @@
1
+ fastagsdata
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fastagsdata"
7
+ version = "0.1.0"
8
+ description = "Python client for FastAgsData — single source for cleaned alternative ags data"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ { name = "FastAgsData", email = "support@fastagsdata.com" },
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Financial and Insurance Industry",
18
+ "Intended Audience :: Science/Research",
19
+ "Programming Language :: Python :: 3",
20
+ "Topic :: Scientific/Engineering",
21
+ ]
22
+ dependencies = [
23
+ "requests",
24
+ "pyarrow",
25
+ "pandas",
26
+ ]
27
+
28
+ [project.urls]
29
+ Homepage = "https://fastagsdata.com"
30
+ Documentation = "https://fastagsdata.com/docs"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+