From 09d6030d31a2532801efd2a0dddfaddf5e42690e Mon Sep 17 00:00:00 2001 From: pylakey Date: Wed, 19 Jun 2024 15:10:00 +0300 Subject: [PATCH] Migrated to hatchling build backend --- .github/workflows/publish.yml | 31 ++++++++++---- pyproject.old.toml | 48 +++++++++++++++++++++ pyproject.toml | 80 +++++++++++++++++++++++------------ 3 files changed, 123 insertions(+), 36 deletions(-) create mode 100644 pyproject.old.toml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 21ceeb0..ead4427 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,15 +8,30 @@ on: jobs: publish_pypi: - runs-on: ubuntu-latest name: Push python package to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/aiotdlib + permissions: + id-token: write + steps: - - name: Check out the repo - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 - - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.16 + - name: Set up Python + uses: actions/setup-python@v5 with: - pypi_token: ${{ secrets.PYPI_API_TOKEN }} - ignore_dev_requirements: true - python_version: 3.9 \ No newline at end of file + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build package + run: python -m build + + - name: pypi-publish + uses: pypa/gh-action-pypi-publish@v1.9.0 \ No newline at end of file diff --git a/pyproject.old.toml b/pyproject.old.toml new file mode 100644 index 0000000..15fe80b --- /dev/null +++ b/pyproject.old.toml @@ -0,0 +1,48 @@ +[tool.poetry] +name = "aiotdlib" +version = "0.24.2" +description = "Python asyncio Telegram client based on TDLib" +authors = ["pylakey "] +license = "MIT" +readme = "README.md" +homepage = "https://github.com/pylakey/aiotdlib" +repository = "https://github.com/pylakey/aiotdlib" +packages = [ + { include = "aiotdlib" }, + { include = "aiotdlib_generator" }, +] +include = [ + "README.md", + "CHANGELOG.md", +] +classifiers = [ + "Framework :: AsyncIO", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Operating System :: POSIX :: BSD :: FreeBSD", + "Topic :: Software Development :: Libraries :: Python Modules", + "Typing :: Typed", +] + +[tool.poetry.dependencies] +python = "^3.9" +pydantic = ">=2,<3" +sortedcontainers = "^2.4.0" +ujson = "^5.4.0" +pydantic-settings = "^2.1.0" + +[tool.poetry.dev-dependencies] +Jinja2 = "^3.1.3" + +[tool.poetry.scripts] +aiotdlib_generator = "aiotdlib_generator.__main__:main" + +[tool.poetry.group.dev.dependencies] +pydash = "^7.0.4" +black = ">=23.3,<25.0" +bump-pydantic = "^0.8.0" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/pyproject.toml b/pyproject.toml index 15fe80b..58d2acd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,22 @@ -[tool.poetry] +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] name = "aiotdlib" -version = "0.24.2" +dynamic = ["version"] description = "Python asyncio Telegram client based on TDLib" -authors = ["pylakey "] -license = "MIT" +authors = [ + { name = "pylakey", email = "pylakey@protonmail.com" } +] +maintainers = [ + { name = "pylakey", email = "pylakey@protonmail.com" } +] +license = { file = "LICENSE" } readme = "README.md" +requires-python = ">=3.9" homepage = "https://github.com/pylakey/aiotdlib" repository = "https://github.com/pylakey/aiotdlib" -packages = [ - { include = "aiotdlib" }, - { include = "aiotdlib_generator" }, -] -include = [ - "README.md", - "CHANGELOG.md", -] classifiers = [ "Framework :: AsyncIO", "License :: OSI Approved :: MIT License", @@ -24,25 +26,47 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", "Typing :: Typed", ] +dependencies = [ + "pydantic>=2,<3", + "sortedcontainers>=2.4.0", + "ujson>=5", + "pydantic-settings>=2.1.0,<3", +] -[tool.poetry.dependencies] -python = "^3.9" -pydantic = ">=2,<3" -sortedcontainers = "^2.4.0" -ujson = "^5.4.0" -pydantic-settings = "^2.1.0" +[project.optional-dependencies] +dev = [ + "Jinja2>=3.1.3", + "pydash>=7.0.4", + "black>=23.3,<25.0", +] -[tool.poetry.dev-dependencies] -Jinja2 = "^3.1.3" +[project.urls] +Source = "https://github.com/pylakey/aiotdlib" +Homepage = "https://github.com/pylakey/aiotdlib" -[tool.poetry.scripts] +[project.scripts] aiotdlib_generator = "aiotdlib_generator.__main__:main" -[tool.poetry.group.dev.dependencies] -pydash = "^7.0.4" -black = ">=23.3,<25.0" -bump-pydantic = "^0.8.0" +[tool.hatch.version] +path = "aiotdlib/__init__.py" -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build] +skip-excluded-dirs = true + +[tool.hatch.build.targets.sdist] +artifacts = [ + "aiotdlib/tdlib/*", +] +exclude = [ + "**/__pycache__", + "**/*.py[cod]" +] + +[tool.hatch.build.targets.wheel] +only-packages = true +artifacts = [ + "aiotdlib/tdlib/*", +]