Skip to content

Commit feffddd

Browse files
committed
enables publishing to pipy with ci/cd
1 parent e808619 commit feffddd

File tree

4 files changed

+121
-2
lines changed

4 files changed

+121
-2
lines changed

.github/workflows/publish-to-pypi.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish AraBERT 📦 to TestPyPI
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
build-n-publish:
7+
name: Build and publish
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@master
12+
- name: Set up Python 3.10
13+
uses: actions/setup-python@v3
14+
with:
15+
python-version: "3.10"
16+
17+
- name: Install pypa/build
18+
run: >-
19+
python -m
20+
pip install
21+
build
22+
--user
23+
24+
- name: Build a binary wheel and a source tarball
25+
run: >-
26+
python -m
27+
build
28+
--sdist
29+
--wheel
30+
--outdir dist/
31+
.
32+
33+
- name: Publish distribution 📦 to PyPI
34+
uses: pypa/gh-action-pypi-publish@master
35+
with:
36+
password: ${{ secrets.PYPI_API_TOKEN }}
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish AraBERT 📦 to TestPyPI
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
build-n-publish:
7+
name: Build and publish
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@master
12+
- name: Set up Python 3.10
13+
uses: actions/setup-python@v3
14+
with:
15+
python-version: "3.10"
16+
17+
- name: Install pypa/build
18+
run: >-
19+
python -m
20+
pip install
21+
build
22+
--user
23+
24+
- name: Build a binary wheel and a source tarball
25+
run: >-
26+
python -m
27+
build
28+
--sdist
29+
--wheel
30+
--outdir dist/
31+
.
32+
33+
- name: Publish distribution 📦 to Test PyPI
34+
uses: pypa/gh-action-pypi-publish@master
35+
with:
36+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
37+
repository_url: https://test.pypi.org/legacy/

README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# AraBERTv2 / AraGPT2 / AraELECTRA
22

33
![visitors](https://visitor-badge.glitch.me/badge?page_id=wissamantoun.arabert)
4+
[![PyPI version](https://badge.fury.io/py/arabert.svg)](https://badge.fury.io/py/arabert)
45

56
<p align="middle">
67
<img src="https://github.com/aub-mind/arabert/blob/master/arabert_logo.png" width="150" align="left"/>
@@ -21,9 +22,23 @@ cd arabert && git checkout 6a58ca118911ef311cbe8cdcdcc1d03601123291
2122
```
2223
# Update
2324

24-
- **8-Oct-2021**: New AraBERT models that better supports tweets and emojies.
25+
- **8-Oct-2021:** New AraBERT models that better supports tweets and emojies.
2526
- **13-Sep-2021:** Arabic NLP Demo Space on HuggingFace [![Open Space](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://huggingface.co/spaces/aubmindlab/Arabic-NLP)
2627
- **02-Apr-2021:** AraELECTRA powered Arabic Wikipedia QA system [![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://share.streamlit.io/wissamantoun/arabic-wikipedia-qa-streamlit/main)
28+
- **17-jul-2022:** You can now install arabert via `pip install arabert`
29+
30+
# Installation
31+
32+
Install AraBERT from PyPI:
33+
```bash
34+
pip install arabert
35+
```
36+
37+
and then you can use it:
38+
```python
39+
from arabert import ArabertPreprocessor
40+
from arabert.aragpt2.grover.modeling_gpt2 import GPT2LMHeadModel
41+
```
2742

2843
# AraBERTv2
2944

setup.py

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
from setuptools import find_packages, setup
22

3+
4+
def get_long_description():
5+
with open("README.md", "r", encoding="utf-8") as f:
6+
long_description = f.read()
7+
8+
long_description = long_description.replace(
9+
"[Read More...](#AraBERT)",
10+
"[Read More...](https://github.com/aub-mind/arabert/tree/master/arabert)",
11+
)
12+
long_description = long_description.replace(
13+
"[Read More...](#AraGPT2)",
14+
"[Read More...](https://github.com/aub-mind/arabert/tree/master/aragpt2)",
15+
)
16+
long_description = long_description.replace(
17+
"[Read More...](#AraELECTRA)",
18+
"[Read More...](https://github.com/aub-mind/arabert/tree/master/araelectra)",
19+
)
20+
long_description = long_description.replace(
21+
"[preprocessing function](#Preprocessing)",
22+
"https://github.com/aub-mind/arabert#preprocessing",
23+
)
24+
long_description = long_description.replace(
25+
"[Dataset Section](#Dataset)", "https://github.com/aub-mind/arabert#Dataset"
26+
)
27+
long_description = long_description.replace(
28+
"https://github.com/aub-mind/arabert/blob/master/",
29+
"https://raw.githubusercontent.com/aub-mind/arabert/master/",
30+
)
31+
return long_description
32+
33+
334
setup(
435
name="arabert",
536
version="1.0.0",
@@ -10,7 +41,7 @@
1041
description="AraBERT is a Python library that contains the"
1142
"code for the AraBERT, AraGPT2 and AraELECTRA models with"
1243
"the preprocessing scripts.",
13-
long_description=open("README.md", "r", encoding="utf-8").read(),
44+
long_description=get_long_description(),
1445
long_description_content_type="text/markdown",
1546
install_requires=["PyArabic", "farasapy"],
1647
py_modules=["arabert.preprocess"],

0 commit comments

Comments
 (0)