From ac517d0de46fe89128bb4d5c99d95256236dcb36 Mon Sep 17 00:00:00 2001 From: Alexander Akhmetov Date: Sun, 23 Jun 2024 17:59:42 +0200 Subject: [PATCH] Use pyproject.toml instead of setup.py --- .gitignore | 1 + pyproject.toml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++- setup.cfg | 2 -- setup.py | 41 ---------------------------------------- 4 files changed, 51 insertions(+), 44 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 3f59f7f3..13007138 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ MANIFEST *.pyc .DS_Store .vscode +telegram/_version.py diff --git a/pyproject.toml b/pyproject.toml index efb64568..2dc67807 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,55 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"] build-backend = "setuptools.build_meta" +[project] +name = "python-telegram" +dynamic = ["version"] +description = "Python library to help you build your own Telegram clients" +readme = "README.md" +authors = [{name = "Alexander Akhmetov", email = "me@alx.cx"}] +license = {text = "MIT"} +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Software Development :: Libraries :: Python Modules", +] +keywords = ["telegram", "client", "api", "tdlib", "tdjson", "td"] +dependencies = [ + "telegram-text==0.2.0", +] +requires-python = ">=3.9" + +[project.urls] +Source = "https://github.com/alexander-akhmetov/python-telegram" +Documentation = "https://python-telegram.readthedocs.io/en/latest/" +Tutorial = "https://python-telegram.readthedocs.io/en/latest/tutorial.html" +Changelog = "https://python-telegram.readthedocs.io/en/latest/changelog.html" + +[tool.setuptools] +packages = ["telegram"] +include-package-data = true +zip-safe = false + +[tool.setuptools.packages.find] +exclude = ["tests*"] + +[tool.setuptools.package-data] +telegram = [ + "lib/darwin/*", + "lib/linux/*", + "py.typed", +] + +[tool.setuptools_scm] +write_to = "telegram/_version.py" + [tool.ruff] line-length = 119 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 08aedd7e..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -description_file = README.md diff --git a/setup.py b/setup.py deleted file mode 100644 index 5607f9c1..00000000 --- a/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -import os -import re -from setuptools import setup - - -def get_version(package): - """ - Returns version of a package (`__version__` in `init.py`). - """ - init_py = open(os.path.join(package, "__init__.py")).read() - - return re.match("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) - - -version = get_version("telegram") - - -setup( - name="python-telegram", - version=version, - description="Python library to help you build your own Telegram clients", - author="Alexander Akhmetov", - author_email="me@aleks.sh", - url="https://github.com/alexander-akhmetov/python-telegram", - long_description_content_type="text/markdown", - long_description=open(os.path.join(os.path.dirname(__file__), "README.md")).read(), - packages=[ - "telegram", - ], - package_data={ - "telegram": [ - "lib/darwin/*", - "lib/linux/*", - "py.typed", - ], - }, - install_requires=[ - "telegram-text~=0.1", - ], -)