diff --git a/.gitignore b/.gitignore index e2d4f53..a71c621 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ sacrebleu.egg-info *~ .DS_Store .idea/ +sacrebleu/version.py diff --git a/pyproject.toml b/pyproject.toml index 69cea21..e8d0695 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools>=64"] +requires = ["setuptools>=64", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" [project] name = "sacrebleu" -version = "2.4.1" +dynamic = ["version"] authors = [{ name = "Matt Post", email = "post@cs.jhu.edu" }] maintainers = [{ name = "Matt Post", email = "post@cs.jhu.edu" }] description = "Hassle-free computation of shareable, comparable, and reproducible BLEU, chrF, and TER scores" @@ -72,3 +72,6 @@ Repository = "https://github.com/mjpost/sacrebleu" [tool.setuptools.package-data] sacrebleu = ["py.typed"] + +[tool.setuptools_scm] +version_file = "sacrebleu/version.py" diff --git a/sacrebleu/__init__.py b/sacrebleu/__init__.py index c75839a..111f284 100644 --- a/sacrebleu/__init__.py +++ b/sacrebleu/__init__.py @@ -14,30 +14,53 @@ # express or implied. See the License for the specific language governing # permissions and limitations under the License. -__version__ = '2.4.1' -__description__ = 'Hassle-free computation of shareable, comparable, and reproducible BLEU, chrF, and TER scores' +__description__ = "Hassle-free computation of shareable, comparable, and reproducible BLEU, chrF, and TER scores" -from .utils import smart_open, SACREBLEU_DIR, download_test_set -from .utils import get_source_file, get_reference_files -from .utils import get_available_testsets, get_langpairs_for_testset -from .metrics.helpers import extract_word_ngrams, extract_char_ngrams +# Backward compatibility functions for old style API access (<= 1.4.10) +from .compat import ( + corpus_bleu, + corpus_chrf, + corpus_ter, + raw_corpus_bleu, + sentence_bleu, + sentence_chrf, + sentence_ter, +) from .dataset import DATASETS from .metrics import BLEU, CHRF, TER - -# Backward compatibility functions for old style API access (<= 1.4.10) -from .compat import corpus_bleu, raw_corpus_bleu, sentence_bleu -from .compat import corpus_chrf, sentence_chrf -from .compat import corpus_ter, sentence_ter +from .metrics.helpers import extract_char_ngrams, extract_word_ngrams +from .utils import ( + SACREBLEU_DIR, + download_test_set, + get_available_testsets, + get_langpairs_for_testset, + get_reference_files, + get_source_file, + smart_open, +) +from .version import __version__ __all__ = [ - 'smart_open', 'SACREBLEU_DIR', 'download_test_set', - 'get_source_file', 'get_reference_files', - 'get_available_testsets', 'get_langpairs_for_testset', - 'extract_word_ngrams', 'extract_char_ngrams', - 'DATASETS', - 'BLEU', 'CHRF', 'TER', - 'corpus_bleu', 'raw_corpus_bleu', 'sentence_bleu', - 'corpus_chrf', 'sentence_chrf', - 'corpus_ter', 'sentence_ter' + "smart_open", + "SACREBLEU_DIR", + "download_test_set", + "get_source_file", + "get_reference_files", + "get_available_testsets", + "get_langpairs_for_testset", + "extract_word_ngrams", + "extract_char_ngrams", + "DATASETS", + "BLEU", + "CHRF", + "TER", + "corpus_bleu", + "raw_corpus_bleu", + "sentence_bleu", + "corpus_chrf", + "sentence_chrf", + "corpus_ter", + "sentence_ter", + "__version__", ]