Skip to content

Commit

Permalink
Add mypy.
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra committed Dec 22, 2023
1 parent b0e7d9d commit 2c0be1a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ jobs:
with:
python-version: 3.12

- name: Build the development environment
run: |
./bin/build-dev
- name: Build the testing environment
run: pip install '.[test]'
shell: bash

- name: Run the tests
Expand Down
10 changes: 5 additions & 5 deletions ancestry/extension/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from betty.app.extension import Extension, UserFacingExtension
from betty.extension import Privatizer
from betty.load import PostLoader, getLogger
from betty.locale import Localizer
from betty.locale import Str
from betty.model.ancestry import PersonName, Person, Event, Place, Presence, Subject
from betty.model.event_type import Birth

Expand All @@ -17,12 +17,12 @@ def comes_after(cls) -> set[type[Extension]]:
return {Privatizer}

@classmethod
def label(cls, localizer: Localizer) -> str:
return 'Publish people'
def label(cls) -> Str:
return Str.plain('Publish people')

@classmethod
def description(cls, localizer: Localizer) -> str:
return 'Publishes curated information about selected people.'
def description(cls) -> Str:
return Str.plain('Publishes curated information about selected people.')

async def post_load(self) -> None:
self._publish_people()
Expand Down
4 changes: 2 additions & 2 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ set -Eeuo pipefail

cd "$(dirname "$0")/.."

# Lint the shell scripts.
for file in ./bin/*; do
shellcheck -x "$file"
done

# Test the Python code style.
flake8 --ignore=E501 ./ancestry

mypy
5 changes: 5 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[mypy]
files = ./ancestry

[mypy-ancestry.*]
disable_error_code = explicit-override
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from setuptools import setup, find_packages


SETUP = {
'name': 'ancestry',
'python_requires': '~= 3.11',
Expand All @@ -9,6 +10,7 @@
'extras_require': {
'development': [
'autopep8 ~= 2.0.4',
'basedmypy ~= 2.0, >= 2.2.1',
'flake8 ~= 6.1.0',
],
},
Expand Down

0 comments on commit 2c0be1a

Please sign in to comment.