diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 1184b36..bbb4e20 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.6.1 +current_version = 0.7.0 commit = True tag = False diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a778415..e7069b4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,10 +34,10 @@ jobs: steps: - name: Check Out VCS Repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3.5.3 - name: Set Up Python ${{ matrix.python_version }} - uses: actions/setup-python@v4.5.0 + uses: actions/setup-python@v4.7.0 with: python-version: "${{ matrix.python_version }}" @@ -93,10 +93,10 @@ jobs: steps: - name: Check Out VCS Repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3.5.3 - name: Set Up Python ${{ matrix.python_version }} - uses: actions/setup-python@v4.5.0 + uses: actions/setup-python@v4.7.0 with: python-version: "${{ matrix.python_version }}" @@ -138,7 +138,7 @@ jobs: make test-coverage-report - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3.1.2 + uses: codecov/codecov-action@v3.1.4 with: directory: ./test-reports/coverage/ fail_ci_if_error: true diff --git a/.github/workflows/dependency-review.yaml b/.github/workflows/dependency-review.yaml index d9ef7bb..fa84e1d 100644 --- a/.github/workflows/dependency-review.yaml +++ b/.github/workflows/dependency-review.yaml @@ -17,9 +17,9 @@ jobs: steps: - name: Check Out VCS Repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3.5.3 - name: Dependency Review - uses: actions/dependency-review-action@v3.0.4 + uses: actions/dependency-review-action@v3.0.6 with: fail-on-severity: critical diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 211edee..2dfc465 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -38,11 +38,11 @@ jobs: steps: - name: Check Out VCS Repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3.5.3 - name: Set Up Python id: set_up_python - uses: actions/setup-python@v4.5.0 + uses: actions/setup-python@v4.7.0 with: python-version: "3.10.9" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9742dd7..100b6b3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,11 +35,11 @@ jobs: steps: - name: Check Out VCS Repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3.5.3 - name: Set Up Python id: set_up_python - uses: actions/setup-python@v4.5.0 + uses: actions/setup-python@v4.7.0 with: python-version: "3.10.9" diff --git a/HISTORY.rst b/HISTORY.rst index 232a058..b786ca0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,21 @@ History unreleased (YYYY-MM-DD) +++++++++++++++++++++++ +0.7.0 (2023-06-09) +++++++++++++++++++ + +- (PR #242, 2023-07-10) Add improved `__repr__()` to `User` model +- (PR #243, 2023-07-10) Fix broken Make task `docker-compose-run-test` +- (PR #241, 2023-07-10) chore: Bump codecov/codecov-action from 3.1.2 to 3.1.4 +- (PR #244, 2023-07-14) chore: Bump actions/setup-python from 4.5.0 to 4.7.0 +- (PR #231, 2023-07-14) chore(deps): Bump flake8 from 3.8.4 to 6.0.0 +- (PR #240, 2023-07-14) chore: Bump actions/checkout from 3.3.0 to 3.5.3 +- (PR #237, 2023-07-14) chore: Bump actions/dependency-review-action from 3.0.4 to 3.0.6 +- (PR #235, 2023-07-14) chore(deps): Bump coverage from 7.2.1 to 7.2.7 +- (PR #247, 2023-07-25) chore(deps): Bump mypy from 1.1.1 to 1.4.1 +- (PR #246, 2023-07-25) chore(deps): Bump setuptools from 67.6.0 to 68.0.0 +- (PR #245, 2023-07-25) chore(deps): Bump twine from 4.0.1 to 4.0.2 + 0.6.1 (2023-06-09) ++++++++++++++++++ diff --git a/Makefile b/Makefile index 911884d..bbdeb45 100644 --- a/Makefile +++ b/Makefile @@ -122,6 +122,6 @@ python-pip-install: ## Install Pip docker-compose-run-test: export COMPOSE_FILE = docker-compose.yml:docker-compose.test.yml docker-compose-run-test: ## Run tests with Docker Compose - docker-compose run --rm -- app-python3.8 - docker-compose run --rm -- app-python3.9 - docker-compose run --rm -- app-python3.10 + docker compose run --rm --env TOXENV=py38 -- app-python3.8 + docker compose run --rm --env TOXENV=py39 -- app-python3.9 + docker compose run --rm --env TOXENV=py310 -- app-python3.10 diff --git a/docker-compose.test.yml b/docker-compose.test.yml index cf96a81..51d65c8 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -15,6 +15,7 @@ services: - DATABASE_USERNAME=${DATABASE_USERNAME:-app} - PYTHONBREAKPOINT - PYTHONDONTWRITEBYTECODE=true + - TOXENV depends_on: - db-test volumes: diff --git a/fd_dj_accounts/__init__.py b/fd_dj_accounts/__init__.py index 27fce79..531a77c 100644 --- a/fd_dj_accounts/__init__.py +++ b/fd_dj_accounts/__init__.py @@ -98,7 +98,7 @@ """ -__version__ = '0.6.1' +__version__ = '0.7.0' default_app_config = 'fd_dj_accounts.apps.AccountsAppConfig' diff --git a/fd_dj_accounts/models.py b/fd_dj_accounts/models.py index 9a54e8f..fca47a6 100644 --- a/fd_dj_accounts/models.py +++ b/fd_dj_accounts/models.py @@ -118,6 +118,7 @@ class User(base_models.BaseUser): - Override :meth:`save` to make sure full validation is performed before each and every save (including creation). - Custom model manager. + - Custom :meth:`__repr__` that includes the user’s ``id`` in addition to the username. .. seealso:: :class:`AnonymousUser`. @@ -146,6 +147,16 @@ class Meta: verbose_name = 'user' verbose_name_plural = 'users' + def __repr__(self) -> str: + # fmt: off + return ( + f"<{self.__class__.__name__}(" + f"id={self.id!r}," + f" {self.USERNAME_FIELD}={self.get_username()!r}" + f")>" + ) + # fmt: on + def save(self, *args: Any, **kwargs: Any) -> None: """Call :meth:`full_clean` before saving.""" self.full_clean() diff --git a/requirements_release.txt b/requirements_release.txt index 8cc2065..3f4f823 100644 --- a/requirements_release.txt +++ b/requirements_release.txt @@ -1,6 +1,6 @@ -r requirements.txt bumpversion==0.5.3 -setuptools==67.6.0 -twine==4.0.1 +setuptools==68.0.0 +twine==4.0.2 wheel==0.40.0 diff --git a/requirements_test.txt b/requirements_test.txt index 62bc484..7a5b18a 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,7 +1,7 @@ -r requirements.txt -coverage==7.2.1 -flake8==3.8.4 -mypy==1.1.1 +coverage==7.2.7 +flake8==6.0.0 +mypy==1.4.1 psycopg2==2.9.3 --no-binary psycopg2 tox==3.26.0 diff --git a/tests/test_models.py b/tests/test_models.py index 3599552..dce58a0 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,3 +1,5 @@ +from uuid import UUID + from django.test import SimpleTestCase, TestCase from fd_dj_accounts.models import AnonymousUser, User, UserManager, get_or_create_system_user @@ -83,6 +85,19 @@ def test_create_superuser_raises_error_on_false_is_staff(self): # type: ignore class UserTestCase(TestCase): + def test_repr(self) -> None: + user = User( + id=UUID('12caf218-0001-45d4-b4df-44ff87f19989'), + email_address='user@example.com', + ) + self.assertEqual( + repr(user), + "" + ) + def test_model_manager(self): # type: ignore self.assertIsInstance(User.objects, UserManager) diff --git a/tox.ini b/tox.ini index ec807dc..78598f5 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,8 @@ envlist = [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir}/fd_dj_accounts +passenv = + DATABASE_* commands = coverage run --rcfile=setup.cfg runtests.py tests deps = -r{toxinidir}/requirements_test.txt