diff --git a/.gitignore b/.gitignore index 7fd008e65205293130381a5c3f078f75e2147687..6ecd89474b0b7412068be4399fb160ce9544dc4e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ docs/source/source_documentation docs/build # Setuptools SCM -pycommon/_version.py +tmss_pycommon/_version.py # IDE configuration .vscode diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4d4a687213e9fbd3fa2c0b55193f66d62d0836c..7cdcd51b1aa35c857e0217ef2e3ec0d244214f1d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -123,8 +123,8 @@ docker_build: before_script: [] script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build -f docker/pycommon/Dockerfile . --build-arg BUILD_ENV=copy --tag $CI_REGISTRY_IMAGE/pycommon:$CI_COMMIT_REF_SLUG - - docker push $CI_REGISTRY_IMAGE/pycommon:$CI_COMMIT_REF_SLUG + - docker build -f docker/tmss_pycommon/Dockerfile . --build-arg BUILD_ENV=copy --tag $CI_REGISTRY_IMAGE/tmss_pycommon:$CI_COMMIT_REF_SLUG + - docker push $CI_REGISTRY_IMAGE/tmss_pycommon:$CI_COMMIT_REF_SLUG run_integration_tests: stage: integration @@ -153,47 +153,13 @@ publish_on_gitlab: python -m twine upload \ --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* -publish_on_test_pypi: - stage: publish - environment: pypi-test - needs: - - package_files - when: manual - rules: - - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' - script: - - echo "run twine for test pypi" - # - | - # TWINE_PASSWORD=${PIPY_TOKEN} \ - # TWINE_USERNAME=${PIPY_USERNAME} \ - # TODO: replace URL with a pipy URL - # python -m twine upload \ - # --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* - - exit 1 - -publish_on_pypi: - stage: publish - environment: pypi - needs: - - package_files - when: manual - rules: - - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' - script: - - echo "run twine for pypi" - # - | - # TWINE_PASSWORD=${PIPY_TOKEN} \ - # TWINE_USERNAME=${PIPY_USERNAME} \ - # TODO: replace URL with a pipy URL - # python -m twine upload \ - # --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* - - exit 1 - release_job: stage: publish image: registry.gitlab.com/gitlab-org/release-cli:latest rules: - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + before_script: + - uname script: - echo "running release_job" release: diff --git a/README.md b/README.md index e975581fa1126777f339ddc276e7f57cb03eeb63..9afb67544f46eaa7785ece1b858bd2a305685ae6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # PyCommon -![Build status](git.astron.nl/tmss/libraries/pycommon/badges/master/pipeline.svg) -![Test coverage](git.astron.nl/tmss/libraries/pycommon/badges/master/coverage.svg) +![Build status](https://git.astron.nl/tmss/libraries/pycommon/badges/master/pipeline.svg) +![Test coverage](https://git.astron.nl/tmss/libraries/pycommon/badges/master/coverage.svg) ![Latest release](https://git.astron.nl/templates/python-package/badges/master/release.svg) Common Python library for TMSS backend diff --git a/docker/pycommon/Dockerfile b/docker/tmss_pycommon/Dockerfile similarity index 100% rename from docker/pycommon/Dockerfile rename to docker/tmss_pycommon/Dockerfile diff --git a/pyproject.toml b/pyproject.toml index 25e400185b3232bdab6cd7c4766bea2631401458..8ee0c894cf0caa8d9b29e557eac68e52f42d883a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ requires = [ build-backend = "setuptools.build_meta" [tool.setuptools_scm] -version_file = "pycommon/_version.py" +version_file = "tmss_pycommon/_version.py" [tool.pylint] ignore = "_version.py" diff --git a/setup.cfg b/setup.cfg index f4d1501248f4a149f9120a1388b4967d458ef4e6..eb07f6d12941048f8c3317da1dda293213ee6168 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = pycommon +name = tmss-pycommon description = PyCommon package for TMSS backend long_description = file: README.md long_description_content_type = text/markdown diff --git a/tests/__init__.py b/tests/__init__.py index 7a842a45cf5e6a7d9210bf2bacb727950e50ff8c..99e2e4848a6f8a6b99d26098e398e0229c5c4b50 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,4 @@ -from pycommon import isProductionEnvironment +from tmss_pycommon import isProductionEnvironment if isProductionEnvironment(): print("The test modules in %s should not be imported and used in a lofar production environment" % __package__) diff --git a/tests/dbcredentials.py b/tests/dbcredentials.py index f3ba4610a75201706ff84ff7ccaad21688fa3196..9c705e440f32d7c7a80bcb1f9fbf7e1a51db5d43 100755 --- a/tests/dbcredentials.py +++ b/tests/dbcredentials.py @@ -5,7 +5,7 @@ import os import uuid import logging -from pycommon.dbcredentials import Credentials, DBCredentials +from tmss_pycommon.dbcredentials import Credentials, DBCredentials logger = logging.getLogger(__name__) diff --git a/tests/postgres.py b/tests/postgres.py index 25891739da088c1fa567d9183299cba73bdb057d..c79bca6c0a5c6bf087523b0634567b413d8acbcd 100755 --- a/tests/postgres.py +++ b/tests/postgres.py @@ -8,10 +8,10 @@ import logging import psycopg2 import testing.postgresql -from pycommon.dbcredentials import Credentials -from pycommon.postgres import PostgresDatabaseConnection -from pycommon.util import find_free_port -from pycommon.locking import NamedAtomicLock +from tmss_pycommon.dbcredentials import Credentials +from tmss_pycommon.postgres import PostgresDatabaseConnection +from tmss_pycommon.util import find_free_port +from tmss_pycommon.locking import NamedAtomicLock from tests.dbcredentials import TemporaryCredentials diff --git a/tests/test_cache.py b/tests/test_cache.py index 6b5d619168347236d6af7ed7ae9bf0473b5ac3f9..07d67910a553ac7e145415615c7a3df26c782787 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -3,8 +3,8 @@ import unittest -from pycommon.cache import cache -from pycommon.test_utils import unit_test, exit_with_skipped_code_if_skip_unit_tests +from tmss_pycommon.cache import cache +from tmss_pycommon.test_utils import unit_test, exit_with_skipped_code_if_skip_unit_tests exit_with_skipped_code_if_skip_unit_tests() diff --git a/tests/test_cep4_utils.py b/tests/test_cep4_utils.py index 5d56202b8f9e2dea01ca2237f8a04107f958b7aa..30df93e1e5906a10eeedfe6b4a8419671205be70 100755 --- a/tests/test_cep4_utils.py +++ b/tests/test_cep4_utils.py @@ -5,9 +5,9 @@ import unittest from subprocess import call import logging -from pycommon.cep4_utils import * -from pycommon.test_utils import integration_test -from pycommon.test_utils import exit_with_skipped_code_if_skip_integration_tests +from tmss_pycommon.cep4_utils import * +from tmss_pycommon.test_utils import integration_test +from tmss_pycommon.test_utils import exit_with_skipped_code_if_skip_integration_tests exit_with_skipped_code_if_skip_integration_tests() logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.DEBUG) diff --git a/tests/test_cobaltblocksize.py b/tests/test_cobaltblocksize.py index 33d9b890332d00bd639d72622836aa04f260e787..03cacfc7da4ff8920bf54af3eb44c890c9437860 100644 --- a/tests/test_cobaltblocksize.py +++ b/tests/test_cobaltblocksize.py @@ -4,10 +4,10 @@ import unittest import logging -from pycommon.cobaltblocksize import ( +from tmss_pycommon.cobaltblocksize import ( StokesSettings, CorrelatorSettings, BlockConstraints, BlockSize ) -from pycommon.test_utils import unit_test +from tmss_pycommon.test_utils import unit_test logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) diff --git a/tests/test_dbcredentials.py b/tests/test_dbcredentials.py index 52b3f84097993a94ad0716e6cb20c41a0b7a9c71..c41eb5c7e3fe68f1bee2308f01b2e0459d301b7c 100644 --- a/tests/test_dbcredentials.py +++ b/tests/test_dbcredentials.py @@ -7,9 +7,9 @@ import tempfile from uuid import uuid4 from configparser import NoSectionError -from pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests -from pycommon.test_utils import unit_test -from pycommon.dbcredentials import * +from tmss_pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests +from tmss_pycommon.test_utils import unit_test +from tmss_pycommon.dbcredentials import * exit_with_skipped_code_if_skip_unit_tests() diff --git a/tests/test_defaultmailaddresses.py b/tests/test_defaultmailaddresses.py index cc2b9145c0d98966ed8fbefa3c09b9bc5bd7eece..69b11f76ec589f4d317cc31860906cdc86219bd3 100644 --- a/tests/test_defaultmailaddresses.py +++ b/tests/test_defaultmailaddresses.py @@ -4,9 +4,9 @@ import unittest import tempfile -from pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests -from pycommon.test_utils import unit_test -from pycommon.defaultmailaddresses import PipelineEmailConfig +from tmss_pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests +from tmss_pycommon.test_utils import unit_test +from tmss_pycommon.defaultmailaddresses import PipelineEmailConfig exit_with_skipped_code_if_skip_unit_tests() diff --git a/tests/test_json_utils.py b/tests/test_json_utils.py index 72e257e8832fdc9d8729f4e2177c62e4ffb7018d..b041fc0a632440eb9c37524408c4e698df4ceaea 100755 --- a/tests/test_json_utils.py +++ b/tests/test_json_utils.py @@ -6,8 +6,8 @@ import threading import json import logging -from pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests -from pycommon.json_utils import ( +from tmss_pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests +from tmss_pycommon.json_utils import ( get_default_json_object_for_schema, replace_host_in_urls, resolved_remote_refs, resolved_local_refs, get_sub_schema, raise_on_self_refs ) @@ -229,7 +229,7 @@ class TestJSONUtils(unittest.TestCase): '''test if $refs to URL's are properly resolved''' import http.server import socketserver - from pycommon.util import find_free_port + from tmss_pycommon.util import find_free_port port = find_free_port(8000, allow_reuse_of_lingering_port=False) host = "127.0.0.1" @@ -395,7 +395,7 @@ class TestJSONUtils(unittest.TestCase): '''test if ambiguous $refs raise''' import http.server import socketserver - from pycommon.util import find_free_port + from tmss_pycommon.util import find_free_port port = find_free_port(8000, allow_reuse_of_lingering_port=False) host = "127.0.0.1" diff --git a/tests/test_methodtrigger.py b/tests/test_methodtrigger.py index ad085a83362ad7360581d35b73b752ef788b2a05..c2427bc2124be0509ad0005c135f7eb061462166 100644 --- a/tests/test_methodtrigger.py +++ b/tests/test_methodtrigger.py @@ -5,9 +5,9 @@ from threading import Thread import time import unittest -from pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests -from pycommon.methodtrigger import MethodTrigger -from pycommon.test_utils import unit_test +from tmss_pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests +from tmss_pycommon.methodtrigger import MethodTrigger +from tmss_pycommon.test_utils import unit_test exit_with_skipped_code_if_skip_unit_tests() diff --git a/tests/test_parameterset.py b/tests/test_parameterset.py index 11cbd74ab949cf5d7602e8ba3900808d23e9444f..7ebade3dbdaf8be3237a0755649c6e985c429649 100644 --- a/tests/test_parameterset.py +++ b/tests/test_parameterset.py @@ -1,6 +1,6 @@ from unittest import TestCase -from pycommon.parameterset import parameterset +from tmss_pycommon.parameterset import parameterset class TestParameterSet(TestCase): diff --git a/tests/test_postgres.py b/tests/test_postgres.py index f67f0f07e3dc3fba08d9c329f652cb4d76011d66..a24cf44c8a63b824dd8dec170e5fe4397c5ff982 100755 --- a/tests/test_postgres.py +++ b/tests/test_postgres.py @@ -9,9 +9,9 @@ from unittest import mock import psycopg2 -from pycommon.test_utils import exit_with_skipped_code_if_skip_integration_tests -from pycommon.postgres import * -from pycommon.test_utils import integration_test +from tmss_pycommon.test_utils import exit_with_skipped_code_if_skip_integration_tests +from tmss_pycommon.postgres import * +from tmss_pycommon.test_utils import integration_test from tests.postgres import PostgresTestDatabaseInstance, PostgresTestMixin exit_with_skipped_code_if_skip_integration_tests() @@ -45,7 +45,7 @@ class TestPostgres(MyPostgresTestMixin, unittest.TestCase): incorrect_dbcreds.port += 1 # test if connecting fails - with mock.patch('pycommon.database.logger') as mocked_logger: + with mock.patch('tmss_pycommon.database.logger') as mocked_logger: with self.assertRaises(DatabaseConnectionError): NUM_CONNECT_RETRIES = 2 with PostgresDatabaseConnection(dbcreds=incorrect_dbcreds, connect_retry_interval=0.1, num_connect_retries=NUM_CONNECT_RETRIES) as db: diff --git a/tests/test_test_utils.py b/tests/test_test_utils.py index 5cf36a3d9cf5dc0d2a3fb784333b7c7563eb696a..eb0bbf866a79769c32ebe8c20a6e6c723b20ef2b 100644 --- a/tests/test_test_utils.py +++ b/tests/test_test_utils.py @@ -1,7 +1,7 @@ # Copyright (C) 2024 ASTRON (Netherlands Institute for Radio Astronomy) # SPDX-License-Identifier: GPL-3.0-or-later -from pycommon.test_utils import * +from tmss_pycommon.test_utils import * exit_with_skipped_code_if_skip_unit_tests() diff --git a/tests/test_toposort.py b/tests/test_toposort.py index f31fd1dac20e87c9a86671b689747b8b7ccea38a..be8e18a70ae8f8314fb7dc7a72ce5917d7a347fe 100644 --- a/tests/test_toposort.py +++ b/tests/test_toposort.py @@ -3,8 +3,8 @@ import unittest -from pycommon.toposort import Graph, toposorted -from pycommon.test_utils import unit_test +from tmss_pycommon.toposort import Graph, toposorted +from tmss_pycommon.test_utils import unit_test class TestGraph(unittest.TestCase): diff --git a/tests/test_typing.py b/tests/test_typing.py index 63232438a2d7bcd0a0383e3f93fce9b56a03efae..e8c531fafbbb27f56533ff250f17f201477e9329 100755 --- a/tests/test_typing.py +++ b/tests/test_typing.py @@ -4,7 +4,7 @@ import unittest import logging -from pycommon.typing import check_type_hints +from tmss_pycommon.typing import check_type_hints logger = logging.getLogger(__name__) logging.basicConfig(format='%(asctime)s %(process)s %(threadName)s %(levelname)s %(message)s', level=logging.DEBUG) diff --git a/tests/test_util.py b/tests/test_util.py index 41528e201b415aace3da1d9c0376ec44df15957d..8e7d9aaf28188f740792c77074c0b56232f01232 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -3,10 +3,10 @@ import unittest -from pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests -from pycommon.test_utils import unit_test +from tmss_pycommon.test_utils import exit_with_skipped_code_if_skip_unit_tests +from tmss_pycommon.test_utils import unit_test -from pycommon.util import * +from tmss_pycommon.util import * exit_with_skipped_code_if_skip_unit_tests() diff --git a/pycommon/__init__.py b/tmss_pycommon/__init__.py similarity index 100% rename from pycommon/__init__.py rename to tmss_pycommon/__init__.py diff --git a/pycommon/cache.py b/tmss_pycommon/cache.py similarity index 100% rename from pycommon/cache.py rename to tmss_pycommon/cache.py diff --git a/pycommon/cep4_utils.py b/tmss_pycommon/cep4_utils.py similarity index 99% rename from pycommon/cep4_utils.py rename to tmss_pycommon/cep4_utils.py index 8caf0c9bfa55694c0e56ea6f39d799906731805f..65555a0ef97303a1770e9e50e47a8d85d72eeeda 100755 --- a/pycommon/cep4_utils.py +++ b/tmss_pycommon/cep4_utils.py @@ -6,8 +6,8 @@ from random import randint import math import os -from pycommon.ssh_utils import ssh_cmd_list -from pycommon.subprocess_utils import ( +from tmss_pycommon.ssh_utils import ssh_cmd_list +from tmss_pycommon.subprocess_utils import ( check_output_returning_strings, execute_in_parallel ) diff --git a/pycommon/cobaltblocksize.py b/tmss_pycommon/cobaltblocksize.py similarity index 99% rename from pycommon/cobaltblocksize.py rename to tmss_pycommon/cobaltblocksize.py index 3ec0e89b9ccec002f7eab05e1e15de3bf6d8cbee..c54d0f8d395c72e9f20110be1c44bf9c36aa852a 100755 --- a/pycommon/cobaltblocksize.py +++ b/tmss_pycommon/cobaltblocksize.py @@ -29,7 +29,7 @@ """ from math import ceil -from pycommon.math import lcm +from tmss_pycommon.math import lcm class CorrelatorSettings(object): diff --git a/pycommon/database.py b/tmss_pycommon/database.py similarity index 98% rename from pycommon/database.py rename to tmss_pycommon/database.py index f8c8aa48978bfbbb35453123e66cccf5385958fb..fba0a3bdeb82ea7169c6c718eac68176e020d8ba 100644 --- a/pycommon/database.py +++ b/tmss_pycommon/database.py @@ -10,8 +10,8 @@ from datetime import datetime, timedelta import time import re -from pycommon.util import single_line_with_single_spaces -from pycommon.dbcredentials import DBCredentials +from tmss_pycommon.util import single_line_with_single_spaces +from tmss_pycommon.dbcredentials import DBCredentials logger = logging.getLogger(__name__) diff --git a/pycommon/datetimeutils.py b/tmss_pycommon/datetimeutils.py similarity index 100% rename from pycommon/datetimeutils.py rename to tmss_pycommon/datetimeutils.py diff --git a/pycommon/dbcredentials.py b/tmss_pycommon/dbcredentials.py similarity index 100% rename from pycommon/dbcredentials.py rename to tmss_pycommon/dbcredentials.py diff --git a/pycommon/defaultmailaddresses.py b/tmss_pycommon/defaultmailaddresses.py similarity index 100% rename from pycommon/defaultmailaddresses.py rename to tmss_pycommon/defaultmailaddresses.py diff --git a/pycommon/entrypoints/__init__.py b/tmss_pycommon/entrypoints/__init__.py similarity index 100% rename from pycommon/entrypoints/__init__.py rename to tmss_pycommon/entrypoints/__init__.py diff --git a/pycommon/entrypoints/cep4_info.py b/tmss_pycommon/entrypoints/cep4_info.py similarity index 100% rename from pycommon/entrypoints/cep4_info.py rename to tmss_pycommon/entrypoints/cep4_info.py diff --git a/pycommon/entrypoints/cobaltblocksize.py b/tmss_pycommon/entrypoints/cobaltblocksize.py similarity index 98% rename from pycommon/entrypoints/cobaltblocksize.py rename to tmss_pycommon/entrypoints/cobaltblocksize.py index f4168817df0b3d96be2845485c5c16540ef52981..40883cfaceba4b1c538b9e78bb85ce4c701862a0 100644 --- a/pycommon/entrypoints/cobaltblocksize.py +++ b/tmss_pycommon/entrypoints/cobaltblocksize.py @@ -4,7 +4,7 @@ import argparse import sys -from pycommon.cobaltblocksize import ( +from tmss_pycommon.cobaltblocksize import ( CorrelatorSettings, StokesSettings, BlockConstraints, BlockSize ) diff --git a/pycommon/entrypoints/dbcredentials.py b/tmss_pycommon/entrypoints/dbcredentials.py similarity index 97% rename from pycommon/entrypoints/dbcredentials.py rename to tmss_pycommon/entrypoints/dbcredentials.py index 20d0d0aa850d1570409e9c2c2023a788a229ed7a..282855184bdf3e5df2686f9f4ce53716a6d114a2 100644 --- a/pycommon/entrypoints/dbcredentials.py +++ b/tmss_pycommon/entrypoints/dbcredentials.py @@ -5,7 +5,7 @@ import sys from optparse import OptionParser import logging -from pycommon.dbcredentials import DBCredentials +from tmss_pycommon.dbcredentials import DBCredentials logger = logging.getLogger() diff --git a/pycommon/entrypoints/oracle.py b/tmss_pycommon/entrypoints/oracle.py similarity index 81% rename from pycommon/entrypoints/oracle.py rename to tmss_pycommon/entrypoints/oracle.py index 15525fe2fe3aa23689c39d9b38e5f1b20b0270da..3f75bc9f235fc535621496e4ad4ce35b2a0d3192 100644 --- a/pycommon/entrypoints/oracle.py +++ b/tmss_pycommon/entrypoints/oracle.py @@ -3,9 +3,9 @@ import logging -from pycommon.database import FETCH_ALL -from pycommon.dbcredentials import DBCredentials -from pycommon.oracle import OracleDatabaseConnection +from tmss_pycommon.database import FETCH_ALL +from tmss_pycommon.dbcredentials import DBCredentials +from tmss_pycommon.oracle import OracleDatabaseConnection def main(): diff --git a/pycommon/factory.py b/tmss_pycommon/factory.py similarity index 100% rename from pycommon/factory.py rename to tmss_pycommon/factory.py diff --git a/pycommon/flask_utils.py b/tmss_pycommon/flask_utils.py similarity index 100% rename from pycommon/flask_utils.py rename to tmss_pycommon/flask_utils.py diff --git a/pycommon/h5_utils.py b/tmss_pycommon/h5_utils.py similarity index 100% rename from pycommon/h5_utils.py rename to tmss_pycommon/h5_utils.py diff --git a/pycommon/json_utils.py b/tmss_pycommon/json_utils.py similarity index 99% rename from pycommon/json_utils.py rename to tmss_pycommon/json_utils.py index 38a2849dae8731475a5c5f2341fddb3109f374c3..aabe26addf6bdc3ee0f0a2c9672a592c006ff0a3 100644 --- a/pycommon/json_utils.py +++ b/tmss_pycommon/json_utils.py @@ -11,7 +11,7 @@ import typing import jsonschema import requests -from pycommon.util import single_line_with_single_spaces +from tmss_pycommon.util import single_line_with_single_spaces class JSONError(Exception): diff --git a/pycommon/lcu_utils.py b/tmss_pycommon/lcu_utils.py similarity index 99% rename from pycommon/lcu_utils.py rename to tmss_pycommon/lcu_utils.py index 9c15b055bc9f685ae7197ef58581fa9b84338a50..e0a29324c637c40af061cb3cc55c2d27fa6b63d0 100755 --- a/pycommon/lcu_utils.py +++ b/tmss_pycommon/lcu_utils.py @@ -7,8 +7,8 @@ import os import uuid import struct -from pycommon.ssh_utils import ssh_cmd_list -from pycommon.subprocess_utils import ( +from tmss_pycommon.ssh_utils import ssh_cmd_list +from tmss_pycommon.subprocess_utils import ( execute_in_parallel, wrap_composite_command, communicate_returning_strings ) diff --git a/pycommon/locking.py b/tmss_pycommon/locking.py similarity index 100% rename from pycommon/locking.py rename to tmss_pycommon/locking.py diff --git a/pycommon/math.py b/tmss_pycommon/math.py similarity index 100% rename from pycommon/math.py rename to tmss_pycommon/math.py diff --git a/pycommon/methodtrigger.py b/tmss_pycommon/methodtrigger.py similarity index 100% rename from pycommon/methodtrigger.py rename to tmss_pycommon/methodtrigger.py diff --git a/pycommon/metrics.py b/tmss_pycommon/metrics.py similarity index 100% rename from pycommon/metrics.py rename to tmss_pycommon/metrics.py diff --git a/pycommon/oracle.py b/tmss_pycommon/oracle.py similarity index 96% rename from pycommon/oracle.py rename to tmss_pycommon/oracle.py index 0fe83964f5d6cec2a151b9f74b19f154132c44f6..04a89148ee2fb7fd9df620573c9741708bcdbb03 100644 --- a/pycommon/oracle.py +++ b/tmss_pycommon/oracle.py @@ -10,12 +10,12 @@ from datetime import datetime import cx_Oracle import re -from pycommon.dbcredentials import DBCredentials -from pycommon.database import ( +from tmss_pycommon.dbcredentials import DBCredentials +from tmss_pycommon.database import ( AbstractDatabaseConnection, DatabaseError, DatabaseConnectionError, DatabaseExecutionError, FETCH_NONE, FETCH_ONE, FETCH_ALL ) -from pycommon.util import single_line_with_single_spaces +from tmss_pycommon.util import single_line_with_single_spaces logger = logging.getLogger(__name__) diff --git a/pycommon/parameterset.py b/tmss_pycommon/parameterset.py similarity index 100% rename from pycommon/parameterset.py rename to tmss_pycommon/parameterset.py diff --git a/pycommon/postgres.py b/tmss_pycommon/postgres.py similarity index 98% rename from pycommon/postgres.py rename to tmss_pycommon/postgres.py index 15c64a86d489e5eb2b94f01c22d4f9e0f2b88d48..7c399260495dc4f0f491f4eeccf0aa3ef1095b72 100644 --- a/pycommon/postgres.py +++ b/tmss_pycommon/postgres.py @@ -17,10 +17,10 @@ import psycopg2 import psycopg2.extras import psycopg2.extensions -from pycommon.util import single_line_with_single_spaces -from pycommon.datetimeutils import totalSeconds -from pycommon.dbcredentials import DBCredentials -from pycommon.database import ( +from tmss_pycommon.util import single_line_with_single_spaces +from tmss_pycommon.datetimeutils import totalSeconds +from tmss_pycommon.dbcredentials import DBCredentials +from tmss_pycommon.database import ( AbstractDatabaseConnection, DatabaseError, DatabaseConnectionError, DatabaseExecutionError, FETCH_NONE, FETCH_ONE, FETCH_ALL ) diff --git a/pycommon/ring_coordinates.py b/tmss_pycommon/ring_coordinates.py similarity index 100% rename from pycommon/ring_coordinates.py rename to tmss_pycommon/ring_coordinates.py diff --git a/pycommon/ssh_utils.py b/tmss_pycommon/ssh_utils.py similarity index 100% rename from pycommon/ssh_utils.py rename to tmss_pycommon/ssh_utils.py diff --git a/pycommon/station_coordinates.py b/tmss_pycommon/station_coordinates.py similarity index 100% rename from pycommon/station_coordinates.py rename to tmss_pycommon/station_coordinates.py diff --git a/pycommon/subprocess_utils.py b/tmss_pycommon/subprocess_utils.py similarity index 100% rename from pycommon/subprocess_utils.py rename to tmss_pycommon/subprocess_utils.py diff --git a/pycommon/test_utils.py b/tmss_pycommon/test_utils.py similarity index 100% rename from pycommon/test_utils.py rename to tmss_pycommon/test_utils.py diff --git a/pycommon/threading_utils.py b/tmss_pycommon/threading_utils.py similarity index 100% rename from pycommon/threading_utils.py rename to tmss_pycommon/threading_utils.py diff --git a/pycommon/toposort.py b/tmss_pycommon/toposort.py similarity index 100% rename from pycommon/toposort.py rename to tmss_pycommon/toposort.py diff --git a/pycommon/typing.py b/tmss_pycommon/typing.py similarity index 100% rename from pycommon/typing.py rename to tmss_pycommon/typing.py diff --git a/pycommon/util.py b/tmss_pycommon/util.py similarity index 100% rename from pycommon/util.py rename to tmss_pycommon/util.py diff --git a/pycommon/xmlparse.py b/tmss_pycommon/xmlparse.py similarity index 100% rename from pycommon/xmlparse.py rename to tmss_pycommon/xmlparse.py diff --git a/tox.ini b/tox.ini index 23099c4772074e53e34a9493765cc4d45b480884..6714e7a3d06f91f56c7e68442c658bdddfd89f0b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,9 @@ [tox] # Generative environment list to test all supported Python versions -envlist = py3{10,11,12,13} +envlist = py3{10,11,12,13},pep8,black,pylint min_version = 4.3.3 requires = - tox-ignore-env-name-mismatch ~= 0.2.0 + tox-ignore-env-name-mismatch >= 0.2.0 [testenv] usedevelop = True @@ -17,28 +17,29 @@ deps = -r{toxinidir}/tests/requirements.txt commands = {envpython} --version - {envpython} -m pytest + {envpython} -m pytest tests/{posargs} [testenv:coverage] commands = {envpython} --version - {envpython} -m pytest --cov-report term --cov-report xml --cov-report html --cov=pycommon + {envpython} -m pytest --cov-report term --cov-report xml --cov-report html --cov=tmss_pycommon tests/{posargs} # Use generative name and command prefixes to reuse the same virtualenv # for all linting jobs. [testenv:{pep8,black,pylint,format}] usedevelop = False +package = editable envdir = {toxworkdir}/linting commands = pep8: {envpython} -m flake8 --version - pep8: {envpython} -m flake8 pycommon tests + pep8: {envpython} -m flake8 tmss_pycommon tests black: {envpython} -m black --version - black: {envpython} -m black --check --diff pycommon tests + black: {envpython} -m black --check --diff tmss_pycommon tests pylint: {envpython} -m pylint --version - pylint: {envpython} -m pylint pycommon tests - format: {envpython} -m autopep8 -v -aa --in-place --recursive pycommon + pylint: {envpython} -m pylint tmss_pycommon tests + format: {envpython} -m autopep8 -v -aa --in-place --recursive tmss_pycommon format: {envpython} -m autopep8 -v -aa --in-place --recursive tests - format: {envpython} -m black -v pycommon tests + format: {envpython} -m black -v tmss_pycommon tests [testenv:build] usedevelop = False