No description
Find a file
Valentin Lorentz 596e8c6c40 Fix crash of 'swh lister run' when called without -l
```
$ swh lister run
Traceback (most recent call last):
  File "/home/dev/.local/bin/swh", line 33, in <module>
    sys.exit(load_entry_point('swh.core', 'console_scripts', 'swh')())
  File "/home/dev/swh-environment/swh-core/swh/core/cli/__init__.py", line 144, in main
    return swh(auto_envvar_prefix="SWH")
  File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/dev/.local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/dev/swh-environment/swh-lister/swh/lister/cli.py", line 68, in run
    get_lister(lister, **config).run()
  File "/home/dev/swh-environment/swh-lister/swh/lister/__init__.py", line 75, in get_lister
    raise ValueError(
ValueError: Invalid lister None: only supported listers are ['arch', 'aur', 'bitbucket', 'bower', 'cgit', 'conda', 'cpan', 'cran', 'crates', 'debian', 'fedora', 'gitea', 'github', 'gitlab', 'gnu', 'gogs', 'golang', 'hackage', 'hex', 'launchpad', 'maven', 'nixguix', 'npm', 'nuget', 'opam', 'packagist', 'phabricator', 'pubdev', 'puppet', 'pypi', 'rubygems', 'sourceforge', 'tuleap']
```
2023-05-10 10:19:26 +02:00
docs Use http_retry decorator from swh.core.retry module 2023-04-13 14:19:57 +02:00
sql Revert to the pre-qless refactoring version 2016-09-13 14:57:26 +02:00
swh Fix crash of 'swh lister run' when called without -l 2023-05-10 10:19:26 +02:00
.git-blame-ignore-revs Add .git-blame-ignore-revs file with automatic reformatting commits 2022-04-08 15:15:26 +02:00
.gitignore Use pkg_resources to get the package version instead of vcversioner 2019-11-22 15:49:23 +01:00
.pre-commit-config.yaml pre-commit: Bump isort from 5.10.1 to 5.11.5 2023-02-02 11:07:28 +01:00
ACKNOWLEDGEMENTS add ACKNOWLEDGEMENTS 2015-04-26 15:54:25 +02:00
CODE_OF_CONDUCT.md add code of conduct document 2019-07-11 16:29:36 +02:00
conftest.py fix(hex): Use only updated_after for pagination 2023-03-14 17:59:46 +00:00
CONTRIBUTORS gogs: Introduce Gogs lister 2022-08-03 16:22:06 +05:30
LICENSE add license information 2015-04-26 16:24:32 +02:00
Makefile Makefile: add from swh-py-template 2015-10-27 14:35:54 +01:00
MANIFEST.in pytest: Define plugin and declare it in the root conftest 2020-09-02 12:25:15 +02:00
mypy.ini feat(fedora): Introduce fedora lister 2022-11-15 15:53:52 +05:30
pyproject.toml pre-commit: Add isort hook and configuration 2020-09-17 17:48:25 +02:00
pytest.ini add strict asyncio_mode in pytest.ini 2022-05-09 12:13:28 +02:00
README.md feat(hex): Use updated_after search query 2023-03-14 17:59:46 +00:00
requirements-swh.txt Use http_retry decorator from swh.core.retry module 2023-04-13 14:19:57 +02:00
requirements-test.txt requirements-test: Remove pytest pinning to < 7 2022-04-06 17:14:45 +02:00
requirements.txt feat(fedora): Introduce fedora lister 2022-11-15 15:53:52 +05:30
setup.cfg pre-commit, tox: Bump black from 19.10b0 to 22.3.0 2022-04-08 15:13:41 +02:00
setup.py feat(hex): Use updated_after search query 2023-03-14 17:59:46 +00:00
tox.ini mypy: Bump to 1.0.1 and fix new typing errors 2023-02-17 17:56:07 +01:00

swh-lister

This component from the Software Heritage stack aims to produce listings of software origins and their urls hosted on various public developer platforms or package managers. As these operations are quite similar, it provides a set of Python modules abstracting common software origins listing behaviors.

It also provides several lister implementations, contained in the following Python modules:

  • swh.lister.bitbucket
  • swh.lister.cgit
  • swh.lister.cran
  • swh.lister.debian
  • swh.liser.fedora
  • swh.lister.gitea
  • swh.lister.github
  • swh.lister.gitlab
  • swh.lister.gnu
  • swh.lister.gogs
  • swh.lister.golang
  • swh.lister.hex
  • swh.lister.launchpad
  • swh.lister.maven
  • swh.lister.npm
  • swh.lister.packagist
  • swh.lister.phabricator
  • swh.lister.pypi
  • swh.lister.tuleap

Dependencies

All required dependencies can be found in the requirements*.txt files located at the root of the repository.

Local deployment

lister configuration

Each lister implemented so far by Software Heritage (bitbucket, cgit, cran, debian, gitea, github, gitlab, gnu, golang, launchpad, npm, packagist, phabricator, pypi, tuleap, maven) must be configured by following the instructions below (please note that you have to replace <lister_name> by one of the lister name introduced above).

Preparation steps

  1. mkdir ~/.config/swh/
  2. create configuration file ~/.config/swh/listers.yml

Configuration file sample

Minimalistic configuration shared by all listers to add in file ~/.config/swh/listers.yml:

scheduler:
  cls: 'remote'
  args:
    url: 'http://localhost:5008/'

credentials: {}

Note: This expects scheduler (5008) service to run locally

Executing a lister

Once configured, a lister can be executed by using the swh CLI tool with the following options and commands:

$ swh --log-level DEBUG lister -C ~/.config/swh/listers.yml run --lister <lister_name> [lister_parameters]

Examples:

$ swh --log-level DEBUG lister -C ~/.config/swh/listers.yml run --lister bitbucket

$ swh --log-level DEBUG lister -C ~/.config/swh/listers.yml run --lister cran

$ swh --log-level DEBUG lister -C ~/.config/swh/listers.yml run --lister gitea url=https://codeberg.org/api/v1/

$ swh --log-level DEBUG lister -C ~/.config/swh/listers.yml run --lister gitlab url=https://salsa.debian.org/api/v4/

$ swh --log-level DEBUG lister -C ~/.config/swh/listers.yml run --lister npm

$ swh --log-level DEBUG lister -C ~/.config/swh/listers.yml run --lister pypi

Licensing

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See top-level LICENSE file for the full text of the GNU General Public License along with this program.