Metadata-Version: 2.4
Name: fpds
Version: 1.4.2
Summary: A parser for the Federal Procurement Data System (FPDS) Atom feed
Author-email: Derek Herincx <derek663@gmail.com>
License: The MIT License
        
        Copyright (c) 2022 Derek Herincx
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
        
Project-URL: Repository, https://github.com/dherincx92/fpds
Project-URL: Issues, https://github.com/dherincx92/fpds/issues
Keywords: fpds,python,atom feed,cli,xml
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp<4.0.0,>=3.9.2
Requires-Dist: click<9.0.0,>=8.1.3
Requires-Dist: tqdm<5.0.0,>=4.67.1
Provides-Extra: dev
Requires-Dist: ipdb==0.13.9; extra == "dev"
Requires-Dist: ipython==8.5.0; extra == "dev"
Requires-Dist: ruff==0.12.1; extra == "dev"
Requires-Dist: mypy>=0.910; extra == "dev"
Requires-Dist: types-tqdm==4.64.7.9; extra == "dev"
Requires-Dist: versioningit<4.0.0,>=3.0.0; extra == "dev"
Provides-Extra: tests
Requires-Dist: pytest==7.1.3; extra == "tests"
Requires-Dist: pytest-cov==3.0.0; extra == "tests"
Requires-Dist: pytest-runner==6.0.0; extra == "tests"
Provides-Extra: packaging
Requires-Dist: build==0.8.0; extra == "packaging"
Requires-Dist: wheel==0.37.1; extra == "packaging"
Requires-Dist: twine==5.1.1; extra == "packaging"
Provides-Extra: all
Requires-Dist: fpds[dev]; extra == "all"
Requires-Dist: fpds[tests]; extra == "all"
Requires-Dist: fpds[packaging]; extra == "all"
Dynamic: license-file

# fpds
A light-weight, pythonic parser for the Federal Procurement Data System (FPDS) ATOM Feed.
Reference [here](https://www.fpds.gov/fpdsng_cms/index.php/en/).


## Motivation
The FPDS ATOM feed limits each request to 10 records, which forces users to deal with pagination. Additonally, data is exported as XML, which proves annoying. `fpds` will handle all pagination and data
transformation to provide users with a nice JSON representation of the
equivalent XML data and attributes.


## Setup
As of version 1.5.0, this library manages dependencies using `uv`. It is
_highly_ recommended since this library is tested with it.


### Installing `uv`

You can follow any of the methods found [here](https://docs.astral.sh/uv/getting-started/installation/). If on Linux or MacOS, we recommend using Homebrew:

```
$ brew install uv
```

Once `uv` is installed, you can use the project Makefile to ensure your local environment is synced with the latest library installation. Start by running `make install` — this will check the status of the `uv.lock` file, and install all project dependencies + extras

### Local Development

For linting and formatting, we use `ruff`. See `pyproject.toml`
for specific configuration.

```
$ make formatters
```

You can clean the clutter and unwanted noise from tools using:

```
$ make clean
```

### Testing
```
$ make local-test
```

## Usage
For a list of valid search criteria parameters, consult FPDS documentation
found [here](https://www.fpds.gov/wiki/index.php/Atom_Feed_Usage). Parameters
will follow the `URL String` format shown in the link above, with the
following exceptions:

 + Colons (:) will be replaced by equal signs (=)
 + Certain parameters enclose their value in quotations. `fpds` will
automatically determine if quotes are needed, so simply enclose your
entire criteria string in quotes.

 For example, `AGENCY_CODE:"3600"` should be used as `"AGENCY_CODE=3600"`.

Via CLI:
```
$  fpds parse "LAST_MOD_DATE=[2022/01/01, 2022/05/01]" "AGENCY_CODE=7504"
```

By default, data will be dumped into an `.fpds` folder at the user's
`$HOME` directory. If you wish to override this behavior, provide the `-o`
option. The directory will be created if it doesn't exist.

As of v1.5.0, you can opt out of regex validation by setting the `-k` flag
to `False` — this is helpful in scenarios when either the regex pattern has
been altered by the ATOM feed or a new parameter name is supported, but not
yet added to the configuration in this library.

```
$  fpds parse "LAST_MOD_DATE=[2022/01/01, 2022/05/01]" "AGENCY_CODE=7504" -o ~/.my-preferred-dir
```

Same request via python interpreter:
```
import asyncio
from fpds import fpdsRequest

request = fpdsRequest(
    LAST_MOD_DATE="[2022/01/01, 2022/05/01]",
    AGENCY_CODE="7504"
)

# returns records as an async generator
gen = request.iter_data()

# evaluating generator entries
records = []
async for entry in gen:
    records.append(entry)

# or letting `data` method evaluate generator for you
records = asyncio.run(request.data())
```


# Highlights

Between v1.2.1 and v1.3.0, significant improvements were made with `asyncio`. Here are some rough benchmarks in estimated data extraction + post-processing
times:

| v1.2.1 | v.1.3.0 |
-------- | --------
188.46   | 29.40
190.38   | 28.14
187.20   | 27.66

Using `v.1.2.1`, the average completion time is 188.68 seconds (~3min).
Using `v.1.3.0`, the average completion time is 28.40 seconds.

This equates to a <u>**84.89%**</u> decrease in completion time!

# Notes

Please be aware that this project is an after-hours passion of mine. I do my best to accomodate requests the best I can, but I receive no $$$ for any of the work I do here.
