From ae4726763cd47de52f9246b603d6ceb58e6fd4e5 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 25 Apr 2024 22:31:40 +0100 Subject: [PATCH 1/2] Updated package infrastructure --- .github/workflows/main.yml | 34 ++++++++++++++++ .github/workflows/update-changelog.yaml | 33 +++++++++++++++ .travis.yml | 33 --------------- pyproject.toml | 43 ++++++++++++++++++++ setup.py | 54 ------------------------- tox.ini | 23 +++++++++++ 6 files changed, 133 insertions(+), 87 deletions(-) create mode 100644 .github/workflows/update-changelog.yaml delete mode 100644 .travis.yml create mode 100644 pyproject.toml delete mode 100755 setup.py create mode 100644 tox.ini diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b88e11a..c38d20b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,3 +3,37 @@ name: CI on: push: pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + tests: + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 + with: + envs: | + - linux: py39-test-psutil56 + - linux: py310-test-psutil57 + - linux: py311-test-psutil58 + - linux: py312-test-psutil59 + + - macos: py39-test-psutil56 + - macos: py310-test-psutil57 + - macos: py311-test-psutil58 + - macos: py312-test-psutil59 + + - windows: py39-test-psutil56 + - windows: py310-test-psutil57 + - windows: py311-test-psutil58 + - windows: py312-test-psutil59 + + publish: + needs: tests + uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1 + with: + test_extras: 'test' + test_command: pytest --pyargs psrecord + secrets: + pypi_token: ${{ secrets.pypi_token }} diff --git a/.github/workflows/update-changelog.yaml b/.github/workflows/update-changelog.yaml new file mode 100644 index 0000000..1432b5e --- /dev/null +++ b/.github/workflows/update-changelog.yaml @@ -0,0 +1,33 @@ +# This workflow takes the GitHub release notes an updates the changelog on the +# main branch with the body of the release notes, thereby keeping a log in +# the git repo of the changes. + +name: "Update Changelog" + +on: + release: + types: [released] + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: main + + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + release-notes: ${{ github.event.release.body }} + latest-version: ${{ github.event.release.name }} + path-to-changelog: CHANGES.md + + - name: Commit updated CHANGELOG + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: main + commit_message: Update CHANGELOG + file_pattern: CHANGES.md diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ff64082..0000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -language: c - -os: - - linux - - osx - -env: - matrix: - - PYTHON_VERSION=2.7 PSUTIL_VERSION=2 - - PYTHON_VERSION=2.7 PSUTIL_VERSION=3 - - PYTHON_VERSION=3.4 PSUTIL_VERSION=4 - - PYTHON_VERSION=3.5 PSUTIL_VERSION=5 - - PYTHON_VERSION=3.6 PSUTIL_VERSION=5 - - PYTHON_VERSION=3.7 PSUTIL_VERSION=5 - global: - - CONDA_DEPENDENCIES='matplotlib psutil' - - PIP_DEPENDENCIES='codecov pytest-cov' - - SETUP_XVFB=True - -before_install: - # Make sure we can get the version without any dependencies installed - - python setup.py --version - - git clone git://github.com/astropy/ci-helpers.git - - source ci-helpers/travis/setup_conda.sh - -script: - - py.test --cov psrecord psrecord - - python setup.py check --restructuredtext - - pip install flake8 - - flake8 psrecord - -after_success: - - codecov diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..958bddf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[build-system] +requires = [ + "setuptools>=61.2", +] +build-backend = "setuptools.build_meta" + +[project] +name = "psrecord" +version = "1.3.dev0" +authors = [ + { name = "Thomas Robitaille", email = "thomas.robitaille@gmail.com" }, +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Programming Language :: Python", + "License :: OSI Approved :: BSD License", +] +description = "Python package to record activity from processes" +readme = "README.rst" +dependencies = [ + "psutil>=5.6", +] + +[project.optional-dependencies] +test = [ + "pytest>=7.0", +] + +[project.license] +text = "Simplified BSD License" + +[project.urls] +Homepage = "https://github.com/astrofrog/psrecord" + +[tool.setuptools] +zip-safe = true +provides = [ + "psrecord", +] +include-package-data = false + +[tool.setuptools.packages.find] +namespaces = false diff --git a/setup.py b/setup.py deleted file mode 100755 index 7011e81..0000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 2013, Thomas P. Robitaille -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from setuptools import setup, Command - -from distutils.command.build_py import build_py - -with open('README.rst') as infile: - long_description = infile.read() - -from psrecord import __version__ - -setup(name='psrecord', - version=__version__, - description='Python package to record activity from processes', - long_description=long_description, - url='https://github.com/astrofrog/psrecord', - license='Simplified BSD License', - author='Thomas Robitaille', - author_email='thomas.robitaille@gmail.com', - packages=['psrecord', 'psrecord.tests'], - provides=['psrecord'], - scripts=['scripts/psrecord'], - install_requires=['psutil>=2'], - cmdclass={'build_py': build_py}, - classifiers=[ - "Development Status :: 3 - Alpha", - "Programming Language :: Python", - "License :: OSI Approved :: BSD License", - ], - ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..cacd5fb --- /dev/null +++ b/tox.ini @@ -0,0 +1,23 @@ +[tox] +envlist = + py{39,310,311,312}-test{-psutil56,-psutil57,-psutil58,-psutil59} +requires = + setuptools >= 30.3.0 + pip >= 19.3.1 +isolated_build = true + +[testenv] +changedir = + test: .tmp/{envname} +description = + test: run tests with pytest +deps = + psutil56: psutil==5.6.* + psutil57: psutil==5.6.* + psutil58: psutil==5.6.* + psutil59: psutil==5.6.* +extras = + test +commands = + pip freeze + pytest --pyargs psrecord {posargs} From eeed2bc6c47125394b6a6bbae0a9c11d8233097b Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 25 Apr 2024 22:35:06 +0100 Subject: [PATCH 2/2] Fix versions in tox --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index cacd5fb..ff3ee97 100644 --- a/tox.ini +++ b/tox.ini @@ -13,9 +13,9 @@ description = test: run tests with pytest deps = psutil56: psutil==5.6.* - psutil57: psutil==5.6.* - psutil58: psutil==5.6.* - psutil59: psutil==5.6.* + psutil57: psutil==5.7.* + psutil58: psutil==5.8.* + psutil59: psutil==5.9.* extras = test commands =