{"id":24093226,"url":"https://github.com/umd-lib/top-textbooks-service","last_synced_at":"2026-02-26T16:21:10.918Z","repository":{"id":212687154,"uuid":"725281753","full_name":"umd-lib/top-textbooks-service","owner":"umd-lib","description":"Microservice for retrieving \"Top Textbooks\" data for display on the UMD library website","archived":false,"fork":false,"pushed_at":"2024-11-07T17:19:25.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-01-10T09:25:54.413Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/umd-lib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-11-29T20:20:53.000Z","updated_at":"2023-11-29T20:20:53.000Z","dependencies_parsed_at":"2024-03-27T14:26:29.641Z","dependency_job_id":"ef61260c-4c26-4514-bb36-15bab197727d","html_url":"https://github.com/umd-lib/top-textbooks-service","commit_stats":null,"previous_names":["umd-lib/top-textbooks-service"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umd-lib%2Ftop-textbooks-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umd-lib%2Ftop-textbooks-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umd-lib%2Ftop-textbooks-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umd-lib%2Ftop-textbooks-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umd-lib","download_url":"https://codeload.github.com/umd-lib/top-textbooks-service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241005375,"owners_count":19892780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-10T09:26:17.236Z","updated_at":"2026-02-26T16:21:10.912Z","avatar_url":"https://github.com/umd-lib.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# alma-service\n\nAlma Service for Drupal\n\n## Purpose\n\nThis is a flask microservice for handling alma queries in Drupal. It\nwill make requests to the Alma API to retrieve metadata.\n\n## Development Environment\n\nPython version: 3.12\n\n### Installation\n\n```zsh\ngit clone git@github.com:umd-lib/alma-service.git\ncd alma-service\npyenv install --skip-existing $(cat .python-version)\npython -m venv .venv --prompt alma\nsource .venv/bin/activate\npip install -r requirements.test.txt -e .\n```\n\n### Configuration\n\n1) Copy the \"env-template\" file to \".env\"\n\n```zsh\ncp env-template .env\n```\n\n2) Edit the file\n\n```zsh\nvi .env\n```\n\nand make the following changes:\n\n* Enter a value for the \"ALMA_API_KEY\":\n* (Optional) Uncomment the `FLASK_DEBUG=1` to run the application in debug mode\n```\n\n### Running\n\nTo run the application in debug mode, with hot code reloading:\n\n```zsh\nflask --app \"alma.web:app(config='alma_config.yaml')\" run\n```\n\nThe microservice will be available at \u003chttp://localhost:5000/\u003e,\nwith a simple HTML landing page.\n\nTo change the port, add `-p {port number}` to the `flask` command:\n\n```zsh\n# for example, to run on port 8000\nflask --app \"alma.web:app(config='alma_config.yaml')\" run -p 8000\n```\n\nCommand line queries can then be run for testing like so:\n\n```zsh\ncurl --header \"Content-Type: application/json\" --request POST --data '[\"990036902950108238\", \"990062905500108238\", \"990060785130108238\", \"990062906000108238\"]' http://127.0.0.1:5000/api/textbooks\n\ncurl --header \"Content-Type: application/json\" --request POST --data '{\"990036902950108238\": \"22226889550008238\"}' http://127.0.0.1:5000/api/textbooks\n```\n\n### Testing\n\nThis project uses the [pytest] testing framework. To run the full\n[test suite](tests):\n\n```zsh\npytest\n```\n\nTo run the test suite with coverage information from [pytest-cov]:\n\n```zsh\npytest --cov src --cov-report term-missing\n```\n\nThis project also uses [pycodestyle] as a style checker and linter:\n\n```zsh\npycodestyle .\n```\n\nConfiguration of pycodestyle is found in the [tox.ini](tox.ini) file.\n\n### Using VSCode Dev Containers\n\nThis repo has been configured to use VSCode's Development Containers.\nUpon opening this codebase in VSCode:\n\n* A notification will pop up asking if the folder should be re-opened in a\n  container. Select \"Yes\". VS Code will restart and create a Docker container\n  (this takes a minute or two, if the Docker image has not previously been\n  downloaded).\n\n* The pip install command is run as part of the Docker container setup, and\n  various VS Code extensions are automatically added.\n\n* To run the microservice and Python tools such as \"pytest\", open a terminal in\n  VS Code (select \"Terminal | New Terminal\") from the menubar.\n\n### Deploying using Docker\n\nBuild the image:\n\n```zsh\ndocker build -t docker.lib.umd.edu/alma-service:latest .\n```\n\nIf you need to build for multiple architectures (e.g., AMD and ARM), you\ncan use `docker buildx`. This assumes you have a builder named \"local\"\nconfigured for use with your docker buildx system, and you are logged in\nto a Docker repository that you can push images to:\n\n```zsh\ndocker buildx build . --builder=kube -t docker.lib.umd.edu/alma-service:latest --push\n\n# then pull the image so it is available locally\ndocker pull docker.lib.umd.edu/alma-service:latest\n```\n\nRun the container:\n\n```zsh\nexport ALMA_API_KEY=\u003cAlma API Key\u003e\ndocker run --publish 5000:5000 --env ALMA_API_KEY=$ALMA_API_KEY docker.lib.umd.edu/alma-service:latest --alma_config=alma_config.yaml\n```\n\nIf you created a `.env` file (see [Configuration](#configuration)), you\ncan run the Docker image using that file.\n\n```zsh\ndocker run -p 5000:5000 \\\n    --env-file .env \\\n    docker.lib.umd.edu/alma-service:latest --alma_config=alma_config.yaml\n```\n\n[pytest]: https://docs.pytest.org/en/7.3.x/\n[pytest-cov]: https://pypi.org/project/pytest-cov/\n[pycodestyle]: https://pycodestyle.pycqa.org/en/latest/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumd-lib%2Ftop-textbooks-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumd-lib%2Ftop-textbooks-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumd-lib%2Ftop-textbooks-service/lists"}