Skip to main content

fetchcode is a library to reliably fetch code via HTTP, FTP and version control systems.

Project description

FetchCode is a library to reliably fetch code via HTTP, FTP and version control systems. It can work using plain HTTP and FTP URLs, as well as Package URLs and version control (VCS) URLs as used in Python pip and as specified in SPDX Package Download Location

Homepage and support: https://github.com/aboutcode-org/fetchcode

Why FetchCode?

It is surprisingly difficult to have a simple API to consistently fetch code from package repositories, version control repositories and APIs: each site and each package manager has its own unique and peculiar ways. FetchCode goal is to abstract all these details and make it easy to fetch things reliably.

Development installation

Clone the repo:

git clone https://github.com/aboutcode-org/fetchcode

Then install all the requirements using this command (on POSIX):

./configure --dev

Running tests

To run test suite use:

pytest -vvs

Usage

Fetch a code archive and get a fetchcode.fetch.Response object back:

>>> from fetchcode import fetch
>>> f = fetch('https://github.com/aboutcode-org/fetchcode/archive/ab65b2e645c889887227ea49eb3332d885fd0a54.zip')
>>> f.location
'/tmp/tmp_cm02xsg'
>>> f.content_type
'application/zip'
>>> f.url
'https://github.com/aboutcode-org/fetchcode/archive/ab65b2e645c889887227ea49eb3332d885fd0a54.zip'

Fetch some package metadata and get a fetchcode.packagedcode_models.Package object back:

>>> from fetchcode import package
>>> list(package.info('pkg:rubygems/files'))
[Package(type='rubygems', namespace=None, name='files', version=None)]

Fetch a purl and get a fetchcode.fetch.Response object back:

>>> from fetchcode import fetch
>>> f = fetch('pkg:swift/github.com/Alamofire/Alamofire@5.4.3')
>>> f.location
'/tmp/tmp_cm02xsg'
>>> f.content_type
'application/zip'
>>> f.url
'https://github.com/Alamofire/Alamofire/archive/5.4.3.zip'

Ecosystems supported for fetching a purl from fetchcode:

  • alpm

  • apk

  • bitbucket

  • cargo

  • composer

  • conda

  • cpan

  • cran

  • deb

  • gem

  • generic

  • github

  • golang

  • hackage

  • hex

  • luarocks

  • maven

  • npm

  • nuget

  • pub

  • pypi

  • swift

License

  • SPDX-License-Identifier: Apache-2.0

Copyright (c) nexB Inc. and others.

Acknowledgements, Funding, Support and Sponsoring

This project is funded, supported and sponsored by:

  • Generous support and contributions from users like you!

  • the European Commission NGI programme

  • the NLnet Foundation

  • the Swiss State Secretariat for Education, Research and Innovation (SERI)

  • Google, including the Google Summer of Code and the Google Seasons of Doc programmes

  • Mercedes-Benz Group

  • Microsoft and Microsoft Azure

  • AboutCode ASBL

  • nexB Inc.

Europa logo EC DG Connect logo

NGI logo NLnet foundation logo

AboutCode logo nexB logo

This project was funded through the NGI0 Core Fund, a fund established by NLnet with financial support from the European Commission’s Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 101092990.

NGI Zero Core Logo https://nlnet.nl/project/VulnerableCode-enhancements/

This project was funded through the NGI0 Entrust Fund, a fund established by NLnet with financial support from the European Commission’s Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 101069594.

NGI Zero Entrust logo https://nlnet.nl/project/Back2source/

This project was funded through the NGI0 Core Fund, a fund established by NLnet with financial support from the European Commission’s Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 101092990.

NGI Zero Core Logo https://nlnet.nl/project/Back2source-next/

This project was funded through the NGI0 Entrust Fund, a fund established by NLnet with financial support from the European Commission’s Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 101069594.

NGI Zero Entrust logo https://nlnet.nl/project/purl2all/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fetchcode-0.8.1.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fetchcode-0.8.1-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file fetchcode-0.8.1.tar.gz.

File metadata

  • Download URL: fetchcode-0.8.1.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fetchcode-0.8.1.tar.gz
Algorithm Hash digest
SHA256 0b0cbaa14cda48937a73136e8afd151c2a7dac860175bbf185cc1c2b4d70c6e0
MD5 8a87c9b7a367c15f4ac8dbdea002f59b
BLAKE2b-256 b9efef3d055288e3547c6e2f8828062758e80c580aef2fe08e841e6d12a6fae1

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetchcode-0.8.1.tar.gz:

Publisher: pypi-release.yml on aboutcode-org/fetchcode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fetchcode-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: fetchcode-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fetchcode-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d60898c123b821a38ddb2c2bee70ef4afdd4f4edc97ea6758a1136d873103c98
MD5 14ecdf3e556aced5f162c1c7c3b7623c
BLAKE2b-256 5b7c0730265de10765c4a489116139f630ff3fa21070b80c288cc1561ff4fc20

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetchcode-0.8.1-py3-none-any.whl:

Publisher: pypi-release.yml on aboutcode-org/fetchcode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page