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.2.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.2-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fetchcode-0.8.2.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.2.tar.gz
Algorithm Hash digest
SHA256 53ff257905235fb264fe7c151c1eb37c35112dd41464ab1f346e9a5caf0f01c8
MD5 1b23a010b0706e43ffe0d676eceb176c
BLAKE2b-256 6ee2e8855b0665685cd43ad2da8912ba4c1f8fd77739ce2da451dbb5b89411cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetchcode-0.8.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: fetchcode-0.8.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bc2d97d6b6f1e49a05137b9e772c40a758031db3cae547559a14cc9857109e7e
MD5 9c8204f0fe2ee14f9375571e1eb7e364
BLAKE2b-256 a602f6beaa6505cf91d667178adb21ce6d8923ead47243f58300e01dbce155bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetchcode-0.8.2-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