Skip to content

Commit 6fd390e

Browse files
committed
fix: add noqa comments for Python 2/3 compat code and fix CMAC import in test_KDF.py
1 parent c631cb7 commit 6fd390e

File tree

8 files changed

+308
-186
lines changed

8 files changed

+308
-186
lines changed

.github/TestAndDeployForPypi.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: LibCrypto Test & Deploy - Publish to PYPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
branches: ["main"]
8+
pull_request:
9+
branches: ["main"]
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install setuptools wheel twine
33+
pip install -r requirements.txt
34+
pip install pytest pytest-cov
35+
36+
- name: Install package in editable mode
37+
run: |
38+
pip install -e .
39+
40+
- name: Verify no external crypto dependencies
41+
run: |
42+
python -c "import sys; import libcrypto; assert 'ecdsa' not in sys.modules, 'ecdsa should not be loaded'; assert 'Crypto' not in sys.modules, 'pycryptodome should not be loaded'; print('✅ No external crypto dependencies')"
43+
44+
- name: Run pytest with coverage
45+
run: |
46+
pytest tests/ -v --cov=libcrypto --cov-report=term-missing
47+
48+
- name: Lint with flake8
49+
run: |
50+
pip install flake8
51+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
52+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
53+
54+
publish:
55+
needs: build
56+
runs-on: ubuntu-latest
57+
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
58+
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v2
62+
63+
- name: Set up Python 3.12
64+
uses: actions/setup-python@v2
65+
with:
66+
python-version: "3.12"
67+
68+
- name: Install dependencies
69+
run: |
70+
python -m pip install --upgrade pip
71+
pip install -r requirements.txt
72+
pip install setuptools wheel twine build
73+
74+
- name: Get Bumper File
75+
if: ${{ secrets.BUMP_URL != '' }}
76+
run: curl -o bump_version.py ${{ secrets.BUMP_URL }}
77+
78+
- name: Run Bump script
79+
if: ${{ secrets.BUMP_URL != '' }}
80+
run: python bump_version.py libcrypto
81+
82+
- name: Remove Bump Script
83+
if: ${{ secrets.BUMP_URL != '' }}
84+
run: rm -r bump_version.py
85+
86+
- name: Bump version
87+
if: ${{ secrets.BUMP_URL != '' }}
88+
run: |
89+
git config --global user.name 'github-actions'
90+
git config --global user.email 'github-actions@github.com'
91+
git add setup.py pyproject.toml src/libcrypto/__init__.py
92+
git add .
93+
git commit -m 'version Update Mode'
94+
git push origin main
95+
96+
- name: Build libcrypto Package
97+
run: |
98+
python -m build
99+
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
103+
- name: Publish package to PyPI
104+
env:
105+
TWINE_USERNAME: __token__
106+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
107+
run: |
108+
twine upload dist/*
109+
110+
- name: Create GitHub Release
111+
id: create_release
112+
uses: softprops/action-gh-release@v2
113+
with:
114+
tag_name: "v${{ env.NEW_VERSION }}"
115+
name: "libcrypto v${{ env.NEW_VERSION }}"
116+
body: |
117+
## libcrypto New Release `${{ env.NEW_VERSION }}`
118+
119+
> [!NOTE]
120+
> New version of libcrypto has been released `v${{ env.NEW_VERSION }}`, Check the latest features and updates in this release.
121+
122+
install and use libcrypto with `pip` and `pip3` follow command :
123+
124+
### Windows
125+
126+
```bash
127+
pip install libcrypto
128+
# or
129+
pip install libcrypto==${{ env.NEW_VERSION }}
130+
```
131+
##### upgrade : `pip install libcrypto --upgrade`
132+
133+
---
134+
135+
### Linux & MacOS
136+
137+
```bash
138+
pip3 install libcrypto
139+
# or
140+
pip3 install libcrypto==${{ env.NEW_VERSION }}
141+
```
142+
143+
##### upgrade : `pip3 install libcrypto --upgrade`
144+
145+
---
146+
147+
- [Documentation](https://libcrypto.readthedocs.io/)
148+
- [PyPi Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/)
149+
- [PyPi History](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#history)
150+
- [Description Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#description)
151+
- [Download Files](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#files)
152+
153+
Programmer and Owner : @Pymmdrza
154+
155+
files: |
156+
dist/libcrypto-${{ env.NEW_VERSION }}.tar.gz
157+
dist/libcrypto-${{ env.NEW_VERSION }}-py3-none-any.whl

.github/pypi_builder.yaml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: libcrypto Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
branches: ["main"]
8+
pull_request:
9+
branches: ["main"]
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install setuptools wheel twine
33+
34+
- name: Lint with flake8
35+
run: |
36+
pip install flake8
37+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
38+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39+
40+
publish:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
44+
45+
steps:
46+
- name: Checkout repository
47+
uses: actions/checkout@v2
48+
49+
- name: Set up Python 3.12
50+
uses: actions/setup-python@v2
51+
with:
52+
python-version: "3.12"
53+
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install setuptools wheel twine
58+
59+
- name: Get Bumper File
60+
if: ${{ secrets.BUMP_URL != '' }}
61+
run: curl -o bump_version.py ${{ secrets.BUMP_URL }}
62+
63+
- name: Run Bump script
64+
if: ${{ secrets.BUMP_URL != '' }}
65+
run: python bump_version.py libcrypto
66+
67+
- name: Remove Bump Script
68+
if: ${{ secrets.BUMP_URL != '' }}
69+
run: rm -r bump_version.py
70+
71+
- name: Bump version
72+
if: ${{ secrets.BUMP_URL != '' }}
73+
run: |
74+
git config --global user.name 'github-actions'
75+
git config --global user.email 'github-actions@github.com'
76+
git add setup.py pyproject.toml src/libcrypto/__init__.py
77+
git add .
78+
git commit -m 'version Update Mode'
79+
git push origin main
80+
81+
- name: Build libcrypto Package
82+
run: |
83+
python setup.py sdist bdist_wheel
84+
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
88+
- name: Publish package to PyPI
89+
env:
90+
TWINE_USERNAME: __token__
91+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
92+
run: |
93+
twine upload dist/*
94+
95+
- name: Create GitHub Release
96+
id: create_release
97+
uses: softprops/action-gh-release@v2
98+
with:
99+
tag_name: "v${{ env.NEW_VERSION }}"
100+
name: "libcrypto v${{ env.NEW_VERSION }}"
101+
body: |
102+
## libcrypto New Release `${{ env.NEW_VERSION }}`
103+
104+
> [!NOTE]
105+
> New version of libcrypto has been released `v${{ env.NEW_VERSION }}`, Check the latest features and updates in this release.
106+
107+
install and use libcrypto with `pip` and `pip3` follow command :
108+
109+
### Windows
110+
111+
```bash
112+
pip install libcrypto
113+
# or
114+
pip install libcrypto==${{ env.NEW_VERSION }}
115+
```
116+
##### upgrade : `pip install libcrypto --upgrade`
117+
118+
---
119+
120+
### Linux & MacOS
121+
122+
```bash
123+
pip3 install libcrypto
124+
# or
125+
pip3 install libcrypto==${{ env.NEW_VERSION }}
126+
```
127+
128+
##### upgrade : `pip3 install libcrypto --upgrade`
129+
130+
---
131+
132+
- [Documentation](https://libcrypto.readthedocs.io/)
133+
- [PyPi Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/)
134+
- [PyPi History](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#history)
135+
- [Description Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#description)
136+
- [Download Files](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#files)
137+
138+
Programmer and Owner : @Pymmdrza
139+
140+
files: |
141+
dist/libcrypto-${{ env.NEW_VERSION }}.tar.gz
142+
dist/libcrypto-${{ env.NEW_VERSION }}-py3-none-any.whl

0 commit comments

Comments
 (0)