Skip to content

Commit

Permalink
Merge pull request #17 from freakboy3742/pep621
Browse files Browse the repository at this point in the history
Switch to PEP621 project format
  • Loading branch information
freakboy3742 authored Feb 5, 2024
2 parents 906169b + b75d4ca commit 413af42
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 117 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates on Sunday, 8PM UTC
interval: "weekly"
day: "sunday"
time: "20:00"

- package-ecosystem: "pip"
directory: "/"
schedule:
# Check for updates on Sunday, 8PM UTC
interval: "weekly"
day: "sunday"
time: "20:00"
38 changes: 34 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ on:
branches:
- main

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
FORCE_COLOR: "1"

jobs:
pretest:
name: Pre-test checks
Expand All @@ -30,7 +41,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
pip install -e .[dev]
- name: Run pre-test checks
run: |
tox -e package
Expand All @@ -40,8 +51,27 @@ jobs:
needs: pretest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
macOS-version: ["macos-11", "macos-12"]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev" ]
macOS-version: [
# x86_64 runners
"macos-11", "macos-12", "macos-13",
# M1 runners
"macos-14"
]

include:
- experimental: false
- python-version: "3.13-dev"
experimental: true

exclude:
# actions/setup-python doesn't provide Python3.8 or 3.9 for M1.
- macOS-version: "macos-14"
python-version: "3.8"

- macOS-version: "macos-14"
python-version: "3.9"

runs-on: ${{ matrix.macOS-version }}
steps:
- uses: actions/[email protected]
Expand All @@ -52,7 +82,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
pip install -e .[dev]
- name: Test
run: |
tox -e py
15 changes: 15 additions & 0 deletions .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Update pre-commit

on:
schedule:
- cron: "0 20 * * SUN" # Sunday @ 2000 UTC
workflow_dispatch:

jobs:
pre-commit-update:
name: Update pre-commit
uses: beeware/.github/.github/workflows/pre-commit-update.yml@main
with:
create-changenote: false
secrets:
BRUTUS_PAT_TOKEN: ${{ secrets.BRUTUS_PAT_TOKEN }}
16 changes: 7 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-toml
- id: check-yaml
Expand All @@ -9,27 +9,25 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
additional_dependencies: [toml]
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/myint/docformatter
rev: v1.5.0
hooks:
- id: docformatter
args: [--in-place]
- repo: https://github.com/psf/black
rev: 22.10.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-eradicate==1.4.0]
69 changes: 67 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,77 @@
[build-system]
requires = ["setuptools>=60"]
requires = [
"setuptools==69.0.0",
]
build-backend = "setuptools.build_meta"

[project]
dynamic = ["version"]
name = "ds_store"
description = "Manipulate Finder .DS_Store files from Python"
readme = "README.rst"
requires-python = ">= 3.8"
license.text = "New BSD"
authors = [
{name="Alastair Houghton", email="[email protected]"}
]
maintainers = [
{name="Russell Keith-Magee", email="[email protected]"}
]
keywords = [
"DS_Store"
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Desktop Environment",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"mac_alias >= 2.0.1",
]

[project.urls]
Homepage = "http://alastairs-place.net/projects/ds_store"
Source = "https://github.com/dmgbuild/ds_store"

[project.scripts]
ds_store = "ds_store.__main__:main"

[project.optional-dependencies]
dev = [
"coverage == 7.4.1",
# Pre-commit 3.6.0 deprecated support for Python 3.8
"pre-commit == 3.5.0 ; python_version < '3.9'",
"pre-commit == 3.6.0 ; python_version >= '3.9'",
"pytest == 8.0.0",
"pytest-cov == 4.1.0",
"tox == 4.12.1",
]
docs = [
# Sphinx 7.2 deprecated support for Python 3.8
"sphinx == 7.1.2 ; python_version < '3.9'",
"sphinx == 7.2.6 ; python_version >= '3.9'",
"sphinx-autobuild == 2021.3.14",
"sphinx_rtd_theme == 2.0.0"
]

[tool.setuptools.dynamic]
version = {attr = "ds_store.__version__"}

[tool.isort]
profile = "black"
split_on_trailing_comma = true
combine_as_imports = true
skip_glob = [
"docs/conf.py",
"venv*",
"local",
]
multi_line_output = 3
73 changes: 0 additions & 73 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion src/ds_store/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DSStoreEntry:
"""

def __init__(self, filename, code, typecode, value=None):
if str != bytes and type(filename) == bytes:
if str != bytes and isinstance(filename, bytes):
filename = filename.decode("utf-8")

if not isinstance(code, bytes):
Expand Down
56 changes: 28 additions & 28 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
# flake8 doesn't believe in pyproject.toml, so we keep the configuration here.
[flake8]
exclude=\
.eggs/*,\
build/*,\
docs/*,\
.tox/*,\
venv*
extend_ignore=C901,E203
max-line-length = 119

[tox]
envlist = flake8,docs,package,py{37,38,39,310,311,312}
envlist = docs,package,py{38,39,310,311,312,313}
skip_missing_interpreters = true
isolated_build = True

[testenv]
extras =
test
dev
commands =
pytest --cov -vv
coverage xml
python -m pytest --cov -vv

[testenv:flake8]
skip_install = True
deps =
flake8
commands = flake8 {posargs}

[testenv:docs]
build_dir = _build
change_dir = docs
extras =
docs
# -W: make warnings into errors
# --keep-going: continue on errors
# -j: run with multiple processes
# -n: nitpick mode
# -v: verbose logging
# -E: force rebuild of environment
# -T: print traceback on error
# -a: read/parse all files
# -d: use tox's temp dir for caching
commands =
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
python -m sphinx build -W --keep-going -j auto -n -v -E -T -a -d _build/doctrees -b html . _build/html

[testenv:package]
skip-install = True
passenv = FORCE_COLOR
deps =
check_manifest
build
twine
build==1.0.3
twine==4.0.2
commands =
check-manifest -v
python -m build --sdist --wheel --outdir dist/ .
python -m twine check dist/*

[testenv:publish]
deps =
wheel
twine
passenv =
TWINE_USERNAME
TWINE_PASSWORD
commands =
python -m twine upload dist/*

0 comments on commit 413af42

Please sign in to comment.