Skip to content

Commit

Permalink
dynamically generate version from tags
Browse files Browse the repository at this point in the history
Use setuptools-scm to get a version from the tag
when released instead of looking for the contents
of a file. Generate a version.py file to replace
the static value in __init__.py.
  • Loading branch information
dhellmann committed Jul 24, 2024
1 parent c75d72a commit f146078
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ sacrebleu.egg-info
*~
.DS_Store
.idea/
sacrebleu/version.py
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"
3 changes: 2 additions & 1 deletion sacrebleu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# 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'


Expand All @@ -24,6 +23,7 @@
from .metrics.helpers import extract_word_ngrams, extract_char_ngrams
from .dataset import DATASETS
from .metrics import BLEU, CHRF, TER
from .version import __version__

# Backward compatibility functions for old style API access (<= 1.4.10)
from .compat import corpus_bleu, raw_corpus_bleu, sentence_bleu
Expand All @@ -40,4 +40,5 @@
'corpus_bleu', 'raw_corpus_bleu', 'sentence_bleu',
'corpus_chrf', 'sentence_chrf',
'corpus_ter', 'sentence_ter'
'__version__',
]

0 comments on commit f146078

Please sign in to comment.