From d32798a1ad4b2dfb2b5e1295de6af892d06a6c6e Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Mon, 9 Dec 2024 19:11:32 -0600 Subject: [PATCH 1/4] Switch to Django Common's code of conduct --- CODE_OF_CONDUCT.md | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index e0d5efab5..3f69d2d7c 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,46 +1,3 @@ # Code of Conduct -As contributors and maintainers of the Jazzband projects, and in the interest of -fostering an open and welcoming community, we pledge to respect all people who -contribute through reporting issues, posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. - -We are committed to making participation in the Jazzband a harassment-free experience -for everyone, regardless of the level of experience, gender, gender identity and -expression, sexual orientation, disability, personal appearance, body size, race, -ethnicity, age, religion, or nationality. - -Examples of unacceptable behavior by participants include: - -- The use of sexualized language or imagery -- Personal attacks -- Trolling or insulting/derogatory comments -- Public or private harassment -- Publishing other's private information, such as physical or electronic addresses, - without explicit permission -- Other unethical or unprofessional conduct - -The Jazzband roadies have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are not -aligned to this Code of Conduct, or to ban temporarily or permanently any contributor -for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -By adopting this Code of Conduct, the roadies commit themselves to fairly and -consistently applying these principles to every aspect of managing the jazzband -projects. Roadies who do not follow or enforce the Code of Conduct may be permanently -removed from the Jazzband roadies. - -This code of conduct applies both within project spaces and in public spaces when an -individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by -contacting the roadies at `roadies@jazzband.co`. All complaints will be reviewed and -investigated and will result in a response that is deemed necessary and appropriate to -the circumstances. Roadies are obligated to maintain confidentiality with regard to the -reporter of an incident. - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version -1.3.0, available at [https://contributor-covenant.org/version/1/3/0/][version] - -[homepage]: https://contributor-covenant.org -[version]: https://contributor-covenant.org/version/1/3/0/ +The best-practices project utilizes the [Django Commons Code of Conduct](https://github.com/django-commons/membership/blob/main/CODE_OF_CONDUCT.md). From 2d6cc8746148733bc71aa6490ce9859dd3dafb6a Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Mon, 9 Dec 2024 19:21:24 -0600 Subject: [PATCH 2/4] Switch to Django Commons release workflow This uses the PyPI GitHub trusted publisher integration. --- .github/workflows/release.yml | 128 ++++++++++++++++++++++++++++------ 1 file changed, 105 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1d14d666..e69e5df8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,40 +1,122 @@ --- name: Release -on: - push: - tags: - - '*' +on: push + +env: + # Change these for your project's URLs + PYPI_URL: https://pypi.org/p/django-simple-history + PYPI_TEST_URL: https://test.pypi.org/p/django-simple-history jobs: + build: - if: github.repository == 'jazzband/django-simple-history' + name: Build distribution 📦 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: "3.x" + - name: Install pypa/build + run: + python3 -m pip install build --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: ${{ env.PYPI_URL }} + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1.10 + + github-release: + name: >- + Sign the Python 🐍 distribution 📦 with Sigstore + and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v3.0.0 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' + + publish-to-testpypi: + name: Publish Python 🐍 distribution 📦 to TestPyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to TestPyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U build twine + environment: + name: testpypi + url: ${{ env.PYPI_TEST_URL }} - - name: Build package - run: | - python -m build - twine check dist/* + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing - - name: Upload packages to Jazzband - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1.10 with: - user: jazzband - password: ${{ secrets.JAZZBAND_RELEASE_KEY }} - repository-url: https://jazzband.co/projects/django-simple-history/upload + repository-url: https://test.pypi.org/legacy/ + skip-existing: true From 908e45054e9caed0cff5b2db3dd2acae378b6261 Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Mon, 9 Dec 2024 19:21:50 -0600 Subject: [PATCH 3/4] Update references to Django Commons. --- CHANGES.rst | 1 + CONTRIBUTING.rst | 6 +----- README.rst | 18 +++++++----------- docs/common_issues.rst | 2 +- docs/index.rst | 18 +++++++----------- pyproject.toml | 16 ++++------------ simple_history/manager.py | 6 +++--- simple_history/registry_tests/tests.py | 6 +++--- simple_history/tests/tests/test_middleware.py | 2 +- simple_history/tests/tests/test_models.py | 4 ++-- simple_history/utils.py | 2 +- 11 files changed, 31 insertions(+), 50 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index a03ffd473..05457bc84 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -15,6 +15,7 @@ Unreleased - Added pagination to ``SimpleHistoryAdmin`` (gh-1277) - Fixed issue with history button not working when viewing historical entries in the admin (gh-527) +- Move repository to the Django Commons organization (gh-1391) 3.7.0 (2024-05-29) ------------------ diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index bb76b0143..58136c60f 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,11 +1,7 @@ Contributing to django-simple-history ===================================== -.. image:: https://jazzband.co/static/img/jazzband.svg - :target: https://jazzband.co/ - :alt: Jazzband - -This is a `Jazzband `_ project. By contributing you agree to abide by the `Contributor Code of Conduct `_ and follow the `guidelines `_. +By contributing you agree to abide by the `Contributor Code of Conduct `_. Pull Requests ------------- diff --git a/README.rst b/README.rst index 6b044182c..1cad8724d 100644 --- a/README.rst +++ b/README.rst @@ -3,30 +3,26 @@ django-simple-history |pypi-version| .. Start of PyPI readme -|jazzband| |build-status| |docs| |coverage| |maintainability| |code-style| |downloads| +|build-status| |docs| |coverage| |maintainability| |code-style| |downloads| .. |pypi-version| image:: https://img.shields.io/pypi/v/django-simple-history.svg :target: https://pypi.org/project/django-simple-history/ :alt: PyPI Version -.. |jazzband| image:: https://jazzband.co/static/img/badge.svg - :target: https://jazzband.co/ - :alt: Jazzband - -.. |build-status| image:: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml/badge.svg - :target: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml +.. |build-status| image:: https://github.com/django-commons/django-simple-history/actions/workflows/test.yml/badge.svg + :target: https://github.com/django-commons/django-simple-history/actions/workflows/test.yml :alt: Build Status .. |docs| image:: https://readthedocs.org/projects/django-simple-history/badge/?version=latest :target: https://django-simple-history.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -.. |coverage| image:: https://img.shields.io/codecov/c/github/jazzband/django-simple-history/master.svg - :target: https://app.codecov.io/github/jazzband/django-simple-history?branch=master +.. |coverage| image:: https://img.shields.io/codecov/c/github/django-commons/django-simple-history/master.svg + :target: https://app.codecov.io/github/django-commons/django-simple-history?branch=master :alt: Test Coverage .. |maintainability| image:: https://api.codeclimate.com/v1/badges/66cfd94e2db991f2d28a/maintainability - :target: https://codeclimate.com/github/jazzband/django-simple-history/maintainability + :target: https://codeclimate.com/github/django-commons/django-simple-history/maintainability :alt: Maintainability .. |code-style| image:: https://img.shields.io/badge/code%20style-black-000000.svg @@ -59,7 +55,7 @@ Documentation is available at https://django-simple-history.readthedocs.io/en/st Pull requests are welcome. Read the `CONTRIBUTING`_ file for tips on submitting a pull request. -.. _CONTRIBUTING: https://github.com/jazzband/django-simple-history/blob/master/CONTRIBUTING.rst +.. _CONTRIBUTING: https://github.com/django-commons/django-simple-history/blob/master/CONTRIBUTING.rst License ------- diff --git a/docs/common_issues.rst b/docs/common_issues.rst index 83e62dc51..0f76ca80d 100644 --- a/docs/common_issues.rst +++ b/docs/common_issues.rst @@ -248,7 +248,7 @@ Usage with django-modeltranslation ---------------------------------- If you have ``django-modeltranslation`` installed, you will need to use the ``register()`` -method to model translation, as described `here `__. +method to model translation, as described `here `__. Pointing to the model diff --git a/docs/index.rst b/docs/index.rst index 56ef8ea69..678d3aea4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,16 +1,16 @@ django-simple-history ===================== -.. image:: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml/badge.svg - :target: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml +.. image:: https://github.com/django-commons/django-simple-history/actions/workflows/test.yml/badge.svg + :target: https://github.com/django-commons/django-simple-history/actions/workflows/test.yml :alt: Build Status .. image:: https://readthedocs.org/projects/django-simple-history/badge/?version=latest :target: https://django-simple-history.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -.. image:: https://img.shields.io/codecov/c/github/jazzband/django-simple-history/master.svg - :target: https://app.codecov.io/github/jazzband/django-simple-history?branch=master +.. image:: https://img.shields.io/codecov/c/github/django-commons/django-simple-history/master.svg + :target: https://app.codecov.io/github/django-commons/django-simple-history?branch=master :alt: Test Coverage .. image:: https://img.shields.io/pypi/v/django-simple-history.svg @@ -18,7 +18,7 @@ django-simple-history :alt: PyPI Version .. image:: https://api.codeclimate.com/v1/badges/66cfd94e2db991f2d28a/maintainability - :target: https://codeclimate.com/github/jazzband/django-simple-history/maintainability + :target: https://codeclimate.com/github/django-commons/django-simple-history/maintainability :alt: Maintainability .. image:: https://static.pepy.tech/badge/django-simple-history @@ -29,10 +29,6 @@ django-simple-history :target: https://github.com/psf/black :alt: Code Style -.. image:: https://jazzband.co/static/img/badge.svg - :target: https://jazzband.co/ - :alt: Jazzband - django-simple-history stores Django model state on every create/update/delete. @@ -50,8 +46,8 @@ main 3.10, 3.11, 3.12, 3.13 Contribute ---------- -- Issue Tracker: https://github.com/jazzband/django-simple-history/issues -- Source Code: https://github.com/jazzband/django-simple-history +- Issue Tracker: https://github.com/django-commons/django-simple-history/issues +- Source Code: https://github.com/django-commons/django-simple-history Pull requests are welcome. diff --git a/pyproject.toml b/pyproject.toml index f4c6ea811..1d4a952a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,11 +39,11 @@ dynamic = [ dependencies = [ "django>=4.2", ] -urls.Changelog = "https://github.com/jazzband/django-simple-history/blob/master/CHANGES.rst" +urls.Changelog = "https://github.com/django-commons/django-simple-history/blob/master/CHANGES.rst" urls.Documentation = "https://django-simple-history.readthedocs.io/en/stable/" -urls.Homepage = "https://github.com/jazzband/django-simple-history" -urls.Source = "https://github.com/jazzband/django-simple-history" -urls.Tracker = "https://github.com/jazzband/django-simple-history/issues" +urls.Homepage = "https://github.com/django-commons/django-simple-history" +urls.Source = "https://github.com/django-commons/django-simple-history" +urls.Tracker = "https://github.com/django-commons/django-simple-history/issues" [tool.hatch.version] source = "vcs" @@ -54,18 +54,10 @@ version_scheme = "no-guess-dev" local_scheme = "node-and-date" [tool.hatch.build.targets.wheel] -# Jazzband's release process is limited to 2.2 metadata -# - see https://github.com/jazzband/help/issues/360 -core-metadata-version = "2.2" packages = [ "simple_history", ] -[tool.hatch.build.targets.sdist] -# Jazzband's release process is limited to 2.2 metadata -# - see https://github.com/jazzband/help/issues/360 -core-metadata-version = "2.2" - [tool.hatch.metadata.hooks.fancy-pypi-readme] content-type = "text/x-rst" # (Preview the generated readme by installing `hatch` and running diff --git a/simple_history/manager.py b/simple_history/manager.py index 2d9bda656..5fa404d93 100644 --- a/simple_history/manager.py +++ b/simple_history/manager.py @@ -18,9 +18,9 @@ class HistoricalQuerySet(QuerySet): Enables additional functionality when working with historical records. For additional history on this topic, see: - - https://github.com/jazzband/django-simple-history/pull/229 - - https://github.com/jazzband/django-simple-history/issues/354 - - https://github.com/jazzband/django-simple-history/issues/397 + - https://github.com/django-commons/django-simple-history/pull/229 + - https://github.com/django-commons/django-simple-history/issues/354 + - https://github.com/django-commons/django-simple-history/issues/397 """ def __init__(self, *args, **kwargs): diff --git a/simple_history/registry_tests/tests.py b/simple_history/registry_tests/tests.py index 2217d06a8..ceea60388 100644 --- a/simple_history/registry_tests/tests.py +++ b/simple_history/registry_tests/tests.py @@ -199,7 +199,7 @@ def test_registering_with_tracked_abstract_base(self): class TestCustomAttrForeignKey(TestCase): - """https://github.com/jazzband/django-simple-history/issues/431""" + """https://github.com/django-commons/django-simple-history/issues/431""" def test_custom_attr(self): field = ModelWithCustomAttrForeignKey.history.model._meta.get_field("poll") @@ -207,7 +207,7 @@ def test_custom_attr(self): class TestCustomAttrOneToOneField(TestCase): - """https://github.com/jazzband/django-simple-history/issues/870""" + """https://github.com/django-commons/django-simple-history/issues/870""" def test_custom_attr(self): field = ModelWithCustomAttrOneToOneField.history.model._meta.get_field("poll") @@ -228,7 +228,7 @@ def test_migrate_command(self): class TestModelWithHistoryInDifferentApp(TestCase): - """https://github.com/jazzband/django-simple-history/issues/485""" + """https://github.com/django-commons/django-simple-history/issues/485""" def test__different_app(self): appLabel = ModelWithHistoryInDifferentApp.history.model._meta.app_label diff --git a/simple_history/tests/tests/test_middleware.py b/simple_history/tests/tests/test_middleware.py index 53e20fe28..d59a41f91 100644 --- a/simple_history/tests/tests/test_middleware.py +++ b/simple_history/tests/tests/test_middleware.py @@ -154,7 +154,7 @@ def test_bucket_member_is_set_on_create_view_when_logged_in(self): @override_settings(DEBUG_PROPAGATE_EXCEPTIONS=True) @mock.patch("simple_history.tests.view.MockableView.get") def test_request_attr_is_deleted_after_each_response(self, func_mock): - """https://github.com/jazzband/django-simple-history/issues/1189""" + """https://github.com/django-commons/django-simple-history/issues/1189""" def assert_has_request_attr(has_attr: bool): self.assertEqual(hasattr(HistoricalRecords.context, "request"), has_attr) diff --git a/simple_history/tests/tests/test_models.py b/simple_history/tests/tests/test_models.py index 566e2635a..2a1c08ecd 100644 --- a/simple_history/tests/tests/test_models.py +++ b/simple_history/tests/tests/test_models.py @@ -2847,7 +2847,7 @@ def test_historic_to_historic(self): # test querying directly from the history table and converting # to an instance, it should chase the foreign key properly # in this case if _as_of is not present we use the history_date - # https://github.com/jazzband/django-simple-history/issues/983 + # https://github.com/django-commons/django-simple-history/issues/983 pt1h = TestHistoricParticipanToHistoricOrganization.history.all()[0] pt1i = pt1h.instance self.assertEqual(pt1i.organization.name, "modified") @@ -2974,7 +2974,7 @@ def test_historic_to_historic(self): # test querying directly from the history table and converting # to an instance, it should chase the foreign key properly # in this case if _as_of is not present we use the history_date - # https://github.com/jazzband/django-simple-history/issues/983 + # https://github.com/django-commons/django-simple-history/issues/983 pt1h = TestHistoricParticipanToHistoricOrganizationOneToOne.history.all()[0] pt1i = pt1h.instance self.assertEqual(pt1i.organization.name, "modified") diff --git a/simple_history/utils.py b/simple_history/utils.py index c79e93f75..0fdfc6292 100644 --- a/simple_history/utils.py +++ b/simple_history/utils.py @@ -139,7 +139,7 @@ def bulk_create_with_history( if second_transaction_required: with transaction.atomic(savepoint=False): # Generate a common query to avoid n+1 selections - # https://github.com/jazzband/django-simple-history/issues/974 + # https://github.com/django-commons/django-simple-history/issues/974 cumulative_filter = None obj_when_list = [] for i, obj in enumerate(objs_with_id): From 740d3220aa3d61d34c51b24a0941cfefbddb77e3 Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Sat, 14 Dec 2024 06:05:37 -0600 Subject: [PATCH 4/4] Update CODE_OF_CONDUCT.md Co-authored-by: Anders <6058745+ddabble@users.noreply.github.com> --- CODE_OF_CONDUCT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3f69d2d7c..97efd443f 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,3 +1,3 @@ # Code of Conduct -The best-practices project utilizes the [Django Commons Code of Conduct](https://github.com/django-commons/membership/blob/main/CODE_OF_CONDUCT.md). +The `django-simple-history` project utilizes the [Django Commons Code of Conduct](https://github.com/django-commons/membership/blob/main/CODE_OF_CONDUCT.md).