Beautifier of BibTeX files.
It has the following features:
- unified indentation and spacing
- sort entries and fields within entries
- use braces for field values
- normalize values of author, editor, pages, year, month fields
python bibliography.py file.bib
-
Make sure you have brew package manager installed.
-
Install pyenv, pyenv-virtualenv and poetry:
brew install pyenv brew install pyenv-virtualenv brew install poetry
-
Add the following lines to
.zshrcor.bash_profileand restart the terminal:# Pyenv settings export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)"
-
Create Python virtual environment with the correct Python version:
make install-python make create-environment
-
Install all dependencies
make install-dependecies
If you need to delete the Python virtual environment, you can do so with the
command make delete-environment.
If you make code change, run unit tests and code checks with the command:
make clean whitespace-format-check isort-check black-check flake8 pydocstyle pylint mypy test coverageEach make target runs different checks:
cleandeletes temporary fileswhitespace-format-checkruns whitespace-format checker on all filesisort-checkruns isort checker of imports in*.pyfilesblack-checkruns black code format checker on*.pyfilesflake8runs flake8 code style checker on*.pyfilespydocstyleruns pydocstyle docstring checker on*.pyfilespylintruns pylint code checker on*.pyfilesmypyruns mypy type checker on*.pyfilestestruns unit testscoveragegenerates code coverage report
You can automatically format code with the command:
make isort-format black-format whitespace-formatThe list of Python packages that this project depends on is specified in
pyproject.toml and in poetry.lock files. The file pyproject.toml can be
edited by humans. The file poetry.lock is automatically generated by poetry.
Install a development dependency with the command:
poetry add --dev <some_new_python_tool>Install a new production dependency with the command:
poetry add <some_python_library>Instead of using poetry add command, you can edit pyproject.toml file. Then,
regenerate poetry.lock file with the command:
poetry lockor the command:
poetry lock --no-updateThe latter command does not update already locked packages.
If your Python virtual environment becomes broken or polluted with unnecessary packages, delete it, recreate it from scratch and install dependencies a fresh with the following commands:
make delete-environment
make create-environment
make install-dependencies