Skip to content

Commit

Permalink
chore: Modernize packaging (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonagestam authored Nov 28, 2024
1 parent b54844d commit d1feb25
Show file tree
Hide file tree
Showing 18 changed files with 150 additions and 115 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = True

[*]
end_of_line = lf
insert_final_newline = True
indent_style = space
indent_size = 4
trim_trailing_whitespace = True

[*.py]
charset = utf-8
max_line_length = 88

[*.{yml,yaml,md,toml}]
indent_size = 2

[Makefile]
indent_style = tab
26 changes: 26 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,29 @@ jobs:
name: codecov-py${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

type-check:
name: Type check
runs-on: ubuntu-latest
env:
FORCE_COLOR: "1"
COLUMNS: "150"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.13
cache: pip
cache-dependency-path: requirements-typing.txt
check-latest: true
- name: mypy cache
uses: actions/cache@v4
with:
path: .mypy_cache
key: "${{ runner.os }}-mypy-3.13-${{ hashFiles('requirements-typing.txt') }}"
restore-keys: |
${{ runner.os }}-mypy-3.13
${{ runner.os }}-mypy
- run: pip install -e .
- run: pip install -r requirements-typing.txt
- run: mypy --strict
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Dynamic version file
src/abcattrs/_version.py
2 changes: 1 addition & 1 deletion .goose/check-manifest/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"source_ecosystem":{"language":"python","version":"3.13"},"source_dependencies":["check-manifest","setuptools==75.6.0","wheel==0.45.1"],"lock_files":[{"path":"requirements.txt","checksum":"sha256:e1d33bb3b4287b3ee29d6347bbafb6ce3c3800836559faddfcb84bfc233b33a9"}],"checksum":"sha256:03fcf52f00db4b05d7cc74bc4affa688db258b6bd7c53620903dade10ec4b397"}
{"source_ecosystem":{"language":"python","version":"3.13"},"source_dependencies":["check-manifest","setuptools-scm==8.1.0","setuptools==75.6.0","wheel==0.45.1"],"lock_files":[{"path":"requirements.txt","checksum":"sha256:5fbd751fae5935b95444c24527ff77a53a68954119fbfb4b65b1e25550a7683e"}],"checksum":"sha256:36a935b08627d072fea2bf37d5ac618ea268d6b66963259a31473800a3857e49"}
3 changes: 3 additions & 0 deletions .goose/check-manifest/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pyproject-hooks==1.2.0 \
setuptools==75.6.0 \
--hash=sha256:8199222558df7c86216af4f84c30e9b34a61d8ba19366cc914424cdbd28252f6 \
--hash=sha256:ce74b49e8f7110f9bf04883b730f4765b774ef3ef28f722cce7c273d253aaf7d
setuptools-scm==8.1.0 \
--hash=sha256:42dea1b65771cba93b7a515d65a65d8246e560768a66b9106a592c8e7f26c8a7 \
--hash=sha256:897a3226a6fd4a6eb2f068745e49733261a21f70b1bb28fce0339feb978d9af3
wheel==0.45.1 \
--hash=sha256:661e1abd9198507b1409a20c02106d9670b2576e916d58f520316666abca6729 \
--hash=sha256:708e7481cc80179af0e556bbf0cc00b8444c7321e2700b8d8580231d13017248
1 change: 0 additions & 1 deletion .goose/mypy/manifest.json

This file was deleted.

54 changes: 0 additions & 54 deletions .goose/mypy/requirements.txt

This file was deleted.

4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ recursive-include abcattrs py.typed
exclude *.yaml
exclude *.yml
exclude *.toml
exclude *.txt
include README.md
include LICENSE
include pyproject.toml
exclude setup.cfg
exclude .gitignore
exclude .editorconfig
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ SHELL := /usr/bin/env bash
.PHONY: clean
clean:
rm -rf *.egg-info **/__pycache__ build dist

.PHONY: requirements
requirements: export CUSTOM_COMPILE_COMMAND='make requirements'
requirements:
uv pip compile --extra=type-check --output-file=requirements-typing.txt pyproject.toml
19 changes: 1 addition & 18 deletions goose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,17 @@ environments:
dependencies:
- prettier

- id: mypy
ecosystem:
language: python
version: "3.13"
dependencies:
- mypy
- pytest
- types-setuptools

- id: check-manifest
ecosystem:
language: python
version: "3.13"
dependencies:
- check-manifest
- setuptools==75.6.0
- setuptools-scm==8.1.0
- wheel==0.45.1

hooks:
- id: mypy
environment: mypy
command: mypy
env_vars:
FORCE_COLOR: "1"
COLUMNS: "150"
read_only: true
parameterize: false

- id: check-manifest
environment: check-manifest
command: check-manifest
Expand Down
67 changes: 66 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
[build-system]
requires = ["setuptools==75.6.0", "wheel==0.45.1"]
requires = [
"setuptools==75.6.0",
"setuptools-scm==8.1.0",
"wheel==0.45.1",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_file = "src/abcattrs/_version.py"

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
readme = {file = "README.md", content-type = "text/markdown; charset=UTF-8"}

[tool.setuptools.packages.find]
where = ["src"]
namespaces = false


[project]
name = "abcattrs"
authors = [
{ name="Anton Agestam", email="[email protected]" },
]
description = "Abstract class attributes"
license = {text = "BSD-3-Clause"}
requires-python = ">=3.10"
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Development Status :: 5 - Stable",
"Typing :: Typed",
]
dynamic = ["version", "readme"]

[project.optional-dependencies]
test = [
"pytest",
"pytest-mypy-plugins",
"coverage",
]
type-check = [
"mypy",
"pytest",
"types-setuptools",
]

[project.urls]
"Source Repository" = "https://github.com/antonagestam/abcattrs/"


[tool.check-manifest]
ignore = ["src/abcattrs/_version.py"]


[tool.pip-tools]
generate-hashes = true
strip-extras = true
upgrade = true
18 changes: 18 additions & 0 deletions requirements-typing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file was autogenerated by uv via the following command:
# uv pip compile --extra=type-check --output-file=requirements-typing.txt pyproject.toml
iniconfig==2.0.0
# via pytest
mypy==1.13.0
# via abcattrs (pyproject.toml)
mypy-extensions==1.0.0
# via mypy
packaging==24.2
# via pytest
pluggy==1.5.0
# via pytest
pytest==8.3.3
# via abcattrs (pyproject.toml)
types-setuptools==75.6.0.20241126
# via abcattrs (pyproject.toml)
typing-extensions==4.12.2
# via mypy
36 changes: 0 additions & 36 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,39 +1,3 @@
[metadata]
name = abcattrs
version = attr: abcattrs.__version__
description = Abstract class attributes
long_description = file: README.md
long_description_content_type = text/markdown; charset=UTF-8
license = BSD 3-Clause License
license_file = LICENSE
classifiers =
Intended Audience :: Developers
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Development Status :: 3 - Alpha
author = Anton Agestam
author_email = [email protected]
url = https://github.com/antonagestam/abcattrs/

[options]
include_package_data = True
packages = find:
python_requires = >=3.10

[options.package_data]
abcattrs = py.typed

[options.extras_require]
test =
pytest
pytest-mypy-plugins
coverage

[mypy]
python_version = 3.10
show_error_codes = True
Expand Down
3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

5 changes: 4 additions & 1 deletion abcattrs/__init__.py → src/abcattrs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from ._version import __version__
from ._version import __version_tuple__
from .abcattrs import Abstract
from .abcattrs import UndefinedAbstractAttribute
from .abcattrs import abstractattrs
from .abcattrs import check_abstract_class_attributes

__all__ = (
"__version__",
"__version_tuple__",
"Abstract",
"UndefinedAbstractAttribute",
"abstractattrs",
"check_abstract_class_attributes",
)
__version__ = "0.4.0"
1 change: 1 addition & 0 deletions abcattrs/abcattrs.py → src/abcattrs/abcattrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def check_abstract_class_attributes(cls: type) -> None:

def _init_subclass(
cls: type,
/,
existing_init_subclass: Callable[..., None] | None = None,
*args: Any,
**kwargs: Any,
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit d1feb25

Please sign in to comment.