diff --git a/.github/ISSUE_TEMPLATE/iceberg_bug_report.yml b/.github/ISSUE_TEMPLATE/iceberg_bug_report.yml new file mode 100644 index 0000000000..41110cf397 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/iceberg_bug_report.yml @@ -0,0 +1,28 @@ +--- +name: Iceberg Bug report 🐞 +description: Problems, bugs and issues with Apache Iceberg +labels: ["kind:bug"] +body: + - type: dropdown + attributes: + label: Apache Iceberg version + description: What Apache Iceberg version are you using? + multiple: false + options: + - "0.5.0 (latest release)" + - "0.4.0" + - "0.3.0" + - "0.2.0" + - "0.1.0" + - "main (development)" + validations: + required: false + - type: textarea + attributes: + label: Please describe the bug 🐞 + description: > + Please describe the problem, what to expect, and how to reproduce. + Feel free to include stacktraces and the Iceberg catalog configuration. + You can include files by dragging and dropping them here. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/iceberg_improvement.yml b/.github/ISSUE_TEMPLATE/iceberg_improvement.yml new file mode 100644 index 0000000000..0429236e9e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/iceberg_improvement.yml @@ -0,0 +1,11 @@ +--- +name: Iceberg Improvement / Feature Request +description: New features with Apache Iceberg +labels: ["kind:feature request"] +body: + - type: textarea + attributes: + label: Feature Request / Improvement + description: Please describe the feature and elaborate on the use case and motivation behind it + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/iceberg_question.yml b/.github/ISSUE_TEMPLATE/iceberg_question.yml new file mode 100644 index 0000000000..cf9997f4bd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/iceberg_question.yml @@ -0,0 +1,11 @@ +--- +name: Iceberg Question +description: Questions around Apache Iceberg +labels: ["kind:question"] +body: + - type: textarea + attributes: + label: Question + description: What is your question? + validations: + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..f851b8a54c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,32 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF 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. +# + +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + day: "sunday" + open-pull-requests-limit: 5 + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "sunday" diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml new file mode 100644 index 0000000000..9408a3a046 --- /dev/null +++ b/.github/workflows/license_check.yml @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF 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. +# + +name: "Run License Check" +on: pull_request + +jobs: + rat: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - run: dev/check-license diff --git a/.github/workflows/python-ci-docs.yml b/.github/workflows/python-ci-docs.yml new file mode 100644 index 0000000000..fc65fc9545 --- /dev/null +++ b/.github/workflows/python-ci-docs.yml @@ -0,0 +1,56 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF 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. +# + +name: "Python Docs" +on: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + docs: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Install + working-directory: ./mkdocs + run: pip install -r requirements.txt + - name: Build + working-directory: ./mkdocs + run: mkdocs build --strict + - name: Copy + working-directory: ./mkdocs + run: mv ./site /tmp/site + - name: Push changes to gh-pages branch + run: | + git checkout --orphan gh-pages-tmp + git rm --quiet -rf . + cp -r /tmp/site/* . + git config --global user.name 'GitHub Actions' + git config --global user.email 'actions@github.com' + echo "py.iceberg.apache.org" > CNAME + git add --all + git commit -m 'Publish Python docs' + git push -f origin gh-pages-tmp:gh-pages || true diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml new file mode 100644 index 0000000000..ed06d4a7f3 --- /dev/null +++ b/.github/workflows/python-ci.yml @@ -0,0 +1,50 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF 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. +# + +name: "Python CI" + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + lint-and-test: + runs-on: ubuntu-22.04 + strategy: + matrix: + python: ['3.8', '3.9', '3.10', '3.11'] + + steps: + - uses: actions/checkout@v4 + - name: Install poetry + working-directory: ./python + run: make install-poetry + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + cache: poetry + cache-dependency-path: ./poetry.lock + - name: Install + run: make install-dependencies + - name: Linters + run: make lint + - name: Tests + run: make test-coverage diff --git a/.github/workflows/python-integration.yml b/.github/workflows/python-integration.yml new file mode 100644 index 0000000000..ebf95ed81d --- /dev/null +++ b/.github/workflows/python-integration.yml @@ -0,0 +1,42 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF 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. +# + +name: "Python Integration" + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + integration-test: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Install + run: make install + - name: Run integration tests + run: make test-integration + - name: Show debug logs + if: ${{ failure() }} + run: docker-compose -f dev/docker-compose.yml logs diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml new file mode 100644 index 0000000000..6902775b13 --- /dev/null +++ b/.github/workflows/python-release.yml @@ -0,0 +1,88 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF 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. +# + +name: "Python Release" + +on: + workflow_dispatch: + inputs: + version: + description: 'Version' + type: string + default: 'master' + + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-22.04, windows-2022, macos-11 ] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Install poetry + run: pip install poetry + + - name: Set version + run: python -m poetry version "${{ inputs.version }}" + working-directory: ./python + if: "${{ github.event.inputs.version != 'master' }}" + + # Publish the source distribution with the version that's in + # the repository, otherwise the tests will fail + - name: Compile source distribution + run: python3 -m poetry build --format=sdist + if: startsWith(matrix.os, 'ubuntu') + working-directory: ./python + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.0 + with: + output-dir: wheelhouse + config-file: "pyproject.toml" + env: + # Ignore 32 bit architectures + CIBW_ARCHS: "auto64" + CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8,<3.12" + CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==4.2.2" + CIBW_TEST_EXTRAS: "s3fs,glue" + CIBW_TEST_COMMAND: "pytest -Werror {project}/tests/avro/test_decoder.py" + # There is an upstream issue with installing on MacOSX + # https://github.com/pypa/cibuildwheel/issues/1603 + # Ignore tests for pypy since not all dependencies are compiled for it + # and would require a local rust build chain + CIBW_TEST_SKIP: "pp* *macosx*" + + - name: Add source distribution + if: startsWith(matrix.os, 'ubuntu') + run: ls -lah dist/* && cp dist/* wheelhouse/ + + - uses: actions/upload-artifact@v3 + with: + name: "release-${{ github.event.inputs.version }}" + path: ./wheelhouse/* diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000..566ae2441e --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,49 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF 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. +# + +name: "Close Stale Issues" +on: + schedule: + - cron: '0 0 * * *' + +permissions: + # All other permissions are set to none + issues: write + +jobs: + stale: + if: github.repository_owner == 'apache' + runs-on: ubuntu-22.04 + steps: + - uses: actions/stale@v8.0.0 + with: + stale-issue-label: 'stale' + exempt-issue-labels: 'not-stale' + days-before-issue-stale: 180 + days-before-issue-close: 14 + # Only close stale issues, leave PRs alone + days-before-pr-stale: -1 + stale-issue-message: > + This issue has been automatically marked as stale because it has been open for 180 days + with no activity. It will be closed in next 14 days if no further activity occurs. To + permanently prevent this issue from being considered stale, add the label 'not-stale', + but commenting on the issue is preferred when possible. + close-issue-message: > + This issue has been closed because it has not received any activity in the last 14 days + since being marked as 'stale' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..9f432ea654 --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +*.swp +.DS_Store +.cache +tmp/ +site + +# intellij files +.idea +.idea_modules/ +*.ipr +*.iws +*.iml +out + +# rat library install location +lib/ + +__pycache__/ +*.py[cod] +.eggs/ +.tox/ +env/ +venv/ +*.egg-info/ +test-reports +build/ +dist/ +sdist/ +.coverage +coverage.xml +.pytest_cache/ + +# vscode/eclipse files +.classpath +.project +.settings +bin/ + +# Hive/metastore files +metastore_db/ + +# Spark/metastore files +spark-warehouse/ +derby.log + +# Python stuff +.mypy_cache/ +htmlcov + +pyiceberg/avro/decoder_fast.c +pyiceberg/avro/*.html +pyiceberg/avro/*.so + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fe522351c4..a4a2682cdf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,8 +15,7 @@ # specific language governing permissions and limitations # under the License. --- -files: ^python/ -exclude: ^python/vendor/ +exclude: ^vendor/ repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -44,12 +43,12 @@ repos: hooks: - id: mypy args: - [--install-types, --non-interactive, --config=python/pyproject.toml] + [--install-types, --non-interactive, --config=pyproject.toml] - repo: https://github.com/hadialqattan/pycln rev: v2.2.2 hooks: - id: pycln - args: [--config=python/pyproject.toml] + args: [--config=pyproject.toml] - repo: https://github.com/executablebooks/mdformat rev: 0.7.17 hooks: