Skip to content

Commit

Permalink
Support 3.12 and drop 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian committed Oct 4, 2023
1 parent e808fc8 commit a7d9b87
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
build:
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
Expand All @@ -38,14 +38,14 @@ jobs:
- name: Build dist and test with unittest
if: matrix.os != 'windows-latest'
run: |
python setup.py sdist bdist_wheel
python -m build
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
pip install dist/*.whl
python -m unittest
- name: Build dist and test with unittest on Windows
if: matrix.os == 'windows-latest'
run: |
python setup.py sdist bdist_wheel
python -m build
if (Test-Path -Path '.\requirements-test.txt' -PathType Leaf) {pip install -r requirements-test.txt}
pip install (Get-ChildItem dist/*.whl)
python -m unittest
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
branches: [ master ]

jobs:
flake8-lint:
lint:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: ${{ matrix.python-version }}
- name: Install flake8
run: pip install flake8
- name: Run flake8
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine setuptools wheel
pip install build twine setuptools wheel
- name: Build source tar
run: |
python setup.py sdist bdist_wheel
python -m build
- name: Publish wheels to PyPI
continue-on-error: true
env:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
refresh: clean build install lint

build:
python setup.py build
python -m build

install:
python setup.py install
pip install .

build_dist:
make clean
python setup.py sdist bdist_wheel
python -m build
pip install dist/*.whl
make test

Expand Down
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020-2021 Tian Gao
Copyright 2020-2023 Tian Gao

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,6 @@ Please send bug reports and feature requests through [github issue tracker](http

## License

Copyright Tian Gao, 2020-2021.
Copyright 2020-2023 Tian Gao.

Distributed under the terms of the [Apache 2.0 license](https://github.com/gaogaotiantian/objprint/blob/master/LICENSE).
29 changes: 29 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "objprint"
authors = [{name = "Tian Gao", email = "[email protected]"}]
description = "A library that can print Python objects in human readable format"
readme = "README.md"
requires-python = ">=3.6"
license = {file = "LICENSE"}
dynamic = ["version"]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent"
]

[project.urls]
Homepage = "https://github.com/gaogaotiantian/objprint"

[tool.setuptools.dynamic]
version = {attr = "objprint.__version__"}
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
flake8
setuptools
wheel
Expand Down
40 changes: 0 additions & 40 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/objprint/objprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _get_line(key: str) -> str:
if cfg.label and any(re.fullmatch(pattern, key) is not None for pattern in cfg.label):
return set_color(f".{key} = {val}", COLOR.YELLOW)
elif cfg.color:
return f"{set_color('.'+key, COLOR.GREEN)} = {val}"
return f"{set_color('.' + key, COLOR.GREEN)} = {val}"
else:
return f".{key} = {val}"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_formatter(self):
op(a)
self.assertEqual(buf.getvalue(), "[0xa, 0xd, 0x10]\n")

op.register_formatter(float, lambda x: f"Float: {round(x,3)}")
op.register_formatter(float, lambda x: f"Float: {round(x, 3)}")
with io.StringIO() as buf, redirect_stdout(buf):
op(3.14159)
self.assertEqual(buf.getvalue(), "Float: 3.142\n")
Expand Down

0 comments on commit a7d9b87

Please sign in to comment.