diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index faa19a5..de5f210 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,17 +30,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pylint autopep8 + pip install autopep8 - # Step 4: Run pylint on specified files - - name: Run pylint on specified files - id: pylint - run: | - pylint_output=$(pylint $(git ls-files '*.py' | grep -vE '(^tests/|^docs/)') --output-format=text) || true - echo "$pylint_output" - echo "::set-output name=pylint_output::$pylint_output" - - # Step 5: Apply autopep8 fixes - name: Apply autopep8 fixes run: | autopep8 --in-place --aggressive --aggressive $(git ls-files '*.py' | grep -vE '(^tests/|^docs/)') @@ -56,57 +47,46 @@ jobs: git push origin main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-windows: - runs-on: windows-latest + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-latest] + steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Compile for Windows (32-bit & 64-bit) - run: | - clang -shared -m32 -o restructuredpython/lib/io32.dll restructuredpython/include/io.c - clang -shared -m64 -o restructuredpython/lib/io64.dll restructuredpython/include/io.c - - - name: Upload Windows artifacts - uses: actions/upload-artifact@v4 - with: - name: windows-libs - path: restructuredpython/lib/io*.dll + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + + - name: Install cibuildwheel + run: python -m pip install --upgrade pip cibuildwheel setuptools wheel toml - build-linux: + - name: Build wheels + run: python -m cibuildwheel + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + build_sdist: + name: Make SDist runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Compile for Linux (.so) - run: | - gcc -shared -fPIC -o restructuredpython/lib/io.so restructuredpython/include/io.c - - - name: Upload Linux artifacts - uses: actions/upload-artifact@v4 - with: - name: linux-libs - path: restructuredpython/lib/io.so + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Optional, use if you use setuptools_scm + submodules: true # Optional, use if you have submodules + + - name: Build SDist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz - build-macos: - runs-on: macos-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Compile for macOS (.dylib) - run: | - clang -shared -fPIC -fdeclspec -o restructuredpython/lib/io.dylib restructuredpython/include/io.c - - - name: Upload macOS artifacts - uses: actions/upload-artifact@v4 - with: - name: macos-libs - path: restructuredpython/lib/io.dylib publish: runs-on: ubuntu-latest - needs: [build-windows, build-linux, build-macos] + needs: [build, build_sdist] environment: name: pypi permissions: @@ -115,10 +95,12 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Download all compiled libraries + - name: Download all wheels uses: actions/download-artifact@v4 with: - path: restructuredpython/lib/ + pattern: cibw-* + path: dist + merge-multiple: true - name: Set up Python uses: actions/setup-python@v2 @@ -128,11 +110,12 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install twine setuptools wheel build toml - - - name: Build the package with compiled shared libraries + pip install toml + - name: Extract version from pyproject.toml + id: extract_version run: | - python3 -m build + python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])" > version.txt + echo "release_version=$(cat version.txt)" >> $GITHUB_ENV - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -144,8 +127,7 @@ jobs: tag_name: "v${{ env.release_version }}" name: "${{ env.release_version }}" files: | - dist/*.whl - dist/*.tar.gz + dist/* body: | View the [changelog](https://restructuredpython.readthedocs.io/en/latest/changelog.html) for information about this release. env: diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2a9b481..a8b431c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,4 +1,4 @@ -name: Build and Create GitHub Release for PR +name: Build and Create Github Release for PR on: pull_request: @@ -8,90 +8,63 @@ on: - reopened paths-ignore: - 'docs/**' - - 'restructuredpython.egg-info/**' - '.github/**' - '.gitattributes' - '.gitignore' - 'README.md' jobs: - Windows: - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Compile Windows DLLs - run: | - clang -shared -m32 -o restructuredpython/lib/io32.dll restructuredpython/include/io.c - clang -shared -m64 -o restructuredpython/lib/io64.dll restructuredpython/include/io.c - - - - name: Upload Windows artifacts - uses: actions/upload-artifact@v4 - with: - name: windows-libs - path: restructuredpython/lib/io*.dll + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-latest] - Ubuntu: - runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Compile Linux .so - run: | - gcc -shared -fPIC -o restructuredpython/lib/io.so restructuredpython/include/io.c - - name: Upload Linux artifacts - uses: actions/upload-artifact@v4 - with: - name: linux-libs - path: restructuredpython/lib/io.so + - uses: actions/setup-python@v5 - macOS: - runs-on: macos-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 + - name: Install cibuildwheel + run: python -m pip install --upgrade pip cibuildwheel setuptools wheel toml - - name: Compile macOS .dylib - run: | - clang -shared -fPIC -fdeclspec -o restructuredpython/lib/io.dylib restructuredpython/include/io.c + - name: Build wheels + uses: pypa/cibuildwheel@v3.0.0 - - name: Upload macOS artifacts - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v4 with: - name: macos-libs - path: restructuredpython/lib/io.dylib - - build-package: - runs-on: windows-latest - needs: [Windows, Ubuntu, macOS] - strategy: - matrix: - python-version: ["3.13"] + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + build_sdist: + name: Make SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: false + + - name: Build SDist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + create_release: + runs-on: ubuntu-latest + needs: [build, build_sdist] + permissions: + id-token: write steps: - name: Checkout code uses: actions/checkout@v2 - - name: Download all compiled libraries - uses: actions/download-artifact@v4 - with: - path: restructuredpython/lib/ - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + - uses: actions/download-artifact@v4 with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel build - - - name: Build the package - run: | - python -m build + pattern: cibw-* + path: dist + merge-multiple: true - name: Create a GitHub release id: create_release @@ -99,9 +72,9 @@ jobs: with: tag_name: "#${{ github.event.pull_request.number }}" name: "PR #${{ github.event.pull_request.number }}" - prerelease: true files: | - dist/*.whl - dist/*.tar.gz + dist/* + body: | + Auto-generated wheels from PR #[${{github.event.pull_request.number}}](https://github.com/sharktide/restructuredpython/pull/${{github.event.pull_request.number}}). env: GITHUB_TOKEN: ${{ secrets.GH_PAT }} diff --git a/.gitignore b/.gitignore index 771e3dc..da91914 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ dist/* *.pyc -build/* \ No newline at end of file +build/* +wheelhouse/* +restructuredpython.egg-info/** \ No newline at end of file diff --git a/compile.bat b/compile.bat deleted file mode 100644 index 32ab3f5..0000000 --- a/compile.bat +++ /dev/null @@ -1,48 +0,0 @@ -@echo off -setlocal enabledelayedexpansion -echo This compiles the C libraries in a external enviornment using MSVC, then copies them to the appropriate locations in this repo. -echo Requirements: xcopy.exe on PATH -echo Requirements: MSVC cl.exe -echo Requirements: This must be run from either the Developer PWSH/CMD for VS or the x64 Native Tools Prompt - -set SRC_DIR=%CD% -set DEST=C:\TempBuild - -if not exist "%DEST%" mkdir "%DEST%" - -xcopy "%SRC_DIR%\*" "%DEST%" /E /H /C /I /exclude:exclude.txt - -pushd "C:\TempBuild" -cl /LD restructuredpython/include/io.c - -set /p arch="Was this run from an x64 tools prompt (y/n) >" -if "%arch%"=="y" ( - for %%F in (io.dll) do xcopy "%%F" "%SRC_DIR%/restructuredpython/lib/windows-libs/io64.dll" /Y -) else ( - for %%F in (io.dll) do xcopy "%%F" "%SRC_DIR%/restructuredpython/lib/windows-libs/io32.dll" /Y -) - -echo Deleting copied files - -del /Q C:\TempBuild - -popd - -echo Operation Completed - -endlocal - - -@REM Copyright 2025 Rihaan Meher - -@REM Licensed under the Apache License, Version 2.0 (the "License"); -@REM you may not use this file except in compliance with the License. -@REM You may obtain a copy of the License at - -@REM http://www.apache.org/licenses/LICENSE-2.0 - -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. \ No newline at end of file diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 289d43d..6a2fe38 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,4 +1,4 @@ -reStructuredPython Changelog +Changelog ============================= *Note: This changelog skips version 0.1.1* @@ -8,6 +8,13 @@ Major release 2 .. raw:: html +
+ 2.5.0 + +
+
2.4.0