How xlcnd/isbnlib-bnf works
1. Repository purpose
- This is a small Python package, isbnlib-bnf, whose job is to add a new metadata provider named bnf to the isbnlib ecosystem.
- The external dependency boundary is the BnF Catalogue Général service from the Bibliothèque nationale de France, used to retrieve book metadata for French publications.
2. Core runtime package
- The production code lives entirely in the isbnlib_bnf/ package.
- __init__.py is the package entry point and likely exposes the plugin in the form expected by isbnlib.
- _bnf.py is the implementation module where the BnF-specific lookup and metadata mapping logic resides.
3. Primary data flow
- An isbnlib consumer asks for metadata through the bnf provider.
- The plugin translates an ISBN into a BnF lookup request.
- BnF response data is parsed and normalized into the metadata shape isbnlib expects.
- The normalized metadata is returned to the caller, making BnF an interchangeable provider behind the isbnlib plugin interface.
4. Integration boundary
- The main architectural boundary is between:
- the local Python plugin code, and
- the remote BnF catalogue service.
- Everything else in the repo supports packaging, testing, and release of that integration layer.
5. Test subsystem
- Tests are isolated under isbnlib_bnf/test/.
- test_metadata.py appears to be the main verification point, likely checking that metadata extraction and provider behavior work as expected.
- The presence of a dedicated test package suggests the repository focuses on correctness of response parsing and provider output rather than on multiple application modules.
6. Packaging and distribution
- The project is distributed as a standard Python package using setup.py, setup.cfg, and MANIFEST.in.
- Dependency management is split into runtime and development requirements via requirements.txt, requirements-dev.in, and requirements-dev.txt.
- This is a library-style repository, not an application server or CLI tool.
7. Development and quality tooling
- tox.ini and tox-dev.ini indicate isolated test and lint environments.
- setup.cfg likely centralizes formatting, linting, and test configuration.
- codeql-analysis.yml suggests automated security scanning is part of the quality pipeline.
8. CI/CD and release flow
- GitHub Actions workflows handle the main repo automation:
- basictests.yml for test execution,
- codeql-analysis.yml for code scanning,
- create-release.yaml for release publication,
- wip.yml and stale.yml for contribution hygiene.
- This repository is maintained as a packaged open-source library with automated validation and release steps.
9. Documentation and contributor surface
- README.rst explains installation and usage at the package level.
- Standard project governance files are present: LICENSE-LGPL.txt, CODE_OF_CONDUCT.md, CONTRIBUTING.md, SECURITY.md, and issue/PR templates.
- These files matter operationally because they define how the library is consumed and maintained, though they do not affect runtime behavior.
10. What to draw in an architecture diagram
- The central node should be the isbnlib_bnf plugin package.
- Draw one outbound dependency from that package to the BnF Catalogue Général service.
- Draw one inbound dependency from isbnlib or any application using isbnlib into this plugin.
- Surround it with supporting boxes for tests, packaging/distribution, and GitHub Actions CI.
11. Architectural summary
- Overall, this is a thin integration plugin: minimal local state, no database, no internal service mesh, and no persistent infrastructure.
- Its architecture is dominated by request/response translation between isbnlib and an external bibliographic catalog.
Main entry points: _bnf.py BnF lookup · __init__.py bnf entry · basictests.yml GitHub Actions · test_metadata.py Metadata tests
Components 16
Runtime
Core plugin code and external service boundary
- isbnlib app · Any application or library asking isbnlib for BnF metadata
- bnf entry · Package entry point exposing the BnF provider to isbnlib
isbnlib_bnf/__init__.py - BnF lookup · ISBN lookup, request translation, and metadata normalization against the BnF catalogue
isbnlib_bnf/_bnf.py - BnF catalogue · Bibliothèque nationale de France Catalogue Général used as the metadata source
- Plugin package · The installable isbnlib-bnf distribution containing the runtime provider
Support
Tests, packaging, and project documentation
- Tests · Automated verification for provider behavior and metadata parsing
isbnlib_bnf/test/test_metadata.py - Metadata tests · Primary checks for returned metadata shape and lookup behavior
isbnlib_bnf/test/test_metadata.py - Packaging · Setuptools and release metadata for building and publishing the library
setup.py - Build config · Shared package, lint, and test configuration
setup.cfg - Requirements · Runtime and development dependency pinning
requirements.txt - Tox envs · Isolated test and development environments
tox.ini - Docs & policy · README, contribution guidance, license, and security policy
README.rst
Automation
CI and release workflows
- GitHub Actions · Automated tests, scanning, release, and repository hygiene
.github/workflows/basictests.yml - Test workflow · Workflow that runs the package test suite
.github/workflows/basictests.yml - CodeQL · Automated code scanning workflow
.github/workflows/codeql-analysis.yml - Release flow · Workflow that publishes releases
.github/workflows/create-release.yaml
Connections 21
- isbnlib app → bnf entry: requests metadata · An isbnlib consumer invokes the provider through the plugin entry point
- bnf entry → BnF lookup: delegates · The entry module hands provider work to the BnF implementation
- BnF lookup → BnF catalogue: queries · ISBN lookups are translated into requests to the remote BnF catalogue
- BnF catalogue → BnF lookup: returns data · Catalogue responses are parsed and normalized by the provider
- BnF lookup → isbnlib app: metadata · Normalized isbnlib-shaped metadata is returned to the caller
- Plugin package → bnf entry: contains · The installable package exposes the plugin entry module
- Plugin package → BnF lookup: contains · The package includes the BnF provider implementation
- Tests → Metadata tests: includes · The test package contains the main metadata verification module
- Metadata tests → BnF lookup: verifies · Tests exercise the lookup and mapping logic
- Metadata tests → bnf entry: verifies · Tests confirm provider behavior through the public package surface
- Packaging → Plugin package: builds · Packaging configuration assembles the library distribution
- Build config → Packaging: configures · Shared project settings feed packaging and tooling behavior
- Requirements → Plugin package: supports install · Dependency files define runtime and development requirements
- Tox envs → Tests: runs · Tox definitions drive isolated test environments
- Docs & policy → bnf entry: explains use · Project documentation describes installation and provider usage
- GitHub Actions → Test workflow: includes · GitHub Actions workflows contain the main test pipeline
- GitHub Actions → CodeQL: includes · GitHub Actions workflows contain security scanning
- GitHub Actions → Release flow: includes · GitHub Actions workflows contain release publication
- Test workflow → Tests: runs · The test workflow executes the repository test suite
- CodeQL → Plugin package: scans · CodeQL targets the library code for security analysis
- Release flow → Packaging: publishes · Release automation uses package metadata to cut releases