Skip to main content

Downloading assets from the web in a reproducible way

Project description

web-asset-vendor

Downloading assets from the web in a reproducible way.

Intentionally this was used to fetch web-dev assets like .js ans .css files from cdn's but the generic resolver pattern allows you to download everything you want (images, binarys, ...).

Example Usage

main.py

from web_asset_vendor import Fetcher
fetcher = Fetcher.from_yaml("dependencies.yaml")
fetcher.fetch()

Note: Optionally one will not simply initialize Fetcher with a yaml file. Instead, one would use the Constructor.

dependencies.yaml

config:
  output: vendor/
  fixiation: True  # WIP
  resolvers:

    # CLOUDFLARE
    - url: https://cdnjs.cloudflare.com/ajax/libs/${author}/${version}/js/${package}.min.js
    - url: https://cdnjs.cloudflare.com/ajax/libs/${author}/${version}/css/${package}.min.css
      tags: [ css ]

    # UNPKG
    - url: https://unpkg.com/${package}@${version}/dist/${package}.min.js
    - url: https://unpkg.com/${package}@${version}/dist/css/${package}.min.css
      tags: [ css ]

assets:
  bootstrap.min.css:
    folder: css/bootstrap
    resolveWith: [ css ]
    resolvedBy:
      author: twitter-bootstrap
      version: 4.6.0
      package: bootstrap

  bootstrap.min.js:
    folder: js/bootstrap
    resolvedBy:
      author: twitter-bootstrap
      version: 4.6.0
      package: bootstrap

  jquery.min.js:
    resolvedBy:
      version: 3.6.0
      package: jquery

example output:

.
+-- vendor
|   +-- css
|   |   +-- bootstrap
|   |   |   +-- bootstrap.min.css
|   +-- js
|   |   +-- bootstrap
|   |   |   +-- bootstrap.min.js
|   +-- uncategorized
|   |   +-- jquery.min.css

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

web-asset-vendor-0.1.0b1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

web_asset_vendor-0.1.0b1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file web-asset-vendor-0.1.0b1.tar.gz.

File metadata

  • Download URL: web-asset-vendor-0.1.0b1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for web-asset-vendor-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 34914aee07f86310ddcce7eeb5d7ad03664b058f0323f578ff23f28a4e75ea5e
MD5 bcb5b21671e304bc607e4ac31dc586cc
BLAKE2b-256 dc63feea6d687eadfe51a2d4dc888b9e57fd97f56609b1736db3c8f0c40ca8c8

See more details on using hashes here.

File details

Details for the file web_asset_vendor-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: web_asset_vendor-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for web_asset_vendor-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 580787a2f08c192d05df2188772d809c50a1abc82473d914290af53eb7ae9909
MD5 1ac637a4fe6792c89250e716ac640430
BLAKE2b-256 671f2e5a11e88f2ffd86f9f8a3e31e6ba05670dd303feec448d31805ed539c88

See more details on using hashes here.

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