Skip to main content

SWH-loader-dir

The Software Heritage Directory Loader is a tool and a library.

Its sole purpose is to walk a local directory and inject into the SWH dataset all unknown contained files from that directory structure.

Configuration

The loader needs a configuration file in {/etc/softwareheritage | ~/.config/swh | ~/.swh}/loader/dir.yml.

This file should be similar to this (adapt according to your needs):

storage:
  cls: remote
  args:
    url: http://localhost:5002/

Run

To run the loader, you can use either:

  • python3's toplevel
  • celery

Toplevel

Load directory directly from code or toplevel:

dir_path = '/home/storage/dir/'

# Fill in those
origin = {'url': 'some-origin', 'type': 'dir'}
visit_date = 'Tue, 3 May 2017 17:16:32 +0200'
revision = {
    'author': {'name': 'some', 'fullname': 'one', 'email': 'something'},
    'committer': {'name': 'some', 'fullname': 'one', 'email': 'something'},
    'message': '1.0 Released',
    'date': None,
    'committer_date': None,
    'type': 'tar',
    'metadata': {}
}
import logging
logging.basicConfig(level=logging.DEBUG)

from swh.loader.dir.tasks import LoadDirRepository
l = LoadDirRepository()
l.run_task(dir_path=dir_path, origin=origin, visit_date=visit_date,
           revision=revision, release=None, branch_name='master')

Celery

To use celery, add the following entries in the {/etc/softwareheritage | ~/.config/swh | ~/.swh}/worker.yml` file:

task_modules:
  - swh.loader.dir.tasks
task_queues:
  - swh_loader_dir

cf. swh-core's documentation for more details.

You can then send the following message to the task queue:

from swh.loader.dir.tasks import LoadDirRepository

# Fill in those
origin = {'url': 'some-origin', 'type': 'dir'}
visit_date = 'Tue, 3 May 2017 17:16:32 +0200'
release = None
revision = {}
occurrence = {}

# Send message to the task queue
LoaderDirRepository().run(('/path/to/dir', origin, visit_date, revision, release, [occurrence]))

Release files for swh.loader.dir 0.0.35

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

Source distribution (sdist)

Source distribution for swh.loader.dir 0.0.35
File Size Uploaded
swh.loader.dir-0.0.35.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for swh.loader.dir 0.0.35
File Interpreter ABI Platform
swh.loader.dir-0.0.35-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / swh.loader.dir-0.0.35.tar.gz

Download URL swh.loader.dir-0.0.35.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cc36bd04f86b0cb6d1693b8f87c78750c91e6d37dcf6c4084f0530deadc804ce
BLAKE2b-256 checksum
How to use checksums
b3f3bcaa6af8ecd803e9e58cd7e0022ad280c0fa0dc7115b364321fc7448f974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

Release files / swh.loader.dir-0.0.35-py3-none-any.whl

Download URL swh.loader.dir-0.0.35-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a22c2cd2413ff2efdaa4bfab13993b669b2abbe44ebf953a74045bdad6a4d84
BLAKE2b-256 checksum
How to use checksums
f7e5c9f7d11b03b013c4ca3232d855c87cd62ce8cc49901baafc4ee73e44fc4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

Release history Release notifications | RSS feed

This release

0.0.35 This release

2 release files

0.0.32

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