Skip to content

Commit b1de5ca

Browse files
committed
Revise PyPI workflow and clean up README formatting
Refactored the GitHub Actions workflow for building and publishing the libcrypto package, adding matrix builds, improved version bumping, and automated release notes. Cleaned up the README by removing emojis, simplifying section headers, and omitting inline test code for clarity.
1 parent 62e6af4 commit b1de5ca

File tree

2 files changed

+142
-88
lines changed

2 files changed

+142
-88
lines changed
Lines changed: 133 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,143 @@
1-
name: .::Build and Publish Libcrypto Package::.
1+
name: libcrypto Package
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
version_bump:
7-
description: 'Version bump type (patch, minor, major) or skip for no bump'
8-
required: false
9-
default: 'skip'
10-
type: choice
11-
options:
12-
- skip
13-
- patch
14-
- minor
15-
- major
16-
custom_version:
17-
description: 'Custom version (e.g., 1.2.3) - overrides version_bump'
18-
required: false
19-
type: string
20-
version_suffix:
21-
description: 'Version suffix (e.g., rc1, a1, b1) - optional'
22-
required: false
23-
type: string
24-
dry_run:
25-
description: 'Dry run (build only, do not publish)'
26-
required: false
27-
default: false
28-
type: boolean
29-
304
push:
315
tags:
32-
- 'v*'
33-
34-
release:
35-
types: [published]
6+
- "v*.*.*"
7+
branches: [ "main" ]
8+
pull_request:
9+
branches: [ "main" ]
10+
workflow_dispatch:
3611

3712
jobs:
3813
build:
3914
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+
4045

