diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,8 @@ .coverage .eggs/ __pycache__ -dist +build/ +dist/ *.egg-info version.txt .vscode/ diff --git a/README.db_testing b/README.db_testing deleted file mode 100644 --- a/README.db_testing +++ /dev/null @@ -1,17 +0,0 @@ -Running database-related tests -============================== - -Python tests for this module include tests that cannot be run without a local -Postgres database. You are not obliged to run those tests though: - -- `make test`: will run all tests -- `make test-nodb`: will run only tests that do not need a local DB -- `make test-db`: will run only tests that do need a local DB - -If you do want to run DB-related tests, you should: - -- ensure that your user is authorized to create and drop DBs, and in particular - DBs named "softwareheritage-test" and "softwareheritage-dev" - -- ensure that you have the storage testdata repository checked out in - ../swh-storage-testdata diff --git a/README.dev b/README.md rename from README.dev rename to README.md --- a/README.dev +++ b/README.md @@ -1,9 +1,66 @@ -README.dev -========== +swh-storage +=========== + +Abstraction layer over the archive, allowing to access all stored source code +artifacts as well as their metadata. + +See the +[documentation](https://docs.softwareheritage.org/devel/swh-storage/index.html) +for more details. + +Tests +----- + +Python tests for this module include tests that cannot be run without a local +Postgres database. You are not obliged to run those tests though: + +- `make test`: will run all tests +- `make test-nodb`: will run only tests that do not need a local DB +- `make test-db`: will run only tests that do need a local DB + +If you do want to run DB-related tests, you should ensure you have access zith +sufficient privileges to a Postgresql database. + +### Using your system database + +You need to: + +- ensure that your user is authorized to create and drop DBs, and in particular + DBs named "softwareheritage-test" and "softwareheritage-dev" + +- ensure that you have the storage testdata repository checked out in + ../swh-storage-testdata + +### Using pifpaf + +[pifpaf](https://github.com/jd/pifpaf) is a suite of fixtures and a +command-line tool that allows to start and stop daemons for a quick throw-away +usage. + +It can be used to run tests that need a Postgres database without any other +configuration reauired nor the need to have special access to a running +database: + +```bash + +$ pifpaf run postgresql make test-db +[snip] +---------------------------------------------------------------------- +Ran 124 tests in 56.203s + +OK +``` + +Note that pifpaf is not yet available as a Debian package, so you may have to +install it in a venv. + + +Development +----------- A test server could locally be running for tests. -# Sample configuration +### Sample configuration In either /etc/softwareheritage/storage/storage.yml, ~/.config/swh/storage.yml or ~/.swh/storage.yml: @@ -40,7 +97,7 @@ Note that the 'root' path should exist on disk. -# Run server +### Run server Command: ``` @@ -50,7 +107,7 @@ This runs a local swh-storage api at 5002 port. -# And then what? +### And then what? In your upper layer (loader-git, loader-svn, etc...), you can define a remote storage with this snippet of yaml configuration. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1,8 +1,20 @@ #!/usr/bin/env python3 +# Copyright (C) 2015-2018 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU General Public License version 3, or any later version +# See top-level LICENSE file for more information -import os from setuptools import setup, find_packages +from os import path +from io import open + +here = path.abspath(path.dirname(__file__)) + +# Get the long description from the README file +with open(path.join(here, 'README.md'), encoding='utf-8') as f: + long_description = f.read() + def parse_requirements(name=None): if name: @@ -11,7 +23,7 @@ reqf = 'requirements.txt' requirements = [] - if not os.path.exists(reqf): + if not path.exists(reqf): return requirements with open(reqf) as f: @@ -26,6 +38,8 @@ setup( name='swh.storage', description='Software Heritage storage manager', + long_description=long_description, + long_description_content_type='text/markdown', author='Software Heritage developers', author_email='swh-devel@inria.fr', url='https://forge.softwareheritage.org/diffusion/DSTO/', @@ -33,13 +47,25 @@ scripts=[ 'bin/swh-storage-add-dir', ], + setup_requires=['vcversioner'], install_requires=parse_requirements() + parse_requirements('swh'), extras_require={ 'testing': parse_requirements('test'), 'schemata': ['SQLAlchemy'], 'listener': ['kafka_python'], }, - setup_requires=['vcversioner'], vcversioner={}, include_package_data=True, + classifiers=[ + "Programming Language :: Python :: 3", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: OS Independent", + "Development Status :: 5 - Production/Stable", + ], + project_urls={ + 'Bug Reports': 'https://forge.softwareheritage.org/maniphest', + 'Funding': 'https://www.softwareheritage.org/donate', + 'Source': 'https://forge.softwareheritage.org/source/swh-storage', + }, )