From dfeb8714fba2e1891b08f5fd1c270171bdd1934c Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 1 Nov 2024 14:30:14 +0100 Subject: [PATCH 1/2] Packaging: Adjust MANIFEST.in, reflecting recent updates --- MANIFEST.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index b674f5da..18d294ce 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ include LICENSE -include *.rst -recursive-include docs *.txt -recursive-include src *.txt *.rst -recursive-exclude src tests*.py +include NOTICE +include *.rst *.txt +recursive-include docs *.rst *.txt *.py *.conf +prune docs/.crate-docs From b8e3e6b855d5ec61446c993ac5dbc9c55d1abcca Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 1 Nov 2024 14:30:48 +0100 Subject: [PATCH 2/2] Python: Migrate to use "implicit namespace packages" (PEP 420) ... instead of "declared namespaces" for the `crate` namespace package, see PEP 420 [1], and setuptools docs [2]. > Historically, there were two methods to create namespace packages. One > is the `pkg_resources` style supported by `setuptools` and the other > one being `pkgutils` style offered by `pkgutils` module in Python. > Both are now considered _deprecated_. > > -- Legacy Namespace Packages [3] [1] https://peps.python.org/pep-0420/ [2] https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages [3] https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#legacy-namespace-packages --- CHANGES.txt | 3 +++ setup.py | 7 +++---- src/crate/__init__.py | 30 ------------------------------ src/crate/testing/__init__.py | 1 - 4 files changed, 6 insertions(+), 35 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index bb32a089..38272871 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -17,9 +17,12 @@ Unreleased - Error handling: At two spots in cursor / value converter handling, where ``assert`` statements have been used, ``ValueError`` exceptions are raised now. +- Python: Migrated to use "implicit namespace packages" instead of "declared + namespaces" for the ``crate`` namespace package, see `PEP 420`_. .. _Migrate from crate.client to sqlalchemy-cratedb: https://cratedb.com/docs/sqlalchemy-cratedb/migrate-from-crate-client.html +.. _PEP 420: https://peps.python.org/pep-0420/ .. _sqlalchemy-cratedb: https://pypi.org/project/sqlalchemy-cratedb/ diff --git a/setup.py b/setup.py index 958b746f..8f9ed5bc 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ import os import re -from setuptools import find_packages, setup +from setuptools import find_namespace_packages, setup def read(path): @@ -45,15 +45,14 @@ def read(path): url="https://github.com/crate/crate-python", author="Crate.io", author_email="office@crate.io", - package_dir={"": "src"}, description="CrateDB Python Client", long_description=long_description, long_description_content_type="text/x-rst", platforms=["any"], license="Apache License 2.0", keywords="cratedb db api dbapi database sql http rdbms olap", - packages=find_packages("src"), - namespace_packages=["crate"], + packages=find_namespace_packages("src"), + package_dir={"": "src"}, install_requires=[ "urllib3<2.3", "verlib2==0.2.0", diff --git a/src/crate/__init__.py b/src/crate/__init__.py index 026c0677..e69de29b 100644 --- a/src/crate/__init__.py +++ b/src/crate/__init__.py @@ -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/src/crate/testing/__init__.py b/src/crate/testing/__init__.py index 5bb534f7..e69de29b 100644 --- a/src/crate/testing/__init__.py +++ b/src/crate/testing/__init__.py @@ -1 +0,0 @@ -# package