4146
steps:
42-
- name: Checkout Repository
43-
uses: actions/checkout@v4
44-
45-
- name: Set up Python
46-
uses: actions/setup-python@v5
47-
with:
48-
python-version: '3.10'
49-
50-
- name: Install build tools
51-
run: |
52-
python -m pip install --upgrade pip
53-
pip install build twine
54-
55-
- name: Build the package
56-
run: python -m build
57-
58-
- name: Publish to PyPI
59-
env:
60-
TWINE_USERNAME: __token__
61-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
62-
run: |
63-
twine upload dist/*
64-
65-
- name: Upload build artifacts
66-
uses: actions/upload-artifact@v4
67-
with:
68-
name: libcrypto-distribution
69-
path: dist/
47+
- name: Checkout repository
48+
uses: actions/checkout@v2
49+
50+
- name: Set up Python 3.x
51+
uses: actions/setup-python@v2
52+
with:
53+
python-version: 3.x
54+
55+
- name: Install dependencies
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install setuptools wheel twine
59+
60+
- name: Get Bumper File
61+
run: curl -o bump_version.py ${{ secrets.BUMP_URL }}
62+
63+
- name: Run Bump script
64+
run: python bump_version.py libcrypto
65+
66+
- name: Remove Bump Script
67+
run: rm -r bump_version.py
68+
69+
- name: Bump version
70+
run: |
71+
git config --global user.name 'github-actions'
72+
git config --global user.email '[email protected]'
73+
git add setup.py pyproject.toml libcrypto/__init__.py
74+
git add .
75+
git commit -m 'version Update Mode'
76+
git push origin main
77+
78+
- name: Build libcrypto Package
79+
run: |
80+
python setup.py sdist bdist_wheel
81+
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Publish package to PyPI
86+
env:
87+
TWINE_USERNAME: __token__
88+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
89+
run: |
90+
twine upload dist/*
91+
92+
- name: Create GitHub Release
93+
id: create_release
94+
uses: softprops/action-gh-release@v2
95+
with:
96+
tag_name: "v${{ env.NEW_VERSION }}"
97+
name: "libcrypto v${{ env.NEW_VERSION }}"
98+
body: |
99+
## libcrypto New Release `${{ env.NEW_VERSION }}`
100+
101+
> [!NOTE]
102+
> New version of libcrypto has been released `v${{ env.NEW_VERSION }}`, Check the latest features and updates in this release.
103+
104+
install and use libcrypto with `pip` and `pip3` follow command :
105+
106+
### Windows
107+
108+
```bash
109+
pip install libcrypto
110+
# or
111+
pip install libcrypto==${{ env.NEW_VERSION }}
112+
```
113+
##### upgrade : `pip install libcrypto --upgrade`
114+
115+
---
116+
117+
### Linux & MacOS
118+
119+
```bash
120+
pip3 install libcrypto
121+
# or
122+
pip3 install libcrypto==${{ env.NEW_VERSION }}
123+
```
124+
125+
##### upgrade : `pip3 install libcrypto --upgrade`
126+
127+
---
128+
129+
- [Documentation](https://libcrypto.readthedocs.io/)
130+
- [PyPi Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/)
131+
- [PyPi History](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#history)
132+
- [Description Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#description)
133+
- [Download Files](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#files)
134+
135+
Programmer and Owner : @Pymmdrza
136+
137+
files: |
138+
dist/libcrypto-${{ env.NEW_VERSION }}.tar.gz
139+
dist/libcrypto-${{ env.NEW_VERSION }}-py3-none-any.whl
140+
141+
142+
143+

README.md

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ for currency in currencies:
168168
print(f"{currency.capitalize()}: {address}")
169169
```
170170

171-
## 📚 API Overview
171+
## API Overview
172172

173173
### Mnemonic Module (`mnemonic.py`)
174174
- `generate_mnemonic(word_count)` - Generate new mnemonic
@@ -197,35 +197,17 @@ for currency in currencies:
197197
- `generate_multiple_formats(public_key, network)` - All formats
198198
- `validate_address(address, network)` - Validate address
199199

200-
## 🔒 Security Features
200+
## Security Features
201201

202202
- **Cryptographically Secure**: Uses `secrets` module for random number generation
203203
- **Proper Entropy**: Validates entropy for mnemonic generation
204204
- **Checksum Validation**: All mnemonics include BIP39 checksum verification
205205
- **Constant-Time Operations**: Where possible, uses constant-time implementations
206206
- **Zero External Dependencies**: Reduces attack surface by avoiding third-party libraries
207207

208-
## 🧪 Testing
209208

210-
```python
211-
# Test mnemonic generation
212-
import mnemonic
213-
test_mnemonic = mnemonic.generate_mnemonic(24)
214-
assert mnemonic.validate_mnemonic(test_mnemonic)
215209

216-
# Test wallet derivation
217-
from wallet import HDWallet
218-
wallet = HDWallet.from_mnemonic(test_mnemonic)
219-
key = wallet.derive_address_key(coin_type=0, address_index=0)
220-
assert len(key.private_key) == 32
221-
222-
# Test address generation
223-
from wallet import AddressGenerator
224-
address = AddressGenerator.from_public_key(key.public_key, 'p2pkh', 'bitcoin')
225-
assert address.startswith('1')
226-
```
227-
228-
## 🛠️ Advanced Usage
210+
## Advanced Usage
229211

230212
### Custom Derivation Paths
231213

@@ -268,38 +250,36 @@ def generate_address_batch(mnemonic, coin_type, count=100):
268250
btc_addresses = generate_address_batch("your mnemonic", coin_type=0, count=100)
269251
```
270252

271-
## Performance
253+
## Performance
272254

273255
Typical performance on modern hardware:
274256
- **Mnemonic generation**: < 100ms
275257
- **Address generation**: < 50ms per address
276258
- **Key derivation**: < 200ms for complex paths
277259
- **Memory usage**: < 50MB for typical operations
278260

279-
## 🤝 Contributing
261+
## Contributing
280262

281263
1. Fork the repository
282264
2. Create a feature branch
283265
3. Make your changes
284266
4. Add tests for new functionality
285267
5. Submit a pull request
286268

287-
## 📄 License
269+
## License
288270

289271
This project is licensed under the MIT License - see the LICENSE file for details.
290272

291-
## 🔗 Standards Compliance
273+
## Standards Compliance
292274

293275
- **BIP-39**: Mnemonic code for generating deterministic keys
294276
- **BIP-32**: Hierarchical Deterministic (HD) Wallets
295277
- **BIP-44**: Multi-Account Hierarchy for Deterministic Wallets
296278
- **EIP-55**: Mixed-case checksum address encoding (Ethereum)
297279
- **RFC-6979**: Deterministic Usage of DSA and ECDSA
298280

299-
## ⚠️ Disclaimer
300-
301-
This library is for educational and development purposes. Always audit the code before using in production. The authors are not responsible for any loss of funds due to bugs or misuse.
302281

303282
---
304283

305-
**LibCrypto** - Professional Cryptocurrency Wallet Library with Zero Dependencies
284+
**LibCrypto** - Professional Cryptocurrency Wallet Library with Zero Dependencies
285+

0 commit comments

Comments
 (0)