Skip to content

Commit

Permalink
Use hatch instead of setuptools to build/deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewrankin committed Dec 5, 2024
1 parent e84652a commit 1c0e4c1
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 113 deletions.
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

44 changes: 38 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,45 @@
# pyproject.toml

[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "keysight"
version = "0.3.1"
authors = [{ name = "Matthew Rankin", email = "[email protected]" }]
description = "Package for working with Keysight/Agilent test equipment"
readme = "README.md"
requires-python = ">=3.9"
dependencies = ["numpy>=1.26.0"]
classifiers = [
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'License :: OSI Approved :: MIT License',
'Development Status :: 5 - Production/Stable',
'Operating System :: OS Independent',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules',
]

[project.urls]
Homepage = "https://github.com/questrail/keysight"
Issues = "https://github.com/questrail/keysight/issues"

[tool.black]
line-length = 80

[tool.pylint]
max-line-length = 80
disable = [
"E0401", # (unable-to-import)
]
[tool.black]
line-length = 80

[tool.pyright]
include = ["src"]
exclude = [
Expand All @@ -19,12 +51,12 @@ exclude = [
ignore = ["src/oldstuff"]
defineConstant = { DEBUG = true }
stubPath = "src/stubs"
venv = "keysight"
venv = "tektronix"

reportMissingImports = false
reportMissingTypeStubs = false

pythonVersion = "3.11"
pythonVersion = "3.6"
pythonPlatform = "Linux"

executionEnvironments = [
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ pip-chill==1.0.3
platformdirs==4.2.2
six==1.17.0
tomli==2.0.1
twine==6.0.1
unipath==1.1
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

80 changes: 0 additions & 80 deletions setup.py

This file was deleted.

39 changes: 19 additions & 20 deletions tasks.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2023 The keysight developers. All rights reserved.
# Copyright (c) 2013-2024 The keysight developers. All rights reserved.
# Project site: https://github.com/questrail/keysight
# Use of this source code is governed by a MIT-style license that
# can be found in the LICENSE.txt file for the project.
"""Invoke based tasks for keysight
"""
"""Invoke based tasks for keysight"""

from invoke import run, task
from unipath import Path
Expand All @@ -15,11 +14,17 @@
@task
def lint(ctx):
# pylint: disable=W0613
"""Run flake8 to lint code"""
run("python3 -m flake8")
"""Run ruff and mypy to lint code"""
run("ruff check src/")
run("python3 -m mypy src/")


@task
def outdated(ctx):
"""List outdated packages"""
run("pip list --outdated")


@task
def freeze(ctx):
# pylint: disable=W0613
Expand All @@ -30,25 +35,19 @@ def freeze(ctx):
@task()
def test(ctx):
"""Run unit tests"""
run("nose2")
run("nose2 -C")


@task
def release(ctx, deploy=False, test=False, version=""):
"""Tag release, run Travis-CI, and deploy to PyPI"""
if test:
run("python3 setup.py check")
run("python3 setup.py register sdist upload --dry-run")

if deploy:
run("python3 setup.py check")
if version:
run("git checkout master")
run("git tag -a v{ver} -m 'v{ver}'".format(ver=version))
run("git push")
run("git push origin --tags")
run("python3 -m build")
run("python3 -m twine upload dist/*")
"""Tag release and deploy to PyPI"""
if deploy and version:
run("git checkout master")
run("git tag -a v{ver} -m 'v{ver}'".format(ver=version))
run("git push")
run("git push origin --tags")
run("hatch build")
run("hatch publish")
else:
print("- Have you updated the version?")
print("- Have you updated CHANGELOG.md?")
Expand Down
2 changes: 0 additions & 2 deletions unittest.cfg

This file was deleted.

0 comments on commit 1c0e4c1

Please sign in to comment.