Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ⚙️ migrated to uv and moved code to src/ folder #496

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.12
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version-file: "pyproject.toml"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
run: uv sync --all-extras --dev

- name: Run tests with coverage
run: |
poetry run coverage run -m django test --settings=tests.test_settings
poetry run coverage report
poetry run coverage xml
uv run coverage run -m django test --settings=tests.test_settings
uv run coverage report
uv run coverage xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,26 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.12
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version-file: "pyproject.toml"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
run: uv sync --all-extras --dev

- name: Generate documentation
run: |
poetry run python docs/scripts/convert_docstrings_to_markdown.py
uv run docs/scripts/convert_docstrings_to_markdown.py

- name: Apply readme.io metadata to markdown files
run: |
poetry run python docs/scripts/apply_metadata_to_markdown.py
uv run docs/scripts/apply_metadata_to_markdown.py

- name: Publish documentation to readme.io
uses: readmeio/rdme@v8
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,25 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.12
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version-file: "pyproject.toml"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
run: uv sync --all-extras --dev

- name: Run tests with coverage
run: |
poetry run coverage run -m django test --settings=tests.test_settings
poetry run coverage report --fail-under=100
uv run coverage run -m django test --settings=tests.test_settings
uv run coverage report --fail-under=100

- name: Build and publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: Build and publish package
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
uv build
uv publish --token ${{ secrets.PYPI_TOKEN }}
21 changes: 13 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,26 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage[toml]
pip install django==${{ matrix.django-version }}
pip install django-ninja==${{ matrix.django-ninja-version }}
pip install django-rest-testing==${{ matrix.django-rest-testing }}
pip install packaging
uv venv
uv pip install coverage[toml]
uv pip install django==${{ matrix.django-version }}
uv pip install django-ninja==${{ matrix.django-ninja-version }}
uv pip install django-rest-testing==${{ matrix.django-rest-testing }}
uv pip install -e .

- name: Run tests with coverage
run: |
python -m coverage run -m django test --settings=tests.test_settings
python -m coverage report --fail-under=100
uv run --no-project coverage run -m django test --settings=tests.test_settings
uv run --no-project coverage report --fail-under=100
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ poetry.lock
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# uv
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
uv.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Django Ninja CRUD
[![Tests](https://github.com/hbakri/django-ninja-crud/actions/workflows/tests.yml/badge.svg)](https://github.com/hbakri/django-ninja-crud/actions)
[![Coverage](https://img.shields.io/codecov/c/github/hbakri/django-ninja-crud/main.svg?label=coverage&logo=codecov&logoColor=white)](https://codecov.io/gh/hbakri/django-ninja-crud)
[![PyPI Version](https://img.shields.io/pypi/v/django-ninja-crud?color=g&logo=pypi&logoColor=white)](https://pypi.org/project/django-ninja-crud/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/django-ninja-crud?logo=esri&logoColor=white)](https://pypistats.org/packages/django-ninja-crud)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/hbakri/django-ninja-crud/blob/main/LICENSE)
[![MyPy](https://img.shields.io/badge/mypy-checked-blue.svg)](https://github.com/python/mypy)
[![PyPI - Version](https://img.shields.io/pypi/v/django-ninja-crud?color=g&logo=pypi&logoColor=white)](https://pypi.org/project/django-ninja-crud/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/django-ninja-crud?logo=esri&logoColor=white)](https://pypistats.org/packages/django-ninja-crud)
[![PyPI - License](https://img.shields.io/pypi/l/django-ninja-crud)](https://github.com/hbakri/django-ninja-crud/blob/main/LICENSE)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

![Django Ninja CRUD Cover](https://raw.githubusercontent.com/hbakri/django-ninja-crud/main/docs/assets/images/django-ninja-crud-cover.JPG)
Expand Down
2 changes: 1 addition & 1 deletion docs/config/docstring-to-markdown-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ modules:
output_path: "viewsets/APIViewSet.md"

settings:
project_root: ninja_crud
project_root: src/ninja_crud
markdown_root: docs/reference
2 changes: 1 addition & 1 deletion docs/scripts/convert_docstrings_to_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def convert_docstrings_to_markdown(
absolute_input_path = os.path.join(os.getcwd(), input_path)
subprocess.run(
[
"poetry",
"uv",
"run",
"pydoc-markdown",
"-m",
Expand Down
51 changes: 30 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,51 +1,60 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry]
[tool.hatch.build.targets.wheel]
packages = ["src/ninja_crud"]

[project]
name = "django-ninja-crud"
version = "0.6.2"
description = "🧩 Modular, composable API views for scalable Django Ninja projects, with built-in CRUD."
authors = ["Hicham Bakri <[email protected]>"]
maintainers = ["Hicham Bakri <[email protected]>"]
readme = "README.md"
homepage = "https://github.com/hbakri/django-ninja-crud"
repository = "https://github.com/hbakri/django-ninja-crud"
license = "MIT"
requires-python = ">=3.8"
license = {file = "LICENSE"}
authors = [{name = "Hicham Bakri", email = "[email protected]"}]
maintainers = [{name = "Hicham Bakri", email = "[email protected]"}]
keywords = ["django", "ninja", "crud", "api", "rest", "framework", "asyncio", "async"]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Development Status :: 4 - Beta",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Testing",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: AsyncIO",
"Framework :: Pydantic",
"Typing :: Typed",
]
packages = [{ include = "ninja_crud" },]
dependencies = [
"django>=4.2",
"django-ninja>=1.0",
]

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
django = ">=4.2"
django-ninja = ">=1.0"
[project.urls]
Homepage = "https://github.com/hbakri/django-ninja-crud"
Repository = "https://github.com/hbakri/django-ninja-crud"
Documentation = "https://django-ninja-crud.readme.io"

[tool.poetry.group.dev.dependencies]
coverage = "^7.6.0"
pre-commit = "^3.5.0"
pydoc-markdown = "^4.8.2"
pyyaml = "^6.0.1"
python-frontmatter = "^1.1.0"
django-rest-testing = "^0.1.0"
[tool.uv]
dev-dependencies = [
"coverage>=7.6.0,<8.0",
"pre-commit>=3.5.0,<4.0",
"pydoc-markdown>=4.8.2,<5.0",
"pyyaml>=6.0.1,<7.0",
"python-frontmatter>=1.1.0,<2.0",
"django-rest-testing>=0.1.0,<0.2",
]

[tool.coverage.report]
exclude_also = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.