Skip to content
Draft
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
29 changes: 26 additions & 3 deletions py/client-ticking/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import pathlib
import platform
from datetime import datetime, timezone

from Cython.Build import cythonize
from packaging.version import parse as parse_version
Expand All @@ -17,13 +18,35 @@ def _get_readme() -> str:
return (HERE / "README.md").read_text(encoding="utf-8")


def _snapshot_date() -> str:
# Date-precision (UTC) timestamp used to build a PEP 440 dev pre-release for SNAPSHOTs.
#
# Reproducible builds: building the same source twice on different days would otherwise
# yield different versions (e.g. .dev20260805 vs .dev20260806), so the artifact would not
# be a deterministic function of the source. SOURCE_DATE_EPOCH is the cross-ecosystem
# standard (https://reproducible-builds.org/specs/source-date-epoch/) for pinning build
# time: an integer of seconds since the Unix epoch (UTC), conventionally the commit time
# (git log -1 --pretty=%ct). When set, we use it instead of the wall clock so rebuilds of
# the same commit produce an identical version; otherwise we fall back to "now".
epoch = os.environ.get("SOURCE_DATE_EPOCH")
when = (
datetime.fromtimestamp(int(epoch), tz=timezone.utc)
if epoch
else datetime.now(tz=timezone.utc)
)
return when.strftime("%Y%m%d")


def _normalize_version(java_version):
partitions = java_version.partition("-")
regular_version = partitions[0]
local_segment = partitions[2]
python_version = (
f"{regular_version}+{local_segment}" if local_segment else regular_version
)
if local_segment == "SNAPSHOT":
python_version = f"{regular_version}.dev{_snapshot_date()}"
elif local_segment:
python_version = f"{regular_version}+{local_segment}"
else:
python_version = regular_version
return str(parse_version(python_version))


Expand Down
29 changes: 26 additions & 3 deletions py/client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
import os
import pathlib
from datetime import datetime, timezone

from packaging.version import parse as parse_version
from setuptools import find_namespace_packages, setup
Expand All @@ -15,13 +16,35 @@ def _get_readme() -> str:
return (here / "README.md").read_text(encoding="utf-8")


def _snapshot_date() -> str:
# Date-precision (UTC) timestamp used to build a PEP 440 dev pre-release for SNAPSHOTs.
#
# Reproducible builds: building the same source twice on different days would otherwise
# yield different versions (e.g. .dev20260805 vs .dev20260806), so the artifact would not
# be a deterministic function of the source. SOURCE_DATE_EPOCH is the cross-ecosystem
# standard (https://reproducible-builds.org/specs/source-date-epoch/) for pinning build
# time: an integer of seconds since the Unix epoch (UTC), conventionally the commit time
# (git log -1 --pretty=%ct). When set, we use it instead of the wall clock so rebuilds of
# the same commit produce an identical version; otherwise we fall back to "now".
epoch = os.environ.get("SOURCE_DATE_EPOCH")
when = (
datetime.fromtimestamp(int(epoch), tz=timezone.utc)
if epoch
else datetime.now(tz=timezone.utc)
)
return when.strftime("%Y%m%d")


def _normalize_version(java_version):
partitions = java_version.partition("-")
regular_version = partitions[0]
local_segment = partitions[2]
python_version = (
f"{regular_version}+{local_segment}" if local_segment else regular_version
)
if local_segment == "SNAPSHOT":
python_version = f"{regular_version}.dev{_snapshot_date()}"
elif local_segment:
python_version = f"{regular_version}+{local_segment}"
else:
python_version = regular_version
return str(parse_version(python_version))


Expand Down
29 changes: 26 additions & 3 deletions py/embedded-server/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
import os
import pathlib
from datetime import datetime, timezone

from packaging.version import parse as parse_version
from setuptools import find_namespace_packages, setup
Expand All @@ -15,13 +16,35 @@ def _get_readme() -> str:
return (here / "README_PyPi.md").read_text(encoding="utf-8")


def _snapshot_date() -> str:
# Date-precision (UTC) timestamp used to build a PEP 440 dev pre-release for SNAPSHOTs.
#
# Reproducible builds: building the same source twice on different days would otherwise
# yield different versions (e.g. .dev20260805 vs .dev20260806), so the artifact would not
# be a deterministic function of the source. SOURCE_DATE_EPOCH is the cross-ecosystem
# standard (https://reproducible-builds.org/specs/source-date-epoch/) for pinning build
# time: an integer of seconds since the Unix epoch (UTC), conventionally the commit time
# (git log -1 --pretty=%ct). When set, we use it instead of the wall clock so rebuilds of
# the same commit produce an identical version; otherwise we fall back to "now".
epoch = os.environ.get("SOURCE_DATE_EPOCH")
when = (
datetime.fromtimestamp(int(epoch), tz=timezone.utc)
if epoch
else datetime.now(tz=timezone.utc)
)
return when.strftime("%Y%m%d")


def _normalize_version(java_version) -> str:
partitions = java_version.partition("-")
regular_version = partitions[0]
local_segment = partitions[2]
python_version = (
f"{regular_version}+{local_segment}" if local_segment else regular_version
)
if local_segment == "SNAPSHOT":
python_version = f"{regular_version}.dev{_snapshot_date()}"
elif local_segment:
python_version = f"{regular_version}+{local_segment}"
else:
python_version = regular_version
return str(parse_version(python_version))


Expand Down
29 changes: 26 additions & 3 deletions py/server/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
import os
import pathlib
from datetime import datetime, timezone

from packaging.version import parse as parse_version
from setuptools import find_namespace_packages, setup
Expand All @@ -15,13 +16,35 @@ def _get_readme() -> str:
return (HERE / "README.md").read_text(encoding="utf-8")


def _snapshot_date() -> str:
# Date-precision (UTC) timestamp used to build a PEP 440 dev pre-release for SNAPSHOTs.
#
# Reproducible builds: building the same source twice on different days would otherwise
# yield different versions (e.g. .dev20260805 vs .dev20260806), so the artifact would not
# be a deterministic function of the source. SOURCE_DATE_EPOCH is the cross-ecosystem
# standard (https://reproducible-builds.org/specs/source-date-epoch/) for pinning build
# time: an integer of seconds since the Unix epoch (UTC), conventionally the commit time
# (git log -1 --pretty=%ct). When set, we use it instead of the wall clock so rebuilds of
# the same commit produce an identical version; otherwise we fall back to "now".
epoch = os.environ.get("SOURCE_DATE_EPOCH")
when = (
datetime.fromtimestamp(int(epoch), tz=timezone.utc)
if epoch
else datetime.now(tz=timezone.utc)
)
return when.strftime("%Y%m%d")


def _normalize_version(java_version) -> str:
partitions = java_version.partition("-")
regular_version = partitions[0]
local_segment = partitions[2]
python_version = (
f"{regular_version}+{local_segment}" if local_segment else regular_version
)
if local_segment == "SNAPSHOT":
python_version = f"{regular_version}.dev{_snapshot_date()}"
elif local_segment:
python_version = f"{regular_version}+{local_segment}"
else:
python_version = regular_version
return str(parse_version(python_version))


Expand Down
Loading