Skip to content
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
18 changes: 0 additions & 18 deletions .coveragerc

This file was deleted.

15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ['3.12']
toxenv: ["django52", "quality", "pii_check"]
toxenv: ["django42", "django52", "quality", "pii_check", "docs"]

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: setup python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0

- name: Install uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

Comment thread
irfanuddinahmad marked this conversation as resolved.
- name: Install pip
run: pip install -r requirements/pip.txt

- name: Install Dependencies
run: pip install -r requirements/ci.txt
run: uv sync --group ci

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox
run: uv run tox

- name: Run coverage
if: matrix.python-version == '3.12' && matrix.toxenv == 'django52'
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/pypi-publish.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ diff_*.html
*.report
report
venv
.venv
acceptance_tests.*.log
acceptance_tests.*.png

Expand Down
19 changes: 11 additions & 8 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

python:
version: 3.8
install:
- requirements: requirements/doc.txt
# uv isn't natively supported by Read the Docs, so drive the whole build
# ourselves via a custom command (RTD's documented escape hatch for tools
# it doesn't integrate with directly).
build:
os: ubuntu-lts-latest
tools:
python: "3.12"
commands:
- pip install uv
- uv sync --group doc
- uv run sphinx-build -b html docs/ $READTHEDOCS_OUTPUT/html
57 changes: 14 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DEFAULT_GOAL := help

.PHONY: help clean requirements ci_requirements dev_requirements \
.PHONY: help clean compile-requirements requirements ci_requirements dev_requirements \
validation_requirements doc_requirements production-requirements static shell \
test coverage isort_check isort style lint quality pii_check validate \
migrate html_coverage upgrade extract_translation dummy_translations \
Expand Down Expand Up @@ -33,24 +33,24 @@ clean: ## delete generated byte code and coverage reports
rm -rf pii_report
rm -rf reserved_keywords_report

compile-requirements: ## generate the uv.lock file without upgrading packages
uv lock

requirements: dev_requirements ## sync to default requirements

ci_requirements: validation_requirements ## sync to requirements needed for CI checks

pip_requirements: ## install pip-sync
pip install -r requirements/pip-tools.txt -c requirements/constraints.txt

dev_requirements: pip_requirements ## sync to requirements for local development
pip-sync -q requirements/dev.txt requirements/private.* requirements/test.txt
dev_requirements: ## sync to requirements for local development
uv sync --group dev

validation_requirements: pip_requirements ## sync to requirements for testing & code quality checking
pip-sync -q requirements/validation.txt
validation_requirements: ## sync to requirements for testing & code quality checking
uv sync --group quality
Comment thread
irfanuddinahmad marked this conversation as resolved.

doc_requirements:
pip-sync -q requirements/doc.txt
uv sync --group doc

production-requirements: pip_requirements ## install requirements for production
pip-sync -q requirements/production.txt
production-requirements: ## install requirements for production
uv sync --group production

static: ## generate static files
python manage.py collectstatic --noinput
Expand Down Expand Up @@ -99,38 +99,9 @@ migrate: ## apply database migrations
html_coverage: ## generate and view HTML coverage report
coverage html && open htmlcov/index.html

# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS)

define COMMON_CONSTRAINTS_TEMP_COMMENT
# This is a temporary solution to override the real common_constraints.txt\n# In edx-lint, until the pyjwt constraint in edx-lint has been removed.\n# See BOM-2721 for more details.\n# Below is the copied and edited version of common_constraints\n
endef

