Skip to content

Python: Migrate to use "implicit namespace packages" (PEP 420) #666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/


Expand Down
8 changes: 4 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import os
import re

from setuptools import find_packages, setup
from setuptools import find_namespace_packages, setup


def read(path):
Expand All @@ -45,15 +45,14 @@ def read(path):
url="https://github.com/crate/crate-python",
author="Crate.io",
author_email="[email protected]",
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",
Expand Down
30 changes: 0 additions & 30 deletions src/crate/__init__.py
Original file line number Diff line number Diff line change
@@ -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__)
1 change: 0 additions & 1 deletion src/crate/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# package
Loading