From 1217287ec4bd5ef2d58e4184b0ecbaeb28cfd1c7 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Mon, 4 Nov 2024 17:01:37 +0100 Subject: [PATCH 1/3] Dependencies: Update to `crate-1.0.0.dev2` to support final GA testing --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6dd3d49..41cfbb4 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ requirements = [ 'colorama<1', 'Pygments>=2.4,<3', - 'crate>=0.35.2', + 'crate>=1.0.0.dev2', 'platformdirs<5', 'prompt-toolkit>=3.0,<4', 'tabulate>=0.9,<0.10', From 931f78281543ba676c8b4188386562671c48cd6f Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Mon, 4 Nov 2024 19:24:28 +0100 Subject: [PATCH 2/3] Chore: Improve setup.py and setup.cfg - Update keywords: Use `cratedb` - Don't build universal wheels, Python 2 is a thing of the past --- setup.cfg | 3 --- setup.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index 47ae731..29ecb2f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,3 @@ -[wheel] -universal=1 - [flake8] ignore = E501, C901, W503, E741 exclude = tabulate.py diff --git a/setup.py b/setup.py index 41cfbb4..f5d3d19 100644 --- a/setup.py +++ b/setup.py @@ -66,7 +66,7 @@ def read(path): long_description_content_type='text/x-rst', platforms=['any'], license='Apache License 2.0', - keywords='crate db data client shell', + keywords='cratedb db data client shell', packages=['crate.crash'], namespace_packages=['crate'], entry_points={ From 70343880f1b20d9026066b2dd3a94b90914176bc Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Mon, 4 Nov 2024 19:23:32 +0100 Subject: [PATCH 3/3] Python: Migrate to use "implicit namespace packages" (PEP 420) --- CHANGES.txt | 4 ++++ crate/__init__.py | 30 ------------------------ devtools/ci.sh | 4 ++-- setup.py | 9 +++---- src/crate/__init__.py | 0 {crate => src/crate}/crash/__init__.py | 0 {crate => src/crate}/crash/__main__.py | 0 {crate => src/crate}/crash/command.py | 0 {crate => src/crate}/crash/commands.py | 0 {crate => src/crate}/crash/config.py | 0 {crate => src/crate}/crash/connect.txt | 0 {crate => src/crate}/crash/keybinding.py | 0 {crate => src/crate}/crash/layout.py | 0 {crate => src/crate}/crash/output.txt | 0 {crate => src/crate}/crash/outputs.py | 0 {crate => src/crate}/crash/printer.py | 0 {crate => src/crate}/crash/repl.py | 0 {crate => src/crate}/crash/sysinfo.py | 0 {crate => src/crate}/crash/tabulate.py | 0 tests/test_integration.py | 4 ++-- 20 files changed, 13 insertions(+), 38 deletions(-) delete mode 100644 crate/__init__.py create mode 100644 src/crate/__init__.py rename {crate => src/crate}/crash/__init__.py (100%) rename {crate => src/crate}/crash/__main__.py (100%) rename {crate => src/crate}/crash/command.py (100%) rename {crate => src/crate}/crash/commands.py (100%) rename {crate => src/crate}/crash/config.py (100%) rename {crate => src/crate}/crash/connect.txt (100%) rename {crate => src/crate}/crash/keybinding.py (100%) rename {crate => src/crate}/crash/layout.py (100%) rename {crate => src/crate}/crash/output.txt (100%) rename {crate => src/crate}/crash/outputs.py (100%) rename {crate => src/crate}/crash/printer.py (100%) rename {crate => src/crate}/crash/repl.py (100%) rename {crate => src/crate}/crash/sysinfo.py (100%) rename {crate => src/crate}/crash/tabulate.py (100%) diff --git a/CHANGES.txt b/CHANGES.txt index e0a1805..039bc65 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changes for crash Unreleased ========== +- Python: Migrated to use "implicit namespace packages" instead of "declared + namespaces" for the ``crate`` namespace package, see `PEP 420`_. + +.. _PEP 420: https://peps.python.org/pep-0420/ 2024/04/24 0.31.5 ================= diff --git a/crate/__init__.py b/crate/__init__.py deleted file mode 100644 index 026c067..0000000 --- a/crate/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8; -*- -# -# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor -# license agreements. See the NOTICE file distributed with this work for -# additional information regarding copyright ownership. Crate licenses -# this file to you under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. You may -# obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# However, if you have executed another commercial license agreement -# with Crate these terms will supersede the license and you may use the -# software solely pursuant to the terms of the relevant commercial agreement. - -# this is a namespace package -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - - __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/devtools/ci.sh b/devtools/ci.sh index f506f88..a8e59ea 100755 --- a/devtools/ci.sh +++ b/devtools/ci.sh @@ -2,6 +2,6 @@ set -e -x -isort --check --diff crate/ tests/ setup.py -flake8 crate/crash +isort --check --diff src/crate/ tests/ setup.py +flake8 src/crate/crash coverage run -m unittest -v diff --git a/setup.py b/setup.py index f5d3d19..ff63d8a 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ def read(path): read('README.rst') ) -versionf_content = read(os.path.join('crate', 'crash', '__init__.py')) +versionf_content = read(os.path.join('src', 'crate', 'crash', '__init__.py')) version_rex = r'^__version__ = [\'"]([^\'"]*)[\'"]$' m = re.search(version_rex, versionf_content, re.M) if m: @@ -68,7 +68,7 @@ def read(path): license='Apache License 2.0', keywords='cratedb db data client shell', packages=['crate.crash'], - namespace_packages=['crate'], + package_dir={"": "src"}, entry_points={ 'console_scripts': [ 'crash = crate.crash.command:main', @@ -76,9 +76,10 @@ def read(path): }, extras_require=dict( test=[ - 'crate[test]', + 'crate[test]>=1.0.0.dev2', + 'cratedb-toolkit[testing]', + 'sqlalchemy-cratedb', 'zc.customdoctests<2', - 'cratedb-toolkit[test]', ], devel=[ 'coverage<8', diff --git a/src/crate/__init__.py b/src/crate/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/crate/crash/__init__.py b/src/crate/crash/__init__.py similarity index 100% rename from crate/crash/__init__.py rename to src/crate/crash/__init__.py diff --git a/crate/crash/__main__.py b/src/crate/crash/__main__.py similarity index 100% rename from crate/crash/__main__.py rename to src/crate/crash/__main__.py diff --git a/crate/crash/command.py b/src/crate/crash/command.py similarity index 100% rename from crate/crash/command.py rename to src/crate/crash/command.py diff --git a/crate/crash/commands.py b/src/crate/crash/commands.py similarity index 100% rename from crate/crash/commands.py rename to src/crate/crash/commands.py diff --git a/crate/crash/config.py b/src/crate/crash/config.py similarity index 100% rename from crate/crash/config.py rename to src/crate/crash/config.py diff --git a/crate/crash/connect.txt b/src/crate/crash/connect.txt similarity index 100% rename from crate/crash/connect.txt rename to src/crate/crash/connect.txt diff --git a/crate/crash/keybinding.py b/src/crate/crash/keybinding.py similarity index 100% rename from crate/crash/keybinding.py rename to src/crate/crash/keybinding.py diff --git a/crate/crash/layout.py b/src/crate/crash/layout.py similarity index 100% rename from crate/crash/layout.py rename to src/crate/crash/layout.py diff --git a/crate/crash/output.txt b/src/crate/crash/output.txt similarity index 100% rename from crate/crash/output.txt rename to src/crate/crash/output.txt diff --git a/crate/crash/outputs.py b/src/crate/crash/outputs.py similarity index 100% rename from crate/crash/outputs.py rename to src/crate/crash/outputs.py diff --git a/crate/crash/printer.py b/src/crate/crash/printer.py similarity index 100% rename from crate/crash/printer.py rename to src/crate/crash/printer.py diff --git a/crate/crash/repl.py b/src/crate/crash/repl.py similarity index 100% rename from crate/crash/repl.py rename to src/crate/crash/repl.py diff --git a/crate/crash/sysinfo.py b/src/crate/crash/sysinfo.py similarity index 100% rename from crate/crash/sysinfo.py rename to src/crate/crash/sysinfo.py diff --git a/crate/crash/tabulate.py b/src/crate/crash/tabulate.py similarity index 100% rename from crate/crash/tabulate.py rename to src/crate/crash/tabulate.py diff --git a/tests/test_integration.py b/tests/test_integration.py index 877d118..033c478 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -113,10 +113,10 @@ def __call__(self, *args, **kwargs): class DocumentationTest(TestCase): def test_output(self): - testfile('../crate/crash/output.txt') + testfile('../src/crate/crash/output.txt') def test_connect(self): - testfile('../crate/crash/connect.txt') + testfile('../src/crate/crash/connect.txt') class CommandTest(TestCase):