Skip to content

Commit

Permalink
fix: Revert "chore: move to file based version (#3612)" (#3613)
Browse files Browse the repository at this point in the history
This reverts commit efe1153.
  • Loading branch information
derkweijers authored Oct 11, 2024
1 parent efe1153 commit 8f547f1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ inputs:
runs:
using: "composite"
steps:
- name: Update the version in src/version.py
- name: Update version in pyproject.toml
shell: bash
run: |
echo "__version__ = '${{ inputs.version }}'" > src/version.py
sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/g" pyproject.toml
- name: Docker meta
id: meta
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ dev-dependencies = [
[tool.mypy]
strict = true
plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"]
mypy_path = "src"
explicit_package_bases = true

[tool.django-stubs]
django_settings_module = "snapy.settings"
Expand All @@ -71,10 +69,13 @@ select = ["E", "W", "F", "I", "DJ", "UP"]
exclude_dirs = ["tests/", ".github/", ".venv/"]

[tool.pytest.ini_options]
pythonpath = "src/"
DJANGO_SETTINGS_MODULE = "snapy.settings"
env = [
"SECRET_KEY=dummy-secret-key",
"DATABASE_URL=sqlite://:memory:",
"SNAPI_VERSION=v1.2.3",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
2 changes: 1 addition & 1 deletion src/api/tests/test_info_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_version(self, client: Client) -> None:

data = response.json()

assert data["version"] == 4
assert data["version"] == "4"

def test_news_sites(self, client: Client, news_sites: list[NewsSite]) -> None:
response = client.get("/v4/info/")
Expand Down
6 changes: 3 additions & 3 deletions src/snapy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
https://docs.djangoproject.com/en/4.1/ref/settings/
"""

from version import __version__
import importlib.metadata
from pathlib import Path

import django_stubs_ext
Expand All @@ -21,7 +21,7 @@
# Extensions for Django Stubs
django_stubs_ext.monkeypatch()

VERSION = __version__
VERSION = importlib.metadata.version("snapy")

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand Down Expand Up @@ -49,7 +49,7 @@
traces_sample_rate=0.01,
send_default_pii=True,
enable_tracing=True,
release=str(VERSION),
release=VERSION,
environment=env.str("SENTRY_ENVIRONMENT"),
)

Expand Down
1 change: 0 additions & 1 deletion src/version.py

This file was deleted.

2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8f547f1

Please sign in to comment.