Skip to content

Commit

Permalink
build(hatch): switch from setuptools to hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
ultrabug committed Jul 29, 2023
1 parent 20942f2 commit 1fc83b7
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 214 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
pip install hatch
- name: Test with hatch
run: hatch run all
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
qa:
tox
hatch run style:format
hatch run style:check

clean:
rm -rf dist
hatch clean

release: clean qa test
python3 setup.py sdist && python3 -m twine upload dist/*
release: clean qa test build
hatch publish -u __token__

serve:
mkdocs serve

build:
mkdocs build
hatch build

# TODO: maybe move the docs to github
#deploy: qa test
# mkdocs gh-deploy

test:
pytest -xsvv
hatch run all
114 changes: 0 additions & 114 deletions fastentrypoints.py

This file was deleted.

102 changes: 102 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "py3status"
dynamic = ["version"]
description = "py3status: an extensible i3status wrapper written in python"
readme = "README.md"
license = "BSD-2-Clause"
requires-python = ">=3.7"
authors = [
{ name = "Ultrabug", email = "ultrabug@ultrabug.net" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = []

[project.optional-dependencies]
udev = ["pyudev >= 0.21.0"]

[project.urls]
Download = "https://github.com/ultrabug/py3status/tags"
Homepage = "https://github.com/ultrabug/py3status"

[project.scripts]
py3status = "py3status:main"
py3-cmd = "py3status.command:send_command"

[tool.hatch.version]
path = "py3status/version.py"

[tool.hatch.build.targets.sdist]
include = [
"/py3status",
]

[tool.hatch.envs.default.scripts]
all = [
"hatch run test:test",
"hatch run style:check",
]

[tool.hatch.envs.test]
dependencies = [
"pytest"
]

[tool.hatch.envs.test.scripts]
test = [
"pytest -xs",
]

[[tool.hatch.envs.test.matrix]]
python = ["py37", "py38", "py39", "py310", "py311"]
type = ["default"]

[tool.hatch.envs.style]
detached = true
dependencies = [
"black",
"isort",
"ruff",
]

[tool.hatch.envs.style.scripts]
check = [
"isort --check-only --diff py3status",
"black -q --check --diff py3status",
"ruff py3status",
]
format = [
"isort -q py3status",
"black -q py3status",
]

[tool.black]
line-length = 100
target-version = ["py310"]
skip-string-normalization = true

[tool.isort]
profile = "black"
line_length = 100

[tool.ruff]
line-length = 100
ignore = ["E501"]
61 changes: 5 additions & 56 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,64 +1,13 @@
"""
py3status
"""
"""Installation using setup.py is no longer supported.
Use `python -m pip install .` instead."""

from setuptools import find_packages, setup
import fastentrypoints # noqa f401
import sys
from pathlib import Path

module_path = Path(__file__).resolve().parent / "py3status"
sys.path.insert(0, str(module_path))
from version import version # noqa e402
from setuptools import setup

sys.path.remove(str(module_path))


# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return (Path(__file__).resolve().parent / fname).read_text()


# extra requirements
req_udev = ["pyudev >= 0.21.0"]
req_all = req_udev
sys.exit(__doc__)

# Fake reference so GitHub still considers it a real package for statistics purposes.
setup(
name="py3status",
version=version,
author="Ultrabug",
author_email="ultrabug@ultrabug.net",
description="py3status: an extensible i3status wrapper written in python",
long_description=read("README.md"),
long_description_content_type="text/markdown",
extras_require={"all": req_all, "udev": req_udev},
url="https://github.com/ultrabug/py3status",
download_url="https://github.com/ultrabug/py3status/tags",
license="BSD",
platforms="any",
packages=find_packages(),
include_package_data=True,
install_requires=["setuptools"],
entry_points={
"console_scripts": [
"py3status = py3status:main",
"py3-cmd = py3status.command:send_command",
]
},
python_requires=">=3.7",
classifiers=[
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
],
)
35 changes: 0 additions & 35 deletions tox.ini

This file was deleted.

0 comments on commit 1fc83b7

Please sign in to comment.