bib-optimizer


Namebib-optimizer JSON
Version 0.4.2 PyPI version JSON
download
home_pageNone
SummaryClean and optimize bib file.
upload_time2025-07-14 20:54:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2025 Ka Wa Yip Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords latex bib bibliography
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
              <figure>
    <img src="https://github.com/kwyip/bib_optimizer/blob/main/logo.png?raw=True" alt="logo" height="143" />
    <!-- <figcaption>An elephant at sunset</figcaption> -->
  </figure>

[![](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/kwyip/bib_optimizer/blob/main/LICENSE)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bib-optimizer)](https://pypi.org/project/bib-optimizer/)
[![Static Badge](https://img.shields.io/badge/CalVer-2025.0416-ff5733)](https://pypi.org/project/bib-optimizer)
[![Static Badge](https://img.shields.io/badge/PyPI-wheels-d8d805)](https://pypi.org/project/bib-optimizer/#files)
[![](https://pepy.tech/badge/bib_optimizer/month)](https://pepy.tech/project/bib_optimizer)

[bib-optimizer](https://bibopt.github.io/)
==========================================

Oh, sure, because who doesn't love manually cleaning up messy `.bib` files? `bib_optimizer.py` heroically steps in to remove those lazy, _unused_ citations and _reorder_ the survivors exactly as they appear in the `.tex` file—because, clearly, chaos is the default setting for bibliographies.

In layman's terms, it automates bibliography management by:

1.  removing unused citations,
2.  reordering the remaining ones to match their order of appearance in the `.tex` file.

**Input Files:**

*   `main.tex` – The LaTeX source file.
*   `ref.bib` – The original bibliography file.

These input files will **remain unchanged**.

**Output File:**

*   `ref_opt.bib` – A placeholder filename for the newly generated, cleaned, and ordered bibliography file.

* * *

Installation
------------

It can be installed with `pip`, ideally by using a [virtual environment](https://realpython.com/what-is-pip/#using-pip-in-a-python-virtual-environment). Open up a terminal and install the package and the dependencies with:  
  

    `pip install bib_optimizer`

_or_

    `python -m pip install bib_optimizer`

  
_🐍 This requires Python 3.8 or newer versions_

* * *

### Steps to Clean Your Bibliography

1.  **Prepare the input files (e.g., by downloading them from Overleaf)**.
2.  **Run the command to generate a new `.bib` file (for example, you may name it `ref_opt.bib`)**:  
      
    
           `bibopt main.tex ref.bib ref_opt.bib`
    
      
    
3.  **Use the Cleaned Bibliography**  
    Replace `ref.bib` with `ref_opt.bib` in your LaTeX project.

* * *

### Test

You may test the installation using the sample input files (`sample_main.tex` and `sample_ref.bib`) located in the test folder.

<img src="https://github.com/kwyip/bib_optimizer/blob/main/sample_main_shot.png?raw=True" alt="sample_main_shot"  width="34.83%"/>&nbsp;&nbsp;<img src="https://github.com/kwyip/bib_optimizer/blob/main/sample_ref_shot.png?raw=True" alt="sample_ref_shot" width="43%" />

`sample_main.tex` _and_ `sample_ref.bib`

<img src="https://github.com/kwyip/bib_optimizer/blob/main/sample_ref_opt_shot.png?raw=True" alt="sample_ref_opt_shot" width="43%" />

_A sample_ `ref_opt.bib` _created after running_ `bibopt sample_main.tex sample_ref.bib ref_opt.bib`

---
#### New feature (version 0.4.0)

If the `main.tex` calls inputs from other `.tex` (e.g., with `\input{...}`), the newly generated `ref_opt.bib` will preserve the order of appearances in the `main.tex` with each inputted `.tex` as well. \
(The dependent `.tex` files need to be placed in the same directory as `main.tex`.)

---
#### New feature (version 0.4.1)

On top of version 0.4, skip any `\input` `.tex` file if not found.

---
#### New feature (version 0.4.2)

In addition to handling the `\input{...}` command, it also supports the `\include{...}` command.

♥ Lastly executed on Python `3.10` on 2025-07-14.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bib-optimizer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "latex, bib, bibliography",
    "author": null,
    "author_email": "Ka Wa Yip <yipkawa@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f0/15/b563bfc2c7779f0b33b1e726fa6440d2e9baf10240fd6516053147cea2af/bib_optimizer-0.4.2.tar.gz",
    "platform": null,
    "description": "  <figure>\n    <img src=\"https://github.com/kwyip/bib_optimizer/blob/main/logo.png?raw=True\" alt=\"logo\" height=\"143\" />\n    <!-- <figcaption>An elephant at sunset</figcaption> -->\n  </figure>\n\n[![](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/kwyip/bib_optimizer/blob/main/LICENSE)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bib-optimizer)](https://pypi.org/project/bib-optimizer/)\n[![Static Badge](https://img.shields.io/badge/CalVer-2025.0416-ff5733)](https://pypi.org/project/bib-optimizer)\n[![Static Badge](https://img.shields.io/badge/PyPI-wheels-d8d805)](https://pypi.org/project/bib-optimizer/#files)\n[![](https://pepy.tech/badge/bib_optimizer/month)](https://pepy.tech/project/bib_optimizer)\n\n[bib-optimizer](https://bibopt.github.io/)\n==========================================\n\nOh, sure, because who doesn't love manually cleaning up messy `.bib` files? `bib_optimizer.py` heroically steps in to remove those lazy, _unused_ citations and _reorder_ the survivors exactly as they appear in the `.tex` file\u2014because, clearly, chaos is the default setting for bibliographies.\n\nIn layman's terms, it automates bibliography management by:\n\n1.  removing unused citations,\n2.  reordering the remaining ones to match their order of appearance in the `.tex` file.\n\n**Input Files:**\n\n*   `main.tex` \u2013 The LaTeX source file.\n*   `ref.bib` \u2013 The original bibliography file.\n\nThese input files will **remain unchanged**.\n\n**Output File:**\n\n*   `ref_opt.bib` \u2013 A placeholder filename for the newly generated, cleaned, and ordered bibliography file.\n\n* * *\n\nInstallation\n------------\n\nIt can be installed with `pip`, ideally by using a [virtual environment](https://realpython.com/what-is-pip/#using-pip-in-a-python-virtual-environment). Open up a terminal and install the package and the dependencies with:  \n  \n\n\u00a0\u00a0\u00a0\u00a0`pip install bib_optimizer`\n\n_or_\n\n\u00a0\u00a0\u00a0\u00a0`python -m pip install bib_optimizer`\n\n  \n_\ud83d\udc0d This requires Python 3.8 or newer versions_\n\n* * *\n\n### Steps to Clean Your Bibliography\n\n1.  **Prepare the input files (e.g., by downloading them from Overleaf)**.\n2.  **Run the command to generate a new `.bib` file (for example, you may name it `ref_opt.bib`)**:  \n      \n    \n    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0`bibopt main.tex ref.bib ref_opt.bib`\n    \n      \n    \n3.  **Use the Cleaned Bibliography**  \n    Replace `ref.bib` with `ref_opt.bib` in your LaTeX project.\n\n* * *\n\n### Test\n\nYou may test the installation using the sample input files (`sample_main.tex` and `sample_ref.bib`) located in the test folder.\n\n<img src=\"https://github.com/kwyip/bib_optimizer/blob/main/sample_main_shot.png?raw=True\" alt=\"sample_main_shot\"  width=\"34.83%\"/>&nbsp;&nbsp;<img src=\"https://github.com/kwyip/bib_optimizer/blob/main/sample_ref_shot.png?raw=True\" alt=\"sample_ref_shot\" width=\"43%\" />\n\n`sample_main.tex` _and_ `sample_ref.bib`\n\n<img src=\"https://github.com/kwyip/bib_optimizer/blob/main/sample_ref_opt_shot.png?raw=True\" alt=\"sample_ref_opt_shot\" width=\"43%\" />\n\n_A sample_ `ref_opt.bib` _created after running_ `bibopt sample_main.tex sample_ref.bib ref_opt.bib`\n\n---\n#### New feature (version 0.4.0)\n\nIf the `main.tex` calls inputs from other `.tex` (e.g., with `\\input{...}`), the newly generated `ref_opt.bib` will preserve the order of appearances in the `main.tex` with each inputted `.tex` as well. \\\n(The dependent `.tex` files need to be placed in the same directory as `main.tex`.)\n\n---\n#### New feature (version 0.4.1)\n\nOn top of version 0.4, skip any `\\input` `.tex` file if not found.\n\n---\n#### New feature (version 0.4.2)\n\nIn addition to handling the `\\input{...}` command, it also supports the `\\include{...}` command.\n\n\u2665 Lastly executed on Python `3.10` on 2025-07-14.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 Ka Wa Yip  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Clean and optimize bib file.",
    "version": "0.4.2",
    "project_urls": {
        "Homepage": "https://github.com/kwyip/bib_optimizer",
        "Issues": "https://github.com/kwyip/bib_optimizer/issues"
    },
    "split_keywords": [
        "latex",
        " bib",
        " bibliography"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebe0bf6f9e05ea35e6ba74cf818e7f4f344c37b5f9d80b71627288201bb59a25",
                "md5": "d215f14bc8b3c96a13a542d5cdef131d",
                "sha256": "fd13e366318e1153344519a99f89ca7ad529b3630bfcc6ced52aac757b2698cb"
            },
            "downloads": -1,
            "filename": "bib_optimizer-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d215f14bc8b3c96a13a542d5cdef131d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6993,
            "upload_time": "2025-07-14T20:54:27",
            "upload_time_iso_8601": "2025-07-14T20:54:27.780163Z",
            "url": "https://files.pythonhosted.org/packages/eb/e0/bf6f9e05ea35e6ba74cf818e7f4f344c37b5f9d80b71627288201bb59a25/bib_optimizer-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f015b563bfc2c7779f0b33b1e726fa6440d2e9baf10240fd6516053147cea2af",
                "md5": "4266751d60147763e776492cc565e8fd",
                "sha256": "c5e2bb8eb2313eec66c71281a4a551fde65c08c949d67238a5b4f6ab6b3a97d8"
            },
            "downloads": -1,
            "filename": "bib_optimizer-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4266751d60147763e776492cc565e8fd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6589,
            "upload_time": "2025-07-14T20:54:28",
            "upload_time_iso_8601": "2025-07-14T20:54:28.879589Z",
            "url": "https://files.pythonhosted.org/packages/f0/15/b563bfc2c7779f0b33b1e726fa6440d2e9baf10240fd6516053147cea2af/bib_optimizer-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-14 20:54:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kwyip",
    "github_project": "bib_optimizer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "bib-optimizer"
}
        
Elapsed time: 1.74925s