Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
222ee21
feat: first working version of payments for nilAI
jcabrero Oct 8, 2025
37a4d11
chore: removed nilai-auth and moved nuc-helpers to nilai_api/auth
jcabrero Oct 10, 2025
6af0862
feat: first working version of payments for nilAI
jcabrero Oct 8, 2025
8e20da1
chore: removed nilai-auth and moved nuc-helpers to nilai_api/auth
jcabrero Oct 10, 2025
ee7cbf8
chore: removed nilai-attestation container
jcabrero Oct 10, 2025
b51307a
chore: removed prometheus
jcabrero Oct 10, 2025
0845ac2
chore: removed unused containers among others prometheus and attestation
jcabrero Oct 10, 2025
3a815fb
feat: first working version of payments for nilAI
jcabrero Oct 8, 2025
294db19
feat: updated to latest version of nilauth-credit
jcabrero Oct 16, 2025
e892bc6
feat: first working version of payments for nilAI
jcabrero Oct 8, 2025
3e570b7
chore: removed nilai-auth and moved nuc-helpers to nilai_api/auth
jcabrero Oct 10, 2025
3ab78e4
feat: first working version of payments for nilAI
jcabrero Oct 8, 2025
4bd2109
chore: removed nilai-auth and moved nuc-helpers to nilai_api/auth
jcabrero Oct 10, 2025
154260f
feat: removed etcd and added redis in place
jcabrero Oct 10, 2025
f57225d
feat: modified ci and composes to have discovery env
jcabrero Oct 16, 2025
13840b9
feat: update ci
jcabrero Oct 16, 2025
c508d7f
fix: changed PAT
jcabrero Oct 17, 2025
526c69b
fix: CI and added new attestation endpoint
jcabrero Oct 17, 2025
38c63fa
feat: improved nilai-common config
jcabrero Oct 17, 2025
6d82271
chore: improved organization of vllm templates
jcabrero Oct 17, 2025
f122282
chore: moved conftest to tests
jcabrero Oct 17, 2025
df27a1f
chore: added client and fixed e2e tests
jcabrero Oct 29, 2025
a95ff6e
feat: fix api key
jcabrero Oct 29, 2025
ca20386
chore: improve DB structure (#164)
jcabrero Dec 1, 2025
87302a8
Merge pull request #163 from NillionNetwork/chore/add_native_client_t…
jcabrero Dec 1, 2025
a749349
Merge pull request #162 from NillionNetwork/chore/remove_etcd
jcabrero Dec 3, 2025
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: 5 additions & 4 deletions .env.ci
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ ATTESTATION_HOST = "attestation"
ATTESTATION_PORT = 8080

# nilAuth Trusted URLs
NILAUTH_TRUSTED_ROOT_ISSUERS = "http://nilauth:30921"
NILAUTH_TRUSTED_ROOT_ISSUERS = "http://nilauth-credit-server:3000" # "http://nilauth:30921"
CREDIT_API_TOKEN = "n i l l i o n"

# Postgres Docker Compose Config
POSTGRES_HOST = "postgres"
Expand All @@ -37,9 +38,9 @@ POSTGRES_PORT = 5432
# Redis Docker Compose Config
REDIS_URL = "redis://redis:6379"

# Etcd Docker Compose Config
ETCD_HOST = "etcd"
ETCD_PORT = 2379
# Model Discovery Redis Docker Compose Config
DISCOVERY_HOST = "redis"
DISCOVERY_PORT = 6379

# Grafana Docker Compose Config
GF_SECURITY_ADMIN_USER = "admin"
Expand Down
141 changes: 141 additions & 0 deletions .github/scripts/update_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/usr/bin/env python3
"""
Script to automatically increment Test PyPI package versions.

This script fetches the latest version from Test PyPI, increments the alpha version,
and updates the pyproject.toml file accordingly.
"""

import requests
import re
import sys
from pathlib import Path


def get_latest_version(package_name="nilai-py"):
"""
Fetch the latest version from Test PyPI.

Args:
package_name: Name of the package to check

Returns:
str: Latest version string, or "0.0.0a0" if package doesn't exist
"""
try:
response = requests.get(
f"https://test.pypi.org/pypi/{package_name}/json", timeout=10
)
if response.status_code == 404:
# Package doesn't exist yet, start with 0.0.0a1
print(f"Package {package_name} not found on Test PyPI, starting fresh")
return "0.0.0a0"

response.raise_for_status()
data = response.json()
versions = list(data["releases"].keys())

if not versions:
print("No versions found, starting fresh")
return "0.0.0a0"

# Filter for alpha versions and find the latest
alpha_versions = [v for v in versions if "a" in v]
if not alpha_versions:
print("No alpha versions found, starting fresh")
return "0.0.0a0"

# Sort versions and get the latest
alpha_versions.sort(key=lambda x: [int(i) for i in re.findall(r"\d+", x)])
latest = alpha_versions[-1]
print(f"Found latest alpha version: {latest}")
return latest

except Exception as e:
print(f"Error fetching version: {e}")
return "0.0.0a0"


def increment_version(version):
"""
Increment the alpha version number.

Args:
version: Version string like "0.0.0a1"

Returns:
str: Incremented version string like "0.0.0a2"
"""
# Parse version like "0.0.0a1" or "0.1.0a5"
match = re.match(r"(\d+)\.(\d+)\.(\d+)a(\d+)", version)
if match:
major, minor, patch, alpha = match.groups()
new_alpha = int(alpha) + 1
new_version = f"{major}.{minor}.{patch}a{new_alpha}"
print(f"Incrementing {version} -> {new_version}")
return new_version
else:
# If no match, start with a1
print(f"Could not parse version {version}, defaulting to 0.0.0a1")
return "0.0.0a1"


def update_pyproject_version(new_version, pyproject_path="pyproject.toml"):
"""
Update the version in pyproject.toml file.

Args:
new_version: New version string to set
pyproject_path: Path to pyproject.toml file

Returns:
str: The new version that was set
"""
pyproject_file = Path(pyproject_path)

if not pyproject_file.exists():
raise FileNotFoundError(f"Could not find {pyproject_path}")

content = pyproject_file.read_text()

# Update version line
updated_content = re.sub(
r'^version = ".*"', f'version = "{new_version}"', content, flags=re.MULTILINE
)

if content == updated_content:
print("Warning: No version line found to update in pyproject.toml")

pyproject_file.write_text(updated_content)
print(f"Updated {pyproject_path} with version {new_version}")
return new_version


def main():
"""Main function to orchestrate version update."""
print("=== Updating package version ===")

# Get latest version from Test PyPI
latest_version = get_latest_version()
print(f"Latest version from Test PyPI: {latest_version}")

# Increment version
new_version = increment_version(latest_version)
print(f"New version: {new_version}")

# Update pyproject.toml
update_pyproject_version(new_version)

# Output for GitHub Actions (using newer syntax)
print(f"NEW_VERSION={new_version}")

return new_version


if __name__ == "__main__":
try:
version = main()
sys.exit(0)
except Exception as e:
print(f"Error: {e}")
sys.exit(1)
142 changes: 142 additions & 0 deletions .github/scripts/update_version_from_release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/usr/bin/env python3
"""
Script to update pyproject.toml version based on GitHub release tag.

This script takes a release tag (like 'v1.0.0' or '1.0.0') and updates
the version field in pyproject.toml accordingly.
"""

import re
import sys
import argparse
from pathlib import Path


def normalize_version(tag_version):
"""
Normalize a version tag to a clean version string.

Args:
tag_version: Version from GitHub release tag (e.g., 'v1.0.0', '1.0.0', 'v1.0.0-beta.1')

Returns:
str: Clean version string (e.g., '1.0.0', '1.0.0b1')
"""
# Remove 'v' prefix if present
version = tag_version.lstrip("v")

# Convert beta/alpha/rc notation to PEP 440 format
# v1.0.0-beta.1 -> 1.0.0b1
# v1.0.0-alpha.2 -> 1.0.0a2
# v1.0.0-rc.1 -> 1.0.0rc1
version = re.sub(r"-beta\.?(\d+)", r"b\1", version)
version = re.sub(r"-alpha\.?(\d+)", r"a\1", version)
version = re.sub(r"-rc\.?(\d+)", r"rc\1", version)

print(f"Normalized version: {tag_version} -> {version}")
return version


def validate_version(version):
"""
Validate that the version follows PEP 440 format.

Args:
version: Version string to validate

Returns:
bool: True if valid, False otherwise
"""
# Basic PEP 440 version pattern
pattern = r"^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$"

if re.match(pattern, version):
print(f"Version {version} is valid")
return True
else:
print(f"Warning: Version {version} may not be PEP 440 compliant")
return False


def update_pyproject_version(new_version, pyproject_path="pyproject.toml"):
"""
Update the version in pyproject.toml file.

Args:
new_version: New version string to set
pyproject_path: Path to pyproject.toml file

Returns:
str: The new version that was set
"""
pyproject_file = Path(pyproject_path)

if not pyproject_file.exists():
raise FileNotFoundError(f"Could not find {pyproject_path}")

content = pyproject_file.read_text()
original_content = content

# Update version line
updated_content = re.sub(
r'^version = ".*"', f'version = "{new_version}"', content, flags=re.MULTILINE
)

if content == updated_content:
raise ValueError("No version line found to update in pyproject.toml")

pyproject_file.write_text(updated_content)
print(f"Updated {pyproject_path} with version {new_version}")

# Show the change
old_version_match = re.search(r'^version = "(.*)"', original_content, re.MULTILINE)
if old_version_match:
old_version = old_version_match.group(1)
print(f"Version changed: {old_version} -> {new_version}")

return new_version


def main():
"""Main function to orchestrate version update from release tag."""
parser = argparse.ArgumentParser(
description="Update pyproject.toml version from GitHub release tag"
)
parser.add_argument(
"tag_version", help="The release tag version (e.g., 'v1.0.0' or '1.0.0')"
)
parser.add_argument(
"--pyproject", default="pyproject.toml", help="Path to pyproject.toml file"
)
parser.add_argument(
"--validate", action="store_true", help="Validate version format"
)

args = parser.parse_args()

print("=== Updating version from release tag ===")
print(f"Release tag: {args.tag_version}")

# Normalize the version
normalized_version = normalize_version(args.tag_version)

# Validate if requested
if args.validate:
validate_version(normalized_version)

# Update pyproject.toml
try:
update_pyproject_version(normalized_version, args.pyproject)
print(f"SUCCESS: Updated version to {normalized_version}")

# Output for GitHub Actions
print(f"RELEASE_VERSION={normalized_version}")

return 0
except Exception as e:
print(f"ERROR: {e}")
return 1


if __name__ == "__main__":
sys.exit(main())
Loading
Loading