diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 9701721f3..391002196 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,14 +1,10 @@ -name: Build and Publish self_encryption Python Package +name: Build and Publish Python Package on: push: tags: - 'v*' -env: - PYTHON_VERSION: "3.10" - PACKAGE_NAME: "self_encryption" - # Add top-level permissions block permissions: id-token: write @@ -34,12 +30,12 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist -i python${{ matrix.python-version }} + args: --release --out dist sccache: 'true' - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: - name: wheels-macos-${{ matrix.target }}-py${{ matrix.python-version }} + name: wheels path: dist/*.whl if-no-files-found: error @@ -62,110 +58,48 @@ jobs: - name: Build wheels uses: PyO3/maturin-action@v1 with: - args: --release --out dist -i python${{ matrix.python-version }} + args: --release --out dist sccache: 'true' - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: - name: wheels-windows-${{ matrix.target }}-py${{ matrix.python-version }} + name: wheels path: dist/*.whl if-no-files-found: error linux: runs-on: ubuntu-latest + # Add permissions to job + permissions: + id-token: write + contents: read strategy: matrix: - target: [x86_64, i686] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + target: [x86_64] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - architecture: x64 + - name: Install dependencies + run: | + python -m pip install --user cffi + python -m pip install --user patchelf - name: Build wheels uses: PyO3/maturin-action@v1 - env: - PYTHON_VERSION: ${{ matrix.python-version }} with: target: ${{ matrix.target }} manylinux: auto - args: --release --out dist -i python${{ matrix.python-version }} - - # Add debug step to verify wheel location - - name: Debug wheel location - run: | - echo "Contents of current directory:" - ls -la - echo "\nContents of dist directory:" - ls -la dist/ - echo "\nFinding all wheel files:" - find . -name "*.whl" - + args: --release --out dist + sccache: 'true' - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: - name: wheels-linux-${{ matrix.target }}-py${{ matrix.python-version }} + name: wheels path: dist/*.whl if-no-files-found: error - # linux-cross: - # runs-on: ubuntu-latest - # strategy: - # matrix: - # target: [aarch64, armv7, s390x, ppc64le, ppc64] - # python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - # steps: - # - uses: actions/checkout@v3 - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v3 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v3 - # - uses: actions/setup-python@v4 - # with: - # python-version: ${{ matrix.python-version }} - # - name: Build wheels - # uses: PyO3/maturin-action@v1 - # env: - # PYO3_CROSS_PYTHON_VERSION: ${{ matrix.python-version }} - # PYO3_CROSS: "1" - # PYTHON_VERSION: ${{ matrix.python-version }} - # with: - # target: ${{ matrix.target }} - # manylinux: auto - # args: --release --out dist -i python${{ matrix.python-version }} - # sccache: 'true' - # docker-options: >- - # --platform ${{ matrix.target == 'armv7' && 'linux/arm/v7' || - # matrix.target == 'aarch64' && 'linux/arm64' || - # matrix.target == 's390x' && 'linux/s390x' || - # matrix.target == 'ppc64le' && 'linux/ppc64le' || - # 'linux/amd64' }} - # - uses: uraimo/run-on-arch-action@v2.7.0 - # if: matrix.target != 'ppc64' - # name: Install built wheel - # with: - # arch: ${{ matrix.target }} - # distro: ubuntu_latest - # githubToken: ${{ github.token }} - # install: | - # apt-get update - # apt-get install -y --no-install-recommends python3 python3-pip python3-venv - # pip3 install -U pip pytest click>=8.0.0 - # run: | - # # List all wheels to debug - # echo "Available wheels:" - # ls -la dist/ - - # # Install using find-links to handle platform tags correctly - # pip3 install --find-links dist/ ${{ env.PACKAGE_NAME }} - # pytest -v - # - name: Upload wheels - # uses: actions/upload-artifact@v4 - # with: - # name: wheels-linux-cross-${{ matrix.target }}-py${{ matrix.python-version }} - # path: dist - musllinux: runs-on: ubuntu-latest strategy: @@ -227,78 +161,7 @@ jobs: with: name: wheels-musllinux-${{ matrix.target }}-py${{ matrix.python-version }} path: dist - - # musllinux-cross: - # runs-on: ubuntu-latest - # strategy: - # matrix: - # platform: - # - target: aarch64-unknown-linux-musl - # arch: aarch64 - # platform: linux/arm64 - # - target: armv7-unknown-linux-musleabihf - # arch: armv7 - # platform: linux/arm/v7 - # python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - # steps: - # - uses: actions/checkout@v3 - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v3 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v3 - # - uses: actions/setup-python@v4 - # with: - # python-version: ${{ matrix.python-version }} - # - name: Build wheels - # uses: PyO3/maturin-action@v1 - # env: - # PYO3_CROSS_PYTHON_VERSION: ${{ matrix.python-version }} - # PYO3_CROSS: "1" - # with: - # target: ${{ matrix.platform.target }} - # manylinux: musllinux_1_2 - # args: --release --out dist -i python${{ matrix.python-version }} - # sccache: 'true' - # docker-options: "--platform ${{ matrix.platform.platform }}" - # - uses: uraimo/run-on-arch-action@master - # name: Install built wheel - # with: - # arch: ${{ matrix.platform.arch }} - # distro: alpine_latest - # githubToken: ${{ github.token }} - # install: | - # apk add --no-cache \ - # python3 \ - # py3-pip \ - # gcc \ - # musl-dev \ - # python3-dev \ - # rust \ - # cargo \ - # openssl-dev \ - # pkgconfig - # run: | - # # Create and activate virtual environment - # python3 -m venv /venv - # . /venv/bin/activate - - # # Install Python dependencies - # pip install --upgrade pip wheel setuptools - # pip install pytest click>=8.0.0 - - # # Install in development mode - # cd /io - # pip install -e . - - # # Run tests - # python -m pytest -v - # - name: Upload wheels - # uses: actions/upload-artifact@v4 - # with: - # name: wheels-musllinux-cross-${{ matrix.platform.target }}-py${{ matrix.python-version }} - # path: dist - - + sdist: runs-on: ubuntu-latest # Add permissions to job @@ -313,89 +176,31 @@ jobs: command: sdist args: --out dist - name: Upload sdist - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: - name: wheels-sdist-py${{ env.PYTHON_VERSION }} + name: wheels path: dist/*.tar.gz if-no-files-found: error release: name: Release runs-on: ubuntu-latest - needs: [macos, windows, linux, musllinux, sdist] + needs: [macos, windows, linux, sdist] + # Keep existing permissions permissions: id-token: write contents: read steps: - - name: Create dist directory - run: mkdir -p dist - - # List artifacts using GitHub API - - name: List artifacts - env: - GH_TOKEN: ${{ github.token }} - run: | - echo "Available artifacts:" - gh api \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts \ - --jq '.artifacts[].name' - - # Download artifacts using multiple attempts - - name: Download Linux x86_64 artifacts - uses: actions/download-artifact@v3 - with: - name: wheels-linux-x86_64-py3.8 - path: dist - continue-on-error: true - - - name: Download Linux i686 artifacts - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v3 with: - name: wheels-linux-i686-py3.8 + name: wheels path: dist - continue-on-error: true - - - name: Download sdist - uses: actions/download-artifact@v3 - with: - name: wheels-sdist-py3.10 - path: dist - continue-on-error: true - - # Add debugging information - - name: Debug artifact contents - run: | - echo "Current working directory:" - pwd - - echo "\nAll files in current directory:" - find . -type f - - echo "\nDist directory contents:" - ls -la dist/ - - echo "\nAll wheel files:" - find dist -name "*.whl" || echo "No wheel files found" - - echo "\nAll source distributions:" - find dist -name "*.tar.gz" || echo "No source distributions found" - - # Count files - wheel_count=$(find dist -name "*.whl" | wc -l) - sdist_count=$(find dist -name "*.tar.gz" | wc -l) - echo "\nFound $wheel_count wheel files and $sdist_count source distributions" - - if [ $wheel_count -eq 0 ] && [ $sdist_count -eq 0 ]; then - echo "Error: No distribution files found!" - exit 1 - fi - + - name: Display structure of downloaded files + run: ls -R dist - name: Publish to PyPI - if: success() uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: dist/ verbose: true - print-hash: true \ No newline at end of file + print-hash: true + \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index bd2f0da95..02e1d1775 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,33 +5,20 @@ build-backend = "maturin" [project] name = "self_encryption" -version = "0.32.4" -description = "Self encrypting files (convergent encryption plus obfuscation)" -authors = [ - {name = "MaidSafe Developers", email = "dev@maidsafe.net"} -] -requires-python = ">=3.8" -license = {text = "GPL-3.0"} +dynamic = ["version"] +description = "Python bindings for self-encryption library" +authors = [{ name = "David Irvine", email = "david.irvine@maidsafe.net" }] +requires-python = ">=3.7" classifiers = [ + "Programming Language :: Python :: 3", "Programming Language :: Rust", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", -] -dependencies = [ - "click>=8.0.0", - "pip>=24.3.1", + "Operating System :: OS Independent", ] [tool.maturin] features = ["python"] -module-name = "self_encryption._self_encryption" -python-packages = ["self_encryption"] -include = ["self_encryption/**/*"] -manifest-path = "Cargo.toml" +module-name = "self_encryption" -[project.scripts] -self-encryption = "self_encryption.cli:cli" +[tool.pytest.ini_options] +testpaths = ["tests"] +python_files = ["test_*.py"] \ No newline at end of file diff --git a/python-publish.yml b/python-publish.yml deleted file mode 100644 index 9c43247c5..000000000 --- a/python-publish.yml +++ /dev/null @@ -1,25 +0,0 @@ -release: - name: Release - runs-on: ubuntu-latest - needs: [macos, windows, linux, sdist] - permissions: - id-token: write - contents: read - steps: - - uses: actions/download-artifact@v3 - with: - path: dist - - name: Move files to dist directory - run: | - mkdir -p dist_flat - find dist -type f -exec mv {} dist_flat/ \; - rm -rf dist - mv dist_flat dist - - name: Display structure of downloaded files - run: ls -R dist - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: dist/ - verbose: true - print-hash: true \ No newline at end of file