From 9ea82720a7337524639dc96d4dbf1141c59afea4 Mon Sep 17 00:00:00 2001 From: Alexey Shamrin Date: Mon, 27 Oct 2025 12:14:17 +0200 Subject: [PATCH 1/3] change default datacenter from FIN-01 to FIN-03 --- CHANGELOG.md | 5 +++++ datacrunch/constants.py | 2 ++ datacrunch/instances/instances.py | 8 ++++---- datacrunch/volumes/volumes.py | 8 ++++---- examples/simple_create_instance.py | 2 +- tests/integration_tests/test_instances.py | 2 +- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a547169..ab70dfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Changed default datacenter location to `FIN-03` - Migrated to `uv` - Removed `datacrunch.__version__.VERSION`. Use standard [importlib.metadata.version()](https://docs.python.org/3/library/importlib.metadata.html#importlib.metadata.version) instead: ```python @@ -30,6 +31,10 @@ If you are working on the library itself, do a fresh clone or upgrade your local uv run python examples/simple_create_instance.py ``` +### Added + +- Added constants for `FIN-02` and `FIN-03`. + ## [1.15.0] - 2025-10-23 ### Added diff --git a/datacrunch/constants.py b/datacrunch/constants.py index fd9e791..6d24660 100644 --- a/datacrunch/constants.py +++ b/datacrunch/constants.py @@ -58,6 +58,8 @@ def __init__(self): class Locations: FIN_01: str = 'FIN-01' + FIN_02: str = 'FIN-02' + FIN_03: str = 'FIN-03' ICE_01: str = 'ICE-01' def __init__(self): diff --git a/datacrunch/instances/instances.py b/datacrunch/instances/instances.py index 6f561a6..b10e851 100644 --- a/datacrunch/instances/instances.py +++ b/datacrunch/instances/instances.py @@ -32,7 +32,7 @@ class Instance: gpu_memory: GPU memory configuration details. ip: IP address assigned to the instance. os_volume_id: ID of the operating system volume. - location: Datacenter location code (default: Locations.FIN_01). + location: Datacenter location code (default: Locations.FIN_03). image: Image ID or type used for the instance. startup_script_id: ID of the startup script to run. is_spot: Whether the instance is a spot instance. @@ -57,7 +57,7 @@ class Instance: ip: Optional[str] = None # Can be None if instance is still not provisioned os_volume_id: Optional[str] = None - location: str = Locations.FIN_01 + location: str = Locations.FIN_03 image: Optional[str] = None startup_script_id: Optional[str] = None is_spot: bool = False @@ -118,7 +118,7 @@ def create( hostname: str, description: str, ssh_key_ids: list = [], - location: str = Locations.FIN_01, + location: str = Locations.FIN_03, startup_script_id: Optional[str] = None, volumes: Optional[List[Dict]] = None, existing_volumes: Optional[List[str]] = None, @@ -141,7 +141,7 @@ def create( hostname: Network hostname for the instance. description: Human-readable description of the instance. ssh_key_ids: List of SSH key IDs to associate with the instance. - location: Datacenter location code (default: Locations.FIN_01). + location: Datacenter location code (default: Locations.FIN_03). startup_script_id: Optional ID of startup script to run. volumes: Optional list of volume configurations to create. existing_volumes: Optional list of existing volume IDs to attach. diff --git a/datacrunch/volumes/volumes.py b/datacrunch/volumes/volumes.py index 8e433c5..69dd23b 100644 --- a/datacrunch/volumes/volumes.py +++ b/datacrunch/volumes/volumes.py @@ -18,7 +18,7 @@ def __init__( is_os_volume: bool, created_at: str, target: str = None, - location: str = Locations.FIN_01, + location: str = Locations.FIN_03, instance_id: str = None, ssh_key_ids: List[str] = [], deleted_at: str = None, @@ -41,7 +41,7 @@ def __init__( :type created_at: str :param target: target device e.g. vda :type target: str, optional - :param location: datacenter location, defaults to "FIN-01" + :param location: datacenter location, defaults to "FIN-03" :type location: str, optional :param instance_id: the instance id the volume is attached to, None if detached :type instance_id: str @@ -250,7 +250,7 @@ def create( name: str, size: int, instance_id: str = None, - location: str = Locations.FIN_01, + location: str = Locations.FIN_03, ) -> Volume: """Create new volume @@ -262,7 +262,7 @@ def create( :type size: int :param instance_id: Instance id to be attached to, defaults to None :type instance_id: str, optional - :param location: datacenter location, defaults to "FIN-01" + :param location: datacenter location, defaults to "FIN-03" :type location: str, optional :return: the new volume object :rtype: Volume diff --git a/examples/simple_create_instance.py b/examples/simple_create_instance.py index 6e4c4ab..a55126e 100644 --- a/examples/simple_create_instance.py +++ b/examples/simple_create_instance.py @@ -18,7 +18,7 @@ instance = datacrunch.instances.create( instance_type='1V100.6V', image='ubuntu-22.04-cuda-12.0-docker', - location=Locations.FIN_01, + location=Locations.FIN_03, ssh_key_ids=ssh_keys_ids, hostname='example', description='example instance', diff --git a/tests/integration_tests/test_instances.py b/tests/integration_tests/test_instances.py index faa52c1..1fe3d66 100644 --- a/tests/integration_tests/test_instances.py +++ b/tests/integration_tests/test_instances.py @@ -16,7 +16,7 @@ def test_create_instance(self, datacrunch_client: DataCrunchClient): # create instance instance = datacrunch_client.instances.create( hostname='test-instance', - location=Locations.FIN_01, + location=Locations.FIN_03, instance_type='CPU.4V', description='test instance', image='ubuntu-18.04', From 905dd05b4dcf6a7c924fcbc6f89a99499053c70e Mon Sep 17 00:00:00 2001 From: Alexey Shamrin Date: Mon, 27 Oct 2025 12:17:54 +0200 Subject: [PATCH 2/3] fix test --- tests/unit_tests/volumes/test_volumes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit_tests/volumes/test_volumes.py b/tests/unit_tests/volumes/test_volumes.py index b40a218..5577271 100644 --- a/tests/unit_tests/volumes/test_volumes.py +++ b/tests/unit_tests/volumes/test_volumes.py @@ -95,7 +95,7 @@ def test_initialize_a_volume(self): assert volume.name == HDD_VOL_NAME assert volume.size == HDD_VOL_SIZE assert volume.type == HDD - assert volume.location == Locations.FIN_01 + assert volume.location == Locations.FIN_03 assert not volume.is_os_volume assert volume.created_at == HDD_VOL_CREATED_AT assert volume.target is None From b8dcdb2badba740c6b8e185bf8cc85b3aa3fc537 Mon Sep 17 00:00:00 2001 From: Alexey Shamrin Date: Mon, 27 Oct 2025 12:42:28 +0200 Subject: [PATCH 3/3] try to fix readthedocs build --- .readthedocs.yaml | 3 +++ docs/requirements.txt | 1 - docs/source/conf.py | 14 +++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1577770..0b01dae 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -32,3 +32,6 @@ sphinx: python: install: - requirements: docs/requirements.txt + - method: pip + path: . + diff --git a/docs/requirements.txt b/docs/requirements.txt index 0e1a189..3661698 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,2 @@ sphinx>=7.0.0 recommonmark>=0.7.1 -datacrunch>=1.8.3 \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 3338181..43ea39b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,13 +13,11 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import datetime +from importlib.metadata import version as pkg_version, PackageNotFoundError from recommonmark.parser import CommonMarkParser -from datacrunch import __version__ import os import sys -sys.path.insert(0, os.path.abspath('../../')) - # -- Project information ----------------------------------------------------- current_year = datetime.datetime.now().year @@ -27,10 +25,12 @@ copyright = f'{current_year}, DataCrunch.io' author = 'DataCrunch.io' -# The short X.Y version -version = __version__ -# The full version, including alpha/beta/rc tags -release = __version__ +try: + release = pkg_version('datacrunch') +except PackageNotFoundError: + release = '0.0.0+dev' + +version = release # -- General configuration ---------------------------------------------------