Skip to content

Commit 8201d0b

Browse files
committed
add uv impl template
1 parent f507dbd commit 8201d0b

2 files changed

Lines changed: 243 additions & 0 deletions

File tree

pyproject-uv.toml

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
[build-system]
19+
requires = ["setuptools>=61", "wheel", "cython>=3.0.0"]
20+
build-backend = "setuptools.build_meta"
21+
22+
[tool.setuptools.packages.find]
23+
include = ["pyiceberg*"]
24+
25+
[tool.setuptools.package-data]
26+
"*" = ["*.so", "*.pyd", "*.pyx"]
27+
28+
[tool.setuptools.exclude-package-data]
29+
pyiceberg = ["*.pyc"]
30+
31+
# [tool.setuptools]
32+
# packages = ["pyiceberg"]
33+
34+
# [[tool.setuptools.ext-modules]]
35+
# name = "pyiceberg.avro.decoder_fast"
36+
# sources = ["pyiceberg/avro/decoder_fast.pyx"]
37+
# language = "c"
38+
39+
40+
# [tool.setuptools.ext-modules.extra-compile-args]
41+
# "win32" = ["/O2"]
42+
# "linux" = ["-O3"]
43+
# "darwin" = ["-O3"]
44+
45+
[tool.uv]
46+
no-build-isolation-package = ["cython"]
47+
48+
[project]
49+
name = "pyiceberg"
50+
version = "0.9.2"
51+
description = "Apache Iceberg is an open table format for huge analytic datasets"
52+
readme = "README.md"
53+
license-files = ["LICENSE"]
54+
license = "Apache-2.0"
55+
authors = [
56+
{ name = "Apache Software Foundation", email = "dev@iceberg.apache.org" }
57+
]
58+
requires-python = ">=3.9.2,!=3.9.7"
59+
classifiers = [
60+
"Operating System :: OS Independent",
61+
"Programming Language :: Python :: 3.9",
62+
"Programming Language :: Python :: 3.10",
63+
"Programming Language :: Python :: 3.11",
64+
"Programming Language :: Python :: 3.12",
65+
]
66+
dependencies = [
67+
"mmh3>=4.0.0,<6.0.0",
68+
"requests>=2.20.0,<3.0.0",
69+
"click>=7.1.1,<9.0.0",
70+
"rich>=10.11.0,<14.0.0",
71+
"strictyaml>=1.7.0,<2.0.0",
72+
"pydantic>=2.0,<3.0,!=2.4.0,!=2.4.1",
73+
"sortedcontainers==2.4.0",
74+
"fsspec>=2023.1.0",
75+
"pyparsing>=3.1.0,<4.0.0",
76+
"zstandard>=0.13.0,<1.0.0",
77+
"tenacity>=8.2.3,<10.0.0",
78+
"cachetools>=5.5.0,<6.0.0",
79+
]
80+
81+
[project.optional-dependencies]
82+
pyarrow = ["pyarrow>=17.0.0,<20.0.0"]
83+
pandas = ["pandas>=1.0.0,<3.0.0", "pyarrow>=17.0.0,<20.0.0"]
84+
duckdb = ["duckdb>=0.5.0,<2.0.0", "pyarrow>=17.0.0,<20.0.0"]
85+
ray = [
86+
"ray==2.10.0; python_version<'3.9'",
87+
"ray>=2.10.0,<3.0.0; python_version>='3.9'",
88+
"pyarrow>=17.0.0,<20.0.0",
89+
"pandas>=1.0.0,<3.0.0",
90+
]
91+
daft = ["getdaft>=0.2.12"]
92+
polars = ["polars>=1.21.0,<2.0.0"]
93+
snappy = ["python-snappy>=0.6.0,<1.0.0"]
94+
hive = ["thrift>=0.13.0,<1.0.0"]
95+
hive-kerberos = [
96+
"thrift>=0.13.0,<1.0.0",
97+
"thrift-sasl>=0.4.3",
98+
"kerberos>=1.3.1; platform_system != 'Windows'",
99+
"winkerberos>=0.12.2; platform_system == 'Windows'",
100+
]
101+
s3fs = ["s3fs>=2023.1.0"]
102+
glue = ["boto3>=1.24.59", "mypy-boto3-glue>=1.28.18"]
103+
adlfs = ["adlfs>=2023.1.0"]
104+
dynamodb = ["boto3>=1.24.59"]
105+
zstandard = ["zstandard>=0.13.0,<1.0.0"]
106+
sql-postgres = ["sqlalchemy>=2.0.18,<3.0.0", "psycopg2-binary>=2.9.6"]
107+
sql-sqlite = ["sqlalchemy>=2.0.18,<3.0.0"]
108+
gcsfs = ["gcsfs>=2023.1.0"]
109+
rest-sigv4 = ["boto3>=1.24.59"]
110+
pyiceberg-core = ["pyiceberg-core>=0.4.0,<1.0.0"]
111+
dev = [
112+
"pytest==7.4.4",
113+
"pytest-checkdocs==2.13.0",
114+
"pytest-lazy-fixture==0.6.3",
115+
"pre-commit==4.1.0",
116+
"fastavro==1.10.0",
117+
"coverage[toml]>=7.4.2,<8.0.0",
118+
"requests-mock==1.12.1",
119+
"moto[server]>=5.0.2,<6.0.0",
120+
"typing-extensions==4.12.2",
121+
"pytest-mock==3.14.0",
122+
"pyspark==3.5.3",
123+
"cython==3.0.12",
124+
"deptry>=0.14,<0.24",
125+
"datafusion>=44,<46",
126+
"docutils!=0.21.post1",
127+
"ruff>=0.1.0",
128+
]
129+
docs = [
130+
"mkdocs==1.6.1",
131+
"griffe==1.5.7",
132+
"jinja2==3.1.5",
133+
"mkdocstrings==0.28.1",
134+
"mkdocstrings-python==1.16.1",
135+
"mkdocs-literate-nav==0.6.1",
136+
"mkdocs-autorefs==1.4.0",
137+
"mkdocs-gen-files==0.5.0",
138+
"mkdocs-material==9.6.5",
139+
"mkdocs-material-extensions==1.3.1",
140+
"mkdocs-section-index==0.3.9",
141+
]
142+
143+
[project.scripts]
144+
pyiceberg = "pyiceberg.cli.console:run"
145+
146+
[project.urls]
147+
Homepage = "https://py.iceberg.apache.org/"
148+
Repository = "https://github.com/apache/iceberg-python"
149+
150+
151+
152+
[tool.pytest.ini_options]
153+
testpaths = ["tests"]
154+
markers = [
155+
"unmarked: marks a test as a unittest",
156+
"s3: marks a test as requiring access to s3 compliant storage (use with --aws-access-key-id, --aws-secret-access-key, and --endpoint args)",
157+
"adls: marks a test as requiring access to adls compliant storage (use with --adls.account-name, --adls.account-key, and --adls.endpoint args)",
158+
"integration: marks integration tests against Apache Spark",
159+
"gcs: marks a test as requiring access to gcs compliant storage (use with --gs.token, --gs.project, and --gs.endpoint)",
160+
"benchmark: collection of tests to validate read/write performance before and after a change"
161+
]
162+
filterwarnings = [
163+
"error",
164+
"ignore:A plugin raised an exception during an old-style hookwrapper teardown.",
165+
"ignore:unclosed <socket.socket",
166+
"ignore:distutils Version classes are deprecated. Use packaging.version instead.",
167+
"ignore:datetime.datetime.utcfromtimestamp\\(\\) is deprecated and scheduled for removal in a future version.",
168+
"ignore:datetime.datetime.utcnow\\(\\) is deprecated and scheduled for removal in a future version.",
169+
"ignore:is_datetime64tz_dtype is deprecated and will be removed in a future version.",
170+
]
171+
172+
[tool.mypy]
173+
mypy_path = "python"
174+
no_implicit_optional = true
175+
namespace_packages = false
176+
warn_redundant_casts = true
177+
warn_unreachable = true
178+
warn_unused_ignores = true
179+
disallow_any_generics = true
180+
disallow_untyped_defs = true
181+
implicit_reexport = false
182+
183+
# ...existing mypy overrides...
184+
185+
[tool.coverage.run]
186+
source = ['pyiceberg/']

