Skip to content

Commit da0888a

Browse files
authored
Merge pull request #23 from sharktide/2.0.0
2.0.0
2 parents 582fcc3 + 65e2c67 commit da0888a

20 files changed

Lines changed: 428 additions & 176 deletions

.gitattributes

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,4 @@
44
docs/** -linguist-documentation
55

66
*.rst linguist-detectable
7-
*.yaml linguist-detectable
8-
*.toml linguist-detectable
97
*.ps1 linguist-detectable
10-
*.ps1 linguist-language=PowerShell

.github/workflows/fix-linter.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 109 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,118 @@ on:
88
- pyproject.toml
99
workflow_dispatch:
1010

11+
permissions:
12+
contents: write # Allow the action to push to the repository
13+
1114
jobs:
15+
lint-and-fix:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
# Step 1: Checkout the code
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
# Step 2: Set up Python
24+
- name: Set up Python
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: '3.x'
28+
29+
# Step 3: Install dependencies
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install pylint autopep8
34+
35+
# Step 4: Run pylint on specified files
36+
- name: Run pylint on specified files
37+
id: pylint
38+
run: |
39+
pylint_output=$(pylint $(git ls-files '*.py' | grep -vE '(^tests/|^docs/)') --output-format=text) || true
40+
echo "$pylint_output"
41+
echo "::set-output name=pylint_output::$pylint_output"
42+
43+
# Step 5: Apply autopep8 fixes
44+
- name: Apply autopep8 fixes
45+
run: |
46+
autopep8 --in-place --aggressive --aggressive $(git ls-files '*.py' | grep -vE '(^tests/|^docs/)')
47+
48+
# Step 6: Commit and push changes directly to the main branch
49+
- name: Commit and push changes to main branch
50+
run: |
51+
git config --global user.name 'github-actions[bot]'
52+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
53+
git checkout main
54+
git add .
55+
git diff --cached --quiet || git commit -m "Auto-fix Linter and apply autopep8 changes"
56+
git push origin main
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
build-windows:
60+
runs-on: windows-latest
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v2
64+
65+
- name: Compile for Windows (32-bit & 64-bit)
66+
run: |
67+
clang -shared -m32 -o restructuredpython/lib/io32.dll restructuredpython/include/io.c
68+
clang -shared -m64 -o restructuredpython/lib/io64.dll restructuredpython/include/io.c
69+
70+
- name: Upload Windows artifacts
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: windows-libs
74+
path: restructuredpython/lib/io*.dll
75+
76+
build-linux:
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v2
81+
82+
- name: Compile for Linux (.so)
83+
run: |
84+
gcc -shared -fPIC -o restructuredpython/lib/io.so restructuredpython/include/io.c
85+
86+
- name: Upload Linux artifacts
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: linux-libs
90+
path: restructuredpython/lib/io.so
91+
92+
build-macos:
93+
runs-on: macos-latest
94+
steps:
95+
- name: Checkout code
96+
uses: actions/checkout@v2
97+
98+
- name: Compile for macOS (.dylib)
99+
run: |
100+
clang -shared -fPIC -fdeclspec -o restructuredpython/lib/io.dylib restructuredpython/include/io.c
101+
102+
- name: Upload macOS artifacts
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: macos-libs
106+
path: restructuredpython/lib/io.dylib
12107
publish:
13-
runs-on: ubuntu-latest # Use an Ubuntu runner for compatibility
108+
runs-on: windows-latest
109+
needs: [build-windows, build-linux, build-macos]
14110
environment:
15-
name: pypi # Optional: Define a deployment environment
111+
name: pypi
16112
permissions:
17-
id-token: write # Grant permission to request an OIDC token
113+
id-token: write
18114
steps:
19115
- name: Checkout code
20116
uses: actions/checkout@v2
21117

118+
- name: Download all compiled libraries
119+
uses: actions/download-artifact@v4
120+
with:
121+
path: restructuredpython/lib/
122+
22123
- name: Set up Python
23124
uses: actions/setup-python@v2
24125
with:
@@ -29,17 +130,10 @@ jobs:
29130
python -m pip install --upgrade pip
30131
pip install twine setuptools wheel build toml
31132
32-
- name: Get version from pyproject.toml
33-
id: get_version
34-
run: |
35-
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
36-
echo "VERSION=$VERSION"
37-
echo "release_version=$VERSION" >> $GITHUB_ENV
38-
39-
- name: Build the package
133+
- name: Build the package with compiled shared libraries
40134
run: |
41135
python -m build
42-
136+
43137
- name: Publish package distributions to PyPI
44138
uses: pypa/gh-action-pypi-publish@release/v1
45139

@@ -48,15 +142,13 @@ jobs:
48142
uses: softprops/action-gh-release@v1
49143
with:
50144
tag_name: "v${{ env.release_version }}"
51-
name: "${{ env.release_version }}" # Use version from pyproject.toml as release title
52-
prerelease: false # Mark as a pre-release (beta)
145+
name: "${{ env.release_version }}"
53146
files: |
54147
dist/*.whl
55148
dist/*.tar.gz
56149
body: |
57150
View the [changelog](https://restructuredpython.readthedocs.io/en/latest/changelog.html) for information about this release.
58151
env:
59-
GITHUB_TOKEN: ${{ secrets.GH_PAT }} # GitHub token for authentication
60-
61-
152+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
62153

154+

.github/workflows/python-package.yml

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,78 @@ on:
77
- synchronize
88
- reopened
99
paths-ignore:
10-
- 'docs/**' # Ignore changes in the 'docs' directory
11-
- 'restructuredpython.egg-info/**' # Ignore changes in the 'restructuredpython.egg-info' directory
12-
- '.github/**' # Ignore changes in the '.github' directory
13-
- '.gitattributes' # Ignore changes to '.gitattributes'
14-
- '.gitignore' # Ignore changes to '.gitignore'
15-
- 'README.md' # Ignore changes to 'README.md'
10+
- 'docs/**'
11+
- 'restructuredpython.egg-info/**'
12+
- '.github/**'
13+
- '.gitattributes'
14+
- '.gitignore'
15+
- 'README.md'
1616

1717
jobs:
18-
build:
18+
Windows:
1919
runs-on: windows-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
24+
- name: Compile Windows DLLs
25+
run: |
26+
clang -shared -m32 -o restructuredpython/lib/io32.dll restructuredpython/include/io.c
27+
clang -shared -m64 -o restructuredpython/lib/io64.dll restructuredpython/include/io.c
28+
29+
30+
- name: Upload Windows artifacts
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: windows-libs
34+
path: restructuredpython/lib/io*.dll
35+
36+
Ubuntu:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v2
41+
42+
- name: Compile Linux .so
43+
run: |
44+
gcc -shared -fPIC -o restructuredpython/lib/io.so restructuredpython/include/io.c
45+
- name: Upload Linux artifacts
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: linux-libs
49+
path: restructuredpython/lib/io.so
50+
51+
macOS:
52+
runs-on: macos-latest
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v2
56+
57+
- name: Compile macOS .dylib
58+
run: |
59+
clang -shared -fPIC -fdeclspec -o restructuredpython/lib/io.dylib restructuredpython/include/io.c
2060
61+
- name: Upload macOS artifacts
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: macos-libs
65+
path: restructuredpython/lib/io.dylib
66+
67+
build-package:
68+
runs-on: windows-latest
69+
needs: [Windows, Ubuntu, macOS]
2170
strategy:
2271
matrix:
2372
python-version: ["3.13"]
24-
2573
steps:
2674
- name: Checkout code
2775
uses: actions/checkout@v2
2876

77+
- name: Download all compiled libraries
78+
uses: actions/download-artifact@v4
79+
with:
80+
path: restructuredpython/lib/
81+
2982
- name: Set up Python ${{ matrix.python-version }}
3083
uses: actions/setup-python@v2
3184
with:
@@ -34,26 +87,21 @@ jobs:
3487
- name: Install dependencies
3588
run: |
3689
python -m pip install --upgrade pip
37-
pip install -r requirements.txt
3890
pip install setuptools wheel build
3991
40-
#- name: Run tests with pytest
41-
# run: |
42-
# pytest # Run your tests, replace with your test command
43-
4492
- name: Build the package
4593
run: |
46-
py -m build
94+
python -m build
4795
4896
- name: Create a GitHub release
4997
id: create_release
5098
uses: softprops/action-gh-release@v1
5199
with:
52-
tag_name: "PR" # Use commit SHA as tag name or use a custom tag
53-
name: "PR #${{ github.event.pull_request.number }}" # PR number as release name
54-
prerelease: true # Mark as a pre-release (beta)
100+
tag_name: "#${{ github.event.pull_request.number }}"
101+
name: "PR #${{ github.event.pull_request.number }}"
102+
prerelease: true
55103
files: |
56104
dist/*.whl
57105
dist/*.tar.gz
58106
env:
59-
GITHUB_TOKEN: ${{ secrets.GH_PAT }} # GitHub token for authentication
107+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dist/*
2-
*.pyc
2+
*.pyc
3+
build/*

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "repython-vs"]
22
path = repython-vs
33
url = https://github.com/sharktide/repython-vs.git
4+
[submodule "restructuredpython-web"]
5+
path = restructuredpython-web
6+
url = https://github.com/sharktide/restructuredpython-web.git

MANIFEST.in

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
exclude docs/*
22
exclude tests/*
3-
exclude install/*
3+
exclude install/*
4+
include restructuredpython/restructuredpython.py
5+
include restructuredpython/lib/io32.dll
6+
include restructuredpython/lib/io64.dll
7+
include restructuredpython/lib/io.so
8+
include restructuredpython/lib/io.dylib
9+
recursive-include restructuredpython/predefined *
10+
recursive-include restructuredpython/lib *
11+
recursive-include restructuredpython/include *
12+
13+

0 commit comments

Comments
 (0)