Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: version management #1729

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion benefits/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
__version__ = "2023.09.1"
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version("benefits")
except PackageNotFoundError:
# package is not installed
pass


VERSION = __version__
35 changes: 17 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"

[project]
classifiers = ["Programming Language :: Python :: 3 :: Only"]
name = "benefits"
version = "2023.09.1"
description = "Cal-ITP Benefits is an application that enables automated eligibility verification and enrollment for transit benefits onto customers’ existing contactless bank (credit/debit) cards."
readme = "README.md"
license = { file = "LICENSE" }
classifiers = ["Programming Language :: Python :: 3 :: Only"]
requires-python = ">=3.9"
dependencies = [
"Authlib==1.2.1",
"Django==4.2.5",
Expand All @@ -14,12 +15,6 @@ dependencies = [
"sentry-sdk==1.31.0",
"six==1.16.0",
]
dynamic = ["version"]
keywords = ["django"]
license = { file = "LICENSE" }
name = "benefits"
readme = "README.md"
requires-python = ">=3.9"

[project.optional-dependencies]
dev = [
Expand All @@ -41,13 +36,20 @@ Code = "https://github.com/cal-itp/benefits"
Documentation = "https://docs.calitp.org/benefits"
Issues = "https://github.com/cal-itp/benefits/issues"

# Configuration for black
[build-system]
requires = ["setuptools>=65", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 127
target-version = ['py310']
include = '\.pyi?$'

# Configuration for djlint
[tool.coverage.run]
omit = [
"benefits/core/migrations/*"
]

[tool.djlint]
ignore = "H017,H031"
indent = 2
Expand All @@ -57,11 +59,8 @@ profile = "django"
preserve_blank_lines = true
use_gitignore = true

# Configuration for pytest
[tool.coverage.run]
omit = [
"benefits/core/migrations/*"
]
[tool.pyright]
include = ["benefits", "tests/pytest"]

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "benefits.settings"
Expand Down
9 changes: 9 additions & 0 deletions tests/pytest/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import re


def test_version():
from benefits import __version__, VERSION

assert __version__ is not None
assert __version__ == VERSION
assert re.match(r"\d{4}\.\d{1,2}\.\d+", __version__)