setup.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import os
2+
3+
from setuptools import Distribution, Extension, setup
4+
5+
print(os.path.dirname(__file__))
6+
allowed_to_fail = os.environ.get("CIBUILDWHEEL", "0") != "1"
7+
8+
ext_modules = []
9+
10+
try:
11+
import Cython.Compiler.Options
12+
from Cython.Build import cythonize
13+
14+
Cython.Compiler.Options.annotate = True
15+
16+
if os.name == "nt": # Windows
17+
extra_compile_args = ["/O2"]
18+
else: # UNIX-based systems
19+
extra_compile_args = ["-O3"]
20+
21+
# Use relative path only
22+
package_path = "pyiceberg"
23+
24+
extension = Extension(
25+
name="pyiceberg.avro.decoder_fast",
26+
sources=[
27+
os.path.join(package_path, "avro", "decoder_fast.pyx"),
28+
],
29+
extra_compile_args=extra_compile_args,
30+
language="c",
31+
)
32+
33+
ext_modules = cythonize(
34+
[extension],
35+
include_path=["pyiceberg"],
36+
language_level=3,
37+
annotate=True,
38+
build_dir="build", # Specify build directory to avoid absolute paths
39+
)
40+
41+
except ImportError:
42+
if not allowed_to_fail:
43+
raise
44+
# Cython not available, skip extension building
45+
46+
47+
class BinaryDistribution(Distribution):
48+
def has_ext_modules(self) -> bool:
49+
return True
50+
51+
52+
setup(
53+
distclass=BinaryDistribution,
54+
ext_modules=ext_modules,
55+
include_package_data=True,
56+
exclude_package_data={"pyiceberg": ["*.pyc"]},
57+
)

0 commit comments

Comments
 (0)