copilot changes#1
Conversation
…m multiple sources + pytest + graph + readme - all in one lol
|
@copilot check lint failures |
|
@art-test-stack I've opened a new pull request, #2, to work on those changes. Once the pull request is ready, I'll request review from you. |
There was a problem hiding this comment.
Pull request overview
This PR turns the repository into a structured Python package + CLI for managing a bibliography (CSV-backed), adding richer CLI UX (via rich), adding metadata extraction (arXiv/DOI/generic), adding BibTeX + citation-graph output, and introducing pytest + CI (tests + ruff lint/format) alongside expanded documentation.
Changes:
- Refactors core functionality into
pkg/mybib/*modules (storage/markdown/arxiv/metadata/bibtex/graph) and expands the CLI with multiple subcommands. - Adds a pytest suite, pytest config, and GitHub Actions workflows for tests/coverage + ruff lint/format enforcement.
- Adds docs (README + claude docs) and vendors front-end assets under
lib/.
Reviewed changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_storage.py | New storage tests (currently import-path issues + unused import). |
| tests/test_metadata.py | New metadata tests (currently uses incorrect sys.path hack + unused import). |
| tests/test_markdown.py | New markdown/util tests (currently uses invalid pkg.mybib imports). |
| tests/test_arxiv.py | New arXiv tests (currently uses invalid pkg.mybib imports + patch targets). |
| tests/init.py | Marks test package. |
| pytest.ini | Pytest discovery/options config. |
| pyproject.toml | Adds deps + dev extras + updates console script entry point. |
| pkg/mybib/init.py | Exposes package entrypoint/version. |
| pkg/mybib/cli.py | Expanded CLI with rich UX + bibtex/graph commands. |
| pkg/mybib/storage.py | CSV storage + duplicate DOI detection + load helper. |
| pkg/mybib/markdown.py | Markdown table generation + by-category output/footer. |
| pkg/mybib/utils.py | Author-name formatting helper. |
| pkg/mybib/ui.py | Rich-based UI helpers (progress/confirm/table/printing). |
| pkg/mybib/arxiv.py | arXiv API metadata fetcher. |
| pkg/mybib/metadata.py | Multi-source metadata routing + Crossref + generic HTML meta parsing. |
| pkg/mybib/bibtex.py | BibTeX generation from DataFrame. |
| pkg/mybib/graph.py | Crossref-based citation graph builder + pyvis HTML export. |
| pkg/mybib/main.py | Removes old monolithic script. |
| README.md | Major documentation expansion + usage/architecture. |
| .github/workflows/tests.yml | CI: run pytest + coverage upload. |
| .github/workflows/lint.yml | CI: ruff lint + ruff format check. |
| lib/tom-select/tom-select.css | Vendored Tom Select CSS. |
| lib/tom-select/tom-select.complete.min.js | Vendored Tom Select JS bundle. |
| lib/bindings/utils.js | Front-end graph interaction utilities. |
| claude/TEST_README.md | Test-suite documentation. |
| claude/CLI_IMPROVEMENTS.md | CLI UX documentation. |
| claude/CITATION_GRAPH.md | Citation graph feature documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| import sys | ||
|
|
||
| from pkg.mybib import storage |
| from pkg.mybib import storage, markdown | ||
|
|
| from pkg.mybib.utils import reform_names | ||
|
|
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("John Smith") | ||
| assert result == "Smith" | ||
|
|
||
| def test_reform_names_two_authors(self): | ||
| """Test reformatting two authors.""" | ||
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("John Smith, Jane Doe") | ||
| assert result == "Smith and Doe" | ||
|
|
||
| def test_reform_names_three_authors(self): | ||
| """Test reformatting three authors.""" | ||
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("John Smith, Jane Doe, Bob Johnson") | ||
| assert result == "Smith et al." | ||
|
|
||
| def test_reform_names_many_authors(self): | ||
| """Test reformatting many authors.""" | ||
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("Alice A, Bob B, Charlie C, Diana D, Eve E") | ||
| assert result == "A et al." | ||
|
|
||
| def test_reform_names_with_middle_names(self): | ||
| """Test reformatting with middle names.""" | ||
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("John Michael Smith, Jane Ellen Doe") | ||
| assert result == "Smith and Doe" | ||
|
|
||
| def test_reform_names_with_suffixes(self): | ||
| """Test reformatting with name suffixes.""" | ||
| from pkg.mybib.utils import reform_names |
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("John Smith") | ||
| assert result == "Smith" | ||
|
|
||
| def test_reform_names_two_authors(self): | ||
| """Test reformatting two authors.""" | ||
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("John Smith, Jane Doe") | ||
| assert result == "Smith and Doe" | ||
|
|
||
| def test_reform_names_three_authors(self): | ||
| """Test reformatting three authors.""" | ||
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("John Smith, Jane Doe, Bob Johnson") | ||
| assert result == "Smith et al." | ||
|
|
||
| def test_reform_names_many_authors(self): | ||
| """Test reformatting many authors.""" | ||
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("Alice A, Bob B, Charlie C, Diana D, Eve E") | ||
| assert result == "A et al." | ||
|
|
||
| def test_reform_names_with_middle_names(self): | ||
| """Test reformatting with middle names.""" | ||
| from pkg.mybib.utils import reform_names | ||
|
|
||
| result = reform_names("John Michael Smith, Jane Ellen Doe") | ||
| assert result == "Smith and Doe" | ||
|
|
||
| def test_reform_names_with_suffixes(self): | ||
| """Test reformatting with name suffixes.""" | ||
| from pkg.mybib.utils import reform_names |
| create_references_table, | ||
| ) | ||
|
|
||
|
|
| add_parser.add_argument("--title", required=True, help="Article title") | ||
| add_parser.add_argument("--authors", required=True, help="Comma-separated author names") | ||
| add_parser.add_argument("--journal", required=True, help="Journal or publication name") | ||
| add_parser.add_argument("--year", required=True, type=int, help="Publication year") | ||
| add_parser.add_argument("--doi", required=True, help="DOI identifier") | ||
| add_parser.add_argument("--link", help="URL link to the resource") | ||
| add_parser.add_argument("--category", help="Category for classification") | ||
| add_parser.add_argument( |
| SystemExit: If API call fails or no entry found | ||
| """ | ||
| url = f"http://export.arxiv.org/api/query?id_list={arxiv_id}" | ||
| response = requests.get(url) |
| "networkx>=3.0", | ||
| "pyvis>=0.3.2", | ||
| "rich>=13.0.0", | ||
| "networks>=0.3.7", |
| task_id = progress.add_task("[cyan]Fetching from API...", total=None) | ||
| try: | ||
| yield | ||
| finally: | ||
| progress.stop() |
… unused vars, I001 import order Co-authored-by: art-test-stack <110672812+art-test-stack@users.noreply.github.com>
Co-authored-by: art-test-stack <110672812+art-test-stack@users.noreply.github.com>
Fix ruff lint failures across pkg/ and tests/
cli exp separated + cli nice colors + extraction from multiple sources + pytest + graph + readme - all in one lol