Skip to main content

fpds

A light-weight, pythonic parser for the Federal Procurement Data System (FPDS) ATOM Feed. Reference here.

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. 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. 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 84.89% 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.

Metadata

Release files for fpds 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fpds 1.5.0
File Size Uploaded
fpds-1.5.0.tar.gz 109.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fpds 1.5.0
File Interpreter ABI Platform
fpds-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 131.5 kB

Release files / fpds-1.5.0.tar.gz

Download URL fpds-1.5.0.tar.gz
Size 109.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fac208a4050c5891f9f30b3dbf1ec4f1acd337513fa603202dc6a33ee690fb92
BLAKE2b-256 checksum
How to use checksums
fba5aa282e251f7070a4dcc01d6b1ea35d7e00489290b6039c46ca1cb76d596e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.21

Release files / fpds-1.5.0-py3-none-any.whl

Download URL fpds-1.5.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adcb6666cf33259463febc5456a8f357ec9d53c8f9b3030c031240e959d81ad8
BLAKE2b-256 checksum
How to use checksums
080a28b9bb1896c367439559768257f8adec219ebad4490fcf5675436fb25d7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.21

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page