Skip to content

Commit 0fe8b0c

Browse files
authored
feat: migrate setup.py to pyproject (with hatch backend), update package metadata and update publish workflow (#273)
Signed-off-by: K.B.Dharun Krishna <[email protected]>
1 parent c01fd45 commit 0fe8b0c

File tree

5 files changed

+98
-72
lines changed

5 files changed

+98
-72
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ jobs:
3636
working-directory: docs
3737
run: make man
3838

39-
- name: Install pep517
39+
- name: Install build
4040
run:
41-
python -m pip install pep517 --user
41+
python -m pip install build --user
4242

4343
- name: Build a binary wheel and a source tarball
4444
run: >-
45-
python -m pep517.build
46-
--source
47-
--binary
48-
--out-dir dist/
45+
python -m build
46+
--sdist
47+
--wheel
48+
--outdir dist/
4949
.
5050
5151
- name: Attest generated files
@@ -61,6 +61,7 @@ jobs:
6161

6262
pypi-publish:
6363
runs-on: ubuntu-latest
64+
if: github.repository == 'tldr-pages/tldr-python-client'
6465
needs: ['release-build']
6566

6667
environment:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# tldr-python-client
22

33
[![PyPI Release](https://img.shields.io/pypi/v/tldr.svg)](https://pypi.python.org/pypi/tldr)
4-
[![Build](https://github.com/tldr-pages/tldr-python-client/workflows/Test/badge.svg?branch=main)](https://github.com/tldr-pages/tldr-python-client/actions?query=branch%3Amain)
4+
[![Test](https://github.com/tldr-pages/tldr-python-client/actions/workflows/test.yml/badge.svg)](https://github.com/tldr-pages/tldr-python-client/actions/workflows/test.yml)
5+
[![CodeQL](https://github.com/tldr-pages/tldr-python-client/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/tldr-pages/tldr-python-client/actions/workflows/github-code-scanning/codeql)
56
[![Snap Release](https://snapcraft.io/tldr/badge.svg)](https://snapcraft.io/tldr)
67

78
Python command-line client for [tldr pages](https://github.com/tldr-pages/tldr).

pyproject.toml

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,88 @@
11
[build-system]
2-
# Minimum requirements for the build system to execute.
3-
requires = ["setuptools", "wheel"] # PEP 508 specifications.
4-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "tldr"
7+
dynamic = ["version"]
8+
description = "Python command line client for tldr."
9+
readme = "README.md"
10+
license = "MIT"
11+
requires-python = "~=3.9"
12+
authors = [
13+
{ name = "Felix Yan and tldr-pages contributors" },
14+
]
15+
keywords = [
16+
"tldr",
17+
"tldr-pages",
18+
"cheatsheets",
19+
"man",
20+
"manpages",
21+
"documentation"
22+
]
23+
classifiers = [
24+
"Development Status :: 5 - Production/Stable",
25+
"Environment :: Console",
26+
"Intended Audience :: End Users/Desktop",
27+
"Intended Audience :: Developers",
28+
"Intended Audience :: Education",
29+
"License :: OSI Approved :: MIT License",
30+
"Natural Language :: English",
31+
"Operating System :: Android",
32+
"Operating System :: MacOS :: MacOS X",
33+
"Operating System :: Microsoft :: Windows",
34+
"Operating System :: POSIX",
35+
"Operating System :: POSIX :: BSD :: FreeBSD",
36+
"Operating System :: POSIX :: BSD :: NetBSD",
37+
"Operating System :: POSIX :: BSD :: OpenBSD",
38+
"Operating System :: POSIX :: Linux",
39+
"Operating System :: POSIX :: SunOS/Solaris",
40+
"Programming Language :: Python :: 3.9",
41+
"Programming Language :: Python :: 3.10",
42+
"Programming Language :: Python :: 3.11",
43+
"Programming Language :: Python :: 3.12",
44+
"Programming Language :: Python :: 3.13",
45+
"Topic :: Documentation",
46+
"Topic :: Software Development :: Documentation",
47+
"Topic :: System",
48+
"Topic :: Utilities",
49+
]
50+
dependencies = [
51+
"colorama; sys_platform=='win32'",
52+
"shtab>=1.3.10",
53+
"termcolor",
54+
]
55+
[project.optional-dependencies]
56+
cli = [
57+
"pytest",
58+
"pytest-runner",
59+
"flake8",
60+
"sphinx",
61+
"sphinx-argparse"
62+
]
63+
64+
[project.scripts]
65+
tldr = "tldr:cli"
66+
67+
[project.urls]
68+
Homepage = "https://tldr.sh"
69+
Source = "https://github.com/tldr-pages/tldr-python-client"
70+
Issues = "https://github.com/tldr-pages/tldr-python-client/issues"
71+
Changelog = "https://github.com/tldr-pages/tldr-python-client/blob/main/CHANGELOG.md"
72+
Funding = "https://liberapay.com/tldr-pages"
73+
74+
[tool.hatch.version]
75+
path = "tldr.py"
76+
attr = "__version__"
77+
78+
[tool.hatch.build.targets.wheel.shared-data]
79+
"docs/man" = "share/man/man1"
80+
81+
[tool.hatch.build.targets.sdist]
82+
include = [
83+
"tldr.py",
84+
"README.md",
85+
"LICENSE.md",
86+
"CHANGELOG.md",
87+
"docs/man/tldr.1",
88+
]

setup.py

Lines changed: 0 additions & 60 deletions
This file was deleted.

tldr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
from zipfile import ZipFile
1010
from datetime import datetime
1111
from io import BytesIO
12-
import ssl
1312
from typing import List, Optional, Tuple, Union
1413
from urllib.parse import quote
1514
from urllib.request import urlopen, Request
1615
from urllib.error import HTTPError, URLError
1716
from termcolor import colored
17+
import ssl
1818
import shtab
1919
import shutil
2020

2121
__version__ = "3.3.0"
22-
__client_specification__ = "2.2"
22+
__client_specification__ = "2.3"
2323

2424
REQUEST_HEADERS = {'User-Agent': 'tldr-python-client'}
2525
PAGES_SOURCE_LOCATION = os.environ.get(

0 commit comments

Comments
 (0)