diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..dd07304 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,35 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Test + +on: + push: + branches: [ "main", "dev" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry && poetry update + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics diff --git a/.github/workflows/release_to_pypi.yml b/.github/workflows/release_to_pypi.yml new file mode 100644 index 0000000..78b9e3c --- /dev/null +++ b/.github/workflows/release_to_pypi.yml @@ -0,0 +1,31 @@ +name: build + +on: + push: + tags: + - "v*" + +jobs: + build-n-publish: + name: Build and publish to PyPI + runs-on: ubuntu-latest + + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.x" + + - name: Build source and wheel distributions + run: | + pip install --upgrade build twine + python -m build + twine check --strict dist/* + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/README.md b/README.md index 79b95c7..0038f1e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![status workflow test](https://github.com/cirebon-dev/TelegramSDK/actions/workflows/python-app.yml/badge.svg)](https://github.com/cirebon-dev/TelegramSDK/actions) +[![status workflow build](https://github.com/cirebon-dev/TelegramSDK/actions/workflows/release_to_pypi.yml/badge.svg)](https://github.com/cirebon-dev/TelegramSDK/actions) +[![Downloads](https://static.pepy.tech/badge/TelSDK)](https://pepy.tech/project/TelSDK) # TelegramSDK diff --git a/TelegramSDK/telegram.py b/TelegramSDK/telegram.py index e29725c..f37a4e3 100644 --- a/TelegramSDK/telegram.py +++ b/TelegramSDK/telegram.py @@ -92,7 +92,7 @@ def reply_message(*args, **kwargs): def reply_file(path, **kwargs): """ - Use this method to quick reply with document. + Use this method to quick reply with file. """ kwargs["chat_id"] = telegram.data.message.chat.id kwargs["document"] = path diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8832aa8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[tool.poetry] +name = "telegramsdk" +version = "0.1.0" +description = "Synchronous Telegram bot SDK for python 2 & 3" +authors = ["guangrei"] +license = "mit" +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" +requests = "^2.31.0" +zcache = "^1.0.1" + + +[tool.poetry.group.dev.dependencies] +flake8 = "^7.0.0" +black = "^24.1.1" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api"