From fad25ffb625f15f232f00ad9d8b0c5285192e049 Mon Sep 17 00:00:00 2001 From: bbb Date: Fri, 11 Apr 2025 10:17:32 -0500 Subject: [PATCH 1/3] Experiment w/ pyproject.toml/uv/pytest --- .github/workflows/CI.yml | 18 +++++++---- README.md | 5 ++-- pyproject.toml | 65 ++++++++++++++++++++++++++++++++++++++++ setup.cfg | 51 ------------------------------- setup.py | 3 -- 5 files changed, 80 insertions(+), 62 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 834389e..a96fd8b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,10 +15,13 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.9 + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" - name: Install Dependencies run: | - python -m pip install --upgrade pip - pip install .[dev] + uv pip install '.[dev]' - name: Run Ruff run: ruff check . - name: Run Ruff Format @@ -37,11 +40,14 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" - name: Install Dependencies run: | - python -m pip install --upgrade pip - python -m pip install "Django==${{ matrix.django-version }}.*" - python -m pip install selenium webdriver-manager + uv pip install "Django==${{ matrix.django-version }}.*" + uv pip install -e '.[test]' - name: Run Tests run: | - python -m unittest discover django_modal_actions/tests + uv run pytest django_modal_actions/tests diff --git a/README.md b/README.md index c571aee..8c74a5e 100644 --- a/README.md +++ b/README.md @@ -280,7 +280,8 @@ These custom templates will include the modal action buttons while allowing you To run the tests, execute: ``` -python -m unittest discover django_modal_actions/tests +pip install -e '.[test]' +pytest django_modal_actions/tests ``` ## Contributing @@ -289,4 +290,4 @@ Contributions are welcome! Please feel free to submit a Pull Request. ## License -This project is licensed under the MIT License. \ No newline at end of file +This project is licensed under the MIT License. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..dec56fc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,65 @@ + +[project] +name = "django-modal-actions" +version = "0.1.4" +description = "A Django app for adding modal actions to the admin interface" +readme = "README.md" +authors = [ + {name = "Michael Gendy", email = "nagymichel13@gmail.com"}, +] +classifiers = [ + "Environment :: Web Environment", + "Framework :: Django", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", +] +requires-python = ">=3.7" +dependencies = [ + "Django>=3.2", +] +license = {text = "MIT"} + +[project.urls] +Homepage = "https://github.com/Mng-dev-ai/django-modal-actions" + +[project.optional-dependencies] +dev = [ + "ruff>=0.6.3", + "selenium>=4.24.0", +] +test = [ + "pytest", + "pytest-cov", + "selenium", + "webdriver-manager", +] + +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" + +[tool.ruff] +line-length = 120 +target-version = "py37" +select = ["E", "F", "I", "D", "N", "S", "C90"] +# TODO: Why are these here? They are part of .gitignore so ruff should already exclude them? +exclude = [ + ".git", + "__pycache__", + "build", + "dist", + "*.egg-info", + "venv", +] + +[tool.ruff.isort] +known-first-party = ["django_modal_actions"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 46a8409..0000000 --- a/setup.cfg +++ /dev/null @@ -1,51 +0,0 @@ -[metadata] -name = django-modal-actions -version = 0.1.4 -description = A Django app for adding modal actions to the admin interface -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/Mng-dev-ai/django-modal-actions -author = Michael Gendy -author_email = nagymichel13@gmail.com -license = MIT -classifiers = - Environment :: Web Environment - Framework :: Django - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Internet :: WWW/HTTP - Topic :: Internet :: WWW/HTTP :: Dynamic Content - -[options] -include_package_data = true -packages = find: -python_requires = >=3.7 -install_requires = - Django>=3.2 - -[options.extras_require] -dev = - selenium>=4.24.0 - ruff>=0.6.3 - -[tool:ruff] -line-length = 120 -target-version = "py37" -select = ["E", "F", "I", "D", "N", "S", "C90"] -exclude = - .git - __pycache__ - build - dist - *.egg-info - venv - -[tool:ruff.isort] -known-first-party = ["django_modal_actions"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From cb466711f368883794d20f17449bf8d04a7c8ec8 Mon Sep 17 00:00:00 2001 From: bbb Date: Fri, 11 Apr 2025 10:22:33 -0500 Subject: [PATCH 2/3] Add missing -e --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a96fd8b..38b63a9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,7 +21,7 @@ jobs: version: "latest" - name: Install Dependencies run: | - uv pip install '.[dev]' + uv pip install -e '.[dev]' - name: Run Ruff run: ruff check . - name: Run Ruff Format From cc4647b4fa389d80006acfa9dc5ddce4c4230192 Mon Sep 17 00:00:00 2001 From: bbb Date: Fri, 11 Apr 2025 10:38:57 -0500 Subject: [PATCH 3/3] Add --system --- .github/workflows/CI.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 38b63a9..c3be559 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,7 +21,7 @@ jobs: version: "latest" - name: Install Dependencies run: | - uv pip install -e '.[dev]' + uv pip install --system -e '.[dev]' - name: Run Ruff run: ruff check . - name: Run Ruff Format @@ -46,8 +46,8 @@ jobs: version: "latest" - name: Install Dependencies run: | - uv pip install "Django==${{ matrix.django-version }}.*" - uv pip install -e '.[test]' + uv pip install --system "Django==${{ matrix.django-version }}.*" + uv pip install --system -e '.[test]' - name: Run Tests run: | uv run pytest django_modal_actions/tests