COMMON_CONSTRAINTS_TXT=requirements/common_constraints.txt
.PHONY: $(COMMON_CONSTRAINTS_TXT)
$(COMMON_CONSTRAINTS_TXT):
wget -O "$(@)" https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt || touch "$(@)"
echo "$(COMMON_CONSTRAINTS_TEMP_COMMENT)" | cat - $(@) > temp && mv temp $(@)

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt -c requirements/constraints.txt
# Make sure to compile files after any other files they include!
$(PIP_COMPILE) --allow-unsafe -o requirements/pip.txt requirements/pip.in
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
$(PIP_COMPILE) -o requirements/base.txt requirements/base.in
$(PIP_COMPILE) -o requirements/test.txt requirements/test.in
$(PIP_COMPILE) -o requirements/doc.txt requirements/doc.in
$(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in
$(PIP_COMPILE) -o requirements/validation.txt requirements/validation.in
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in
$(PIP_COMPILE) -o requirements/production.txt requirements/production.in
# Let tox control the Django version for tests
sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp
mv requirements/test.tmp requirements/test.txt
upgrade: ## upgrade all packages in uv.lock and sync constraints from edx-lint
uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
uv lock --upgrade

extract_translations: ## extract strings to be translated, outputting .mo files
python manage.py makemessages -l en -v1 -d django
Expand Down
18 changes: 9 additions & 9 deletions docs/architecture_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The enterprise-subsidy service operates within a microservices ecosystem. Here's
│ Contracts) │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
(manual link) ▼-----------------------
(manual link) ▼-----------------------
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Enterprise │ │ Enterprise │ │ LMS │
│ Subsidy │◄──►│ Access │◄──►│ (edxapp and │
Expand All @@ -65,9 +65,9 @@ Key Service Interactions
4. **Discovery Service**: Source of truth for content pricing and metadata
5. **Event Bus (Kafka)**: Enables event-driven communication between services

**********************
************************
Application Architecture
**********************
************************

Django Application Structure
=============================
Expand Down Expand Up @@ -202,7 +202,7 @@ Here's a simplified look at how learner credit redemption flows through the syst
│ │ │ │ • Create Ledger │
│ │ │ │ Transaction │
│ │ │ │ • Fulfill Enrollment
│ │ │ │ • Emit Events
│ │ │ │ • Emit Events
│ │ │ └─────────────────┬─-
│ │ │ │
│ │ 10. Transaction │ │
Expand All @@ -223,7 +223,7 @@ The service implements a comprehensive REST API using Django REST Framework (DRF
.. code-block:: text

API Layer Architecture:

┌─────────────────────────────────────────────────────────────────┐
│ HTTP Request Layer │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
Expand Down Expand Up @@ -308,7 +308,7 @@ Serializer Architecture
.. code-block:: python

current_balance = serializers.SerializerMethodField()

@extend_schema_field(serializers.IntegerField)
def get_current_balance(self, obj) -> int:
return obj.current_balance()
Expand Down Expand Up @@ -448,7 +448,7 @@ The service participates in an event-driven ecosystem using Kafka:
.. code-block:: text

Event Flow:

┌─────────────────┐ ┌─────────────────┐
│ Enterprise │ Enrollment │ Event │
│ Subsidy │ Lifecycle │ Bus │
Expand Down Expand Up @@ -560,13 +560,13 @@ Uses ``edx-rbac`` for fine-grained permissions:
.. code-block:: text

Role Hierarchy:

System Roles (Cross-Enterprise):
├── SYSTEM_ENTERPRISE_ADMIN_ROLE
├── SYSTEM_ENTERPRISE_CATALOG_ADMIN_ROLE
├── SYSTEM_ENTERPRISE_LEARNER_ROLE
└── SYSTEM_ENTERPRISE_OPERATOR_ROLE

Enterprise-Specific Roles:
├── ENTERPRISE_SUBSIDY_ADMIN_ROLE
├── ENTERPRISE_SUBSIDY_LEARNER_ROLE
Expand Down
3 changes: 3 additions & 0 deletions enterprise_subsidy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""
enterprise-subsidy module.
"""
# This repo is a deployed service (pyproject.toml's [tool.uv] package = false),
# not an installed package, so importlib.metadata.version() has nothing to look
# up here. Bump this alongside pyproject.toml's version on release.
__version__ = '1.0.1'
Comment thread
irfanuddinahmad marked this conversation as resolved.
4 changes: 1 addition & 3 deletions enterprise_subsidy/apps/core/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

from django.test import TestCase

from enterprise_subsidy import __version__ as code_version

from ..utils import versioned_cache_key
from ..utils import code_version, versioned_cache_key


class TestUtils(TestCase):
Expand Down
Loading
Loading