mdapi


Namemdapi JSON
Version 3.1.5 PyPI version JSON
download
home_pagehttps://github.com/fedora-infra/mdapi
SummaryA simple API for serving the metadata from the RPM repositories
upload_time2024-04-08 07:54:13
maintainerPierre-Yves Chibon
docs_urlNone
authorPierre-Yves Chibon
requires_python<4.0,>=3.8
licenseGPL-3.0-or-later
keywords rpm centos fedora metadata repositories
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # mdapi

A simple and fast API for serving the metadata from the RPM repositories

## Installation

### For development

1. Install [Python 3](https://www.python.org/), [Virtualenv](https://virtualenv.pypa.io/en/latest/) and [Poetry](https://python-poetry.org/) on your Fedora Linux installation.
   ```
   $ sudo dnf install python3 python3-virtualenv poetry
   ```
2. Clone the repository to your local storage and make it your present working directory.
   ```
   $ git clone git@github.com:fedora-infra/mdapi.git
   $ cd mdapi
   ```
3. Set up and activate a virtual environment within the directory of the cloned repository.
   ```
   $ virtualenv venv
   $ source venv/bin/activate
   ```
4. Check the validity of the project configuration and install the project dependencies from the lockfile.
   ```
   $ (venv) poetry check
   $ (venv) poetry install
   ```

### For container image

1. Install [Podman](https://podman.io/) on your Fedora Linux installation.
   ```
   $ sudo dnf install podman
   ```
2. Ensure that
   1. The project directory is the present working directory.
   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.
   3. The project configuration is modified according to needs in `myconfig.py` file, following the instructions provided in the **[configuration setup](#setting-up-the-configuration)** section.
3. Execute the following command to build the container image.
   ```
   $ (venv) podman build -t "mdapi:$(poetry version -s)" .
   ```

## Usage

### In development

#### Viewing the help message and version

1. Ensure that
   1. The project directory is the present working directory.
   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.
2. Execute the following command to view the help message.
   ```
   $ (venv) mdapi --help
   ```
   Output
   ```
   Usage: mdapi [OPTIONS] COMMAND [ARGS]...
   
     A simple API for serving the metadata from the RPM repositories
   
   Options:
     -c, --conffile PATH  Read configuration from the specified Python file
     --version            Show the version and exit.
     --help               Show this message and exit.
   
   Commands:
     database  Fetch SQLite databases from all active Fedora Linux and EPEL...
     serveapp  Start the API server for querying repository metadata
   ```
3. Execute the following command to view the project version.
   ```
   $ (venv) mdapi --version
   ```
   Output
   ```
   mdapi, version 3.0.0
   ```

#### Testing the project

1. Ensure that
   1. The project directory is the present working directory.
   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.
   3. The storage partition on which [test database directory](https://github.com/fedora-infra/mdapi/blob/develop/tests/__init__.py#L33) is located has at least 1.5 GiB of free space.
2. Execute the following command to run the code quality checks and testcases.
   ```
   $ (venv) tox
   ```

#### Setting up the configuration

1. Ensure that
   1. The project directory is the present working directory.
2. Make a copy of the default configuration on your local storage.
   ```
   $ cp mdapi/confdata/standard.py mdapi/confdata/myconfig.py
   ```
3. Make changes to the copied configuration file to suit the requirements.
   ```
   $ nano confdata/myconfig.py
   ```

#### Fetching the databases

1. Ensure that
   1. The project directory is the present working directory.
   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.
   3. The storage partition on which [database directory](https://github.com/fedora-infra/mdapi/blob/develop/mdapi/confdata/standard.py#L29) is located has at least 6 GiB of free space.
2. Execute the following command to start fetching the database, while referencing to the modified configuration file.
   ```
   $ (venv) mdapi --conffile myconfig.py database
   ```
3. Note that the first run of the database fetching command will take a long time, depending on the internet connection.

#### Serving the application

1. Ensure that
   1. The project directory is the present working directory.
   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.
2. Execute the following command to start serving the application, while referencing to the modified configuration file.
   ```
   $ (venv) mdapi --conffile myconfig.py serveapp
   ```
3. When done with serving the application, press `Ctrl` + `C` to raise a `KeyboardInterrupt` and exit out of the program.

### In container or pod

#### Serving the application

1. Ensure that 
   1. The project directory is the present working directory.
   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.
   3. The container image is built and available locally.
   4. The databases are downloaded to the [database directory](https://github.com/fedora-infra/mdapi/blob/develop/mdapi/confdata/standard.py#L29), following the instructions provided in the **[database fetching](#fetching-the-databases)** section.
2. Execute the following command to start the serving the application.
   ```
   $ (venv) podman run -v /var/tmp:/var/tmp -p 8080:8080 -ti mdapi:$(poetry version -s)
   ```
   This command assumes that the database directory is `/var/tmp` (which is the [default](https://github.com/fedora-infra/mdapi/blob/develop/mdapi/confdata/standard.py#L29)) and the service port is `8080` (which is the [default](https://github.com/fedora-infra/mdapi/blob/develop/mdapi/confdata/standard.py#L87)).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fedora-infra/mdapi",
    "name": "mdapi",
    "maintainer": "Pierre-Yves Chibon",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "pingou@pingoured.fr",
    "keywords": "rpm, centos, fedora, metadata, repositories",
    "author": "Pierre-Yves Chibon",
    "author_email": "pingou@pingoured.fr",
    "download_url": "https://files.pythonhosted.org/packages/ad/5d/a44eb14889e1bd6b57b501091fe7c55eeb97fe8bb3e5141189f662e35ab4/mdapi-3.1.5.tar.gz",
    "platform": null,
    "description": "# mdapi\n\nA simple and fast API for serving the metadata from the RPM repositories\n\n## Installation\n\n### For development\n\n1. Install [Python 3](https://www.python.org/), [Virtualenv](https://virtualenv.pypa.io/en/latest/) and [Poetry](https://python-poetry.org/) on your Fedora Linux installation.\n   ```\n   $ sudo dnf install python3 python3-virtualenv poetry\n   ```\n2. Clone the repository to your local storage and make it your present working directory.\n   ```\n   $ git clone git@github.com:fedora-infra/mdapi.git\n   $ cd mdapi\n   ```\n3. Set up and activate a virtual environment within the directory of the cloned repository.\n   ```\n   $ virtualenv venv\n   $ source venv/bin/activate\n   ```\n4. Check the validity of the project configuration and install the project dependencies from the lockfile.\n   ```\n   $ (venv) poetry check\n   $ (venv) poetry install\n   ```\n\n### For container image\n\n1. Install [Podman](https://podman.io/) on your Fedora Linux installation.\n   ```\n   $ sudo dnf install podman\n   ```\n2. Ensure that\n   1. The project directory is the present working directory.\n   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.\n   3. The project configuration is modified according to needs in `myconfig.py` file, following the instructions provided in the **[configuration setup](#setting-up-the-configuration)** section.\n3. Execute the following command to build the container image.\n   ```\n   $ (venv) podman build -t \"mdapi:$(poetry version -s)\" .\n   ```\n\n## Usage\n\n### In development\n\n#### Viewing the help message and version\n\n1. Ensure that\n   1. The project directory is the present working directory.\n   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.\n2. Execute the following command to view the help message.\n   ```\n   $ (venv) mdapi --help\n   ```\n   Output\n   ```\n   Usage: mdapi [OPTIONS] COMMAND [ARGS]...\n   \n     A simple API for serving the metadata from the RPM repositories\n   \n   Options:\n     -c, --conffile PATH  Read configuration from the specified Python file\n     --version            Show the version and exit.\n     --help               Show this message and exit.\n   \n   Commands:\n     database  Fetch SQLite databases from all active Fedora Linux and EPEL...\n     serveapp  Start the API server for querying repository metadata\n   ```\n3. Execute the following command to view the project version.\n   ```\n   $ (venv) mdapi --version\n   ```\n   Output\n   ```\n   mdapi, version 3.0.0\n   ```\n\n#### Testing the project\n\n1. Ensure that\n   1. The project directory is the present working directory.\n   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.\n   3. The storage partition on which [test database directory](https://github.com/fedora-infra/mdapi/blob/develop/tests/__init__.py#L33) is located has at least 1.5 GiB of free space.\n2. Execute the following command to run the code quality checks and testcases.\n   ```\n   $ (venv) tox\n   ```\n\n#### Setting up the configuration\n\n1. Ensure that\n   1. The project directory is the present working directory.\n2. Make a copy of the default configuration on your local storage.\n   ```\n   $ cp mdapi/confdata/standard.py mdapi/confdata/myconfig.py\n   ```\n3. Make changes to the copied configuration file to suit the requirements.\n   ```\n   $ nano confdata/myconfig.py\n   ```\n\n#### Fetching the databases\n\n1. Ensure that\n   1. The project directory is the present working directory.\n   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.\n   3. The storage partition on which [database directory](https://github.com/fedora-infra/mdapi/blob/develop/mdapi/confdata/standard.py#L29) is located has at least 6 GiB of free space.\n2. Execute the following command to start fetching the database, while referencing to the modified configuration file.\n   ```\n   $ (venv) mdapi --conffile myconfig.py database\n   ```\n3. Note that the first run of the database fetching command will take a long time, depending on the internet connection.\n\n#### Serving the application\n\n1. Ensure that\n   1. The project directory is the present working directory.\n   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.\n2. Execute the following command to start serving the application, while referencing to the modified configuration file.\n   ```\n   $ (venv) mdapi --conffile myconfig.py serveapp\n   ```\n3. When done with serving the application, press `Ctrl` + `C` to raise a `KeyboardInterrupt` and exit out of the program.\n\n### In container or pod\n\n#### Serving the application\n\n1. Ensure that \n   1. The project directory is the present working directory.\n   2. The virtual environment with the project is activated, following the instructions provided in the **[development installation](#for-development)** section.\n   3. The container image is built and available locally.\n   4. The databases are downloaded to the [database directory](https://github.com/fedora-infra/mdapi/blob/develop/mdapi/confdata/standard.py#L29), following the instructions provided in the **[database fetching](#fetching-the-databases)** section.\n2. Execute the following command to start the serving the application.\n   ```\n   $ (venv) podman run -v /var/tmp:/var/tmp -p 8080:8080 -ti mdapi:$(poetry version -s)\n   ```\n   This command assumes that the database directory is `/var/tmp` (which is the [default](https://github.com/fedora-infra/mdapi/blob/develop/mdapi/confdata/standard.py#L29)) and the service port is `8080` (which is the [default](https://github.com/fedora-infra/mdapi/blob/develop/mdapi/confdata/standard.py#L87)).\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "A simple API for serving the metadata from the RPM repositories",
    "version": "3.1.5",
    "project_urls": {
        "Documentation": "https://github.com/fedora-infra/mdapi/blob/develop/README.md",
        "Homepage": "https://github.com/fedora-infra/mdapi",
        "Repository": "https://github.com/fedora-infra/mdapi"
    },
    "split_keywords": [
        "rpm",
        " centos",
        " fedora",
        " metadata",
        " repositories"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08f1cdccc8a9dcb970d5096c3db6baee7c6facf86b0f6dd3cb0f540b9a3f6f94",
                "md5": "828a285c32e918c2c4a99073c185dbcb",
                "sha256": "e72f2548b1eed77e5c152a218504c55f1e2ad9e0e149927ea453e850f84d5b75"
            },
            "downloads": -1,
            "filename": "mdapi-3.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "828a285c32e918c2c4a99073c185dbcb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 37176,
            "upload_time": "2024-04-08T07:54:10",
            "upload_time_iso_8601": "2024-04-08T07:54:10.867462Z",
            "url": "https://files.pythonhosted.org/packages/08/f1/cdccc8a9dcb970d5096c3db6baee7c6facf86b0f6dd3cb0f540b9a3f6f94/mdapi-3.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad5da44eb14889e1bd6b57b501091fe7c55eeb97fe8bb3e5141189f662e35ab4",
                "md5": "c53a374b572df723721885cc4cdc6fdc",
                "sha256": "bce7eeedfd5216e1a5102ffdddb37ac2a237ac3232a5e3bc54f99b1be84292bc"
            },
            "downloads": -1,
            "filename": "mdapi-3.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "c53a374b572df723721885cc4cdc6fdc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 28838,
            "upload_time": "2024-04-08T07:54:13",
            "upload_time_iso_8601": "2024-04-08T07:54:13.763796Z",
            "url": "https://files.pythonhosted.org/packages/ad/5d/a44eb14889e1bd6b57b501091fe7c55eeb97fe8bb3e5141189f662e35ab4/mdapi-3.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-08 07:54:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fedora-infra",
    "github_project": "mdapi",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "mdapi"
}
        
Elapsed time: 0.22312s