A simple API for serving the metadata from the RPM repositories
Project description
mdapi
A simple and fast API for serving the metadata from the RPM repositories
Installation
For development
- Install Python 3, Virtualenv and Poetry on your Fedora Linux installation.
$ sudo dnf install python3 python3-virtualenv poetry
- 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
- Set up and activate a virtual environment within the directory of the cloned repository.
$ virtualenv venv $ source venv/bin/activate
- Check the validity of the project configuration and install the project dependencies from the lockfile.
$ (venv) poetry check $ (venv) poetry install
For container image
- Install Podman on your Fedora Linux installation.
$ sudo dnf install podman
- Ensure that
- The project directory is the present working directory.
- The virtual environment with the project is activated, following the instructions provided in the development installation section.
- The project configuration is modified according to needs in
myconfig.py
file, following the instructions provided in the configuration setup section.
- 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
- Ensure that
- The project directory is the present working directory.
- The virtual environment with the project is activated, following the instructions provided in the development installation section.
- Execute the following command to view the help message.
Output$ (venv) mdapi --help
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
- Execute the following command to view the project version.
Output$ (venv) mdapi --version
mdapi, version 3.0.0
Testing the project
- Ensure that
- The project directory is the present working directory.
- The virtual environment with the project is activated, following the instructions provided in the development installation section.
- The storage partition on which test database directory is located has at least 1.5 GiB of free space.
- Execute the following command to run the code quality checks and testcases.
$ (venv) tox
Setting up the configuration
- Ensure that
- The project directory is the present working directory.
- Make a copy of the default configuration on your local storage.
$ cp mdapi/confdata/standard.py mdapi/confdata/myconfig.py
- Make changes to the copied configuration file to suit the requirements.
$ nano confdata/myconfig.py
Fetching the databases
- Ensure that
- The project directory is the present working directory.
- The virtual environment with the project is activated, following the instructions provided in the development installation section.
- The storage partition on which database directory is located has at least 6 GiB of free space.
- Execute the following command to start fetching the database, while referencing to the modified configuration file.
$ (venv) mdapi --conffile myconfig.py database
- Note that the first run of the database fetching command will take a long time, depending on the internet connection.
Serving the application
- Ensure that
- The project directory is the present working directory.
- The virtual environment with the project is activated, following the instructions provided in the development installation section.
- Execute the following command to start serving the application, while referencing to the modified configuration file.
$ (venv) mdapi --conffile myconfig.py serveapp
- When done with serving the application, press
Ctrl
+C
to raise aKeyboardInterrupt
and exit out of the program.
In container or pod
Serving the application
- Ensure that
- The project directory is the present working directory.
- The virtual environment with the project is activated, following the instructions provided in the development installation section.
- The container image is built and available locally.
- The databases are downloaded to the database directory, following the instructions provided in the database fetching section.
- Execute the following command to start the serving the application.
This command assumes that the database directory is$ (venv) podman run -v /var/tmp:/var/tmp -p 8080:8080 -ti mdapi:$(poetry version -s)
/var/tmp
(which is the default) and the service port is8080
(which is the default).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mdapi-3.1.6a5.tar.gz
(28.9 kB
view details)
Built Distribution
mdapi-3.1.6a5-py3-none-any.whl
(37.3 kB
view details)
File details
Details for the file mdapi-3.1.6a5.tar.gz
.
File metadata
- Download URL: mdapi-3.1.6a5.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.10.7-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 720f92bb4aed5c4b53820689efde60a1936ba2e0e53762375a42d600c08f8a96 |
|
MD5 | ca4d2c4e8604949ee0ed4e81e030d4ad |
|
BLAKE2b-256 | 8127296ef97203d83cb04b79a055f9e3699048cf3e5d12573be46943c6a0a2a5 |
File details
Details for the file mdapi-3.1.6a5-py3-none-any.whl
.
File metadata
- Download URL: mdapi-3.1.6a5-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.10.7-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e8802d564cb35cc5760907a2a7405b7965fa514d01c18e81d042c53203738c8 |
|
MD5 | 249bab2a96931cc3c38573e4c386de58 |
|
BLAKE2b-256 | e90eee31e4b237b05c223972fa56b6b9b0d407aac12def2798121bd88a6637fe |