Skip to content

Commit 1929ac8

Browse files
salman2013claude
andcommitted
refactor: migrate to src layout
- Move code_annotations/ to src/code_annotations/ - Add where = ["src"] to [tool.setuptools.packages.find] - Update tox.ini quality commands to src/code_annotations paths - Update docs/conf.py sphinx-apidoc path to src/code_annotations - Update coverage omit path in pyproject.toml - Rewrite Makefile to use direct uv run --group commands (no tox) - Regenerate uv.lock Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 94dd984 commit 1929ac8

37 files changed

Lines changed: 36 additions & 16 deletions

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,32 @@ coverage: clean ## generate and view HTML coverage report
3434
$(BROWSER) htmlcov/index.html
3535

3636
docs: ## generate Sphinx HTML documentation, including API docs
37-
uv run tox -e docs
37+
uv run --group doc doc8 --ignore-path docs/_build README.rst docs
38+
uv run --group doc sphinx-build -b html docs docs/_build/html
3839
$(BROWSER) docs/_build/html/index.html
3940

4041
upgrade: ## update uv.lock and regenerate uv constraint-dependencies
41-
uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
42+
uv run --group quality edx_lint write_uv_constraints pyproject.toml
4243
uv lock --upgrade
4344

4445
quality: ## check coding style with pycodestyle and pylint
45-
uv run tox -e quality
46+
uv run --group quality pylint src/code_annotations tests test_utils
47+
uv run --group quality pycodestyle src/code_annotations tests
48+
uv run --group quality pydocstyle src/code_annotations tests
49+
uv run --group quality isort --check-only --diff tests test_utils src/code_annotations
4650

4751
requirements: ## install development environment requirements
4852
uv sync --group dev
4953

5054
test: clean ## run tests in the current virtualenv
51-
uv run pytest
55+
uv run --group test python -Wd -m pytest
5256

5357
diff_cover: test ## find diff lines that need test coverage
5458
diff-cover coverage.xml
5559

56-
test-all: ## run tests on every supported Python
57-
uv run tox
60+
test-all: ## run tests on every supported Django version
61+
uv run --group django42 python -Wd -m pytest
62+
uv run --group test python -Wd -m pytest
5863

5964
validate: quality test ## run tests and quality checks
6065

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,8 @@ def on_init(app): # pylint: disable=unused-argument
502502
# If we are, assemble the path manually
503503
bin_path = os.path.abspath(os.path.join(sys.prefix, 'bin'))
504504
apidoc_path = os.path.join(bin_path, apidoc_path)
505-
check_call([apidoc_path, '-o', docs_path, os.path.join(root_path, 'code_annotations'),
506-
os.path.join(root_path, 'code_annotations/migrations')])
505+
check_call([apidoc_path, '-o', docs_path, os.path.join(root_path, 'src', 'code_annotations'),
506+
os.path.join(root_path, 'src', 'code_annotations', 'migrations')])
507507

508508

509509
def setup(app):

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ local_scheme = "no-local-version"
4848
fallback_version = "0.0.0.dev0"
4949

5050
[tool.setuptools.packages.find]
51+
where = ["src"]
5152
include = ["code_annotations*"]
5253

5354
[tool.setuptools.package-data]
@@ -78,10 +79,11 @@ test = [{include-group = "test-base"}, "Django>=5.2,<5.3"]
7879
django42 = [{include-group = "test-base"}, "Django>=4.2,<4.3"]
7980
quality = [
8081
{include-group = "test"},
81-
"edx-lint",
82+
"edx-lint<6",
8283
"isort",
8384
"pycodestyle",
8485
"pydocstyle",
86+
"setuptools<81",
8587
]
8688
doc = [
8789
{include-group = "test"},
@@ -122,7 +124,7 @@ branch = true
122124
source = ["code_annotations"]
123125
omit = [
124126
"test_settings",
125-
"code_annotations/extensions/tests/python_test_files/*",
127+
"src/code_annotations/extensions/tests/python_test_files/*",
126128
]
127129

128130
[tool.coverage.report]
File renamed without changes.

code_annotations/contrib/config/feature_toggle_annotations.yaml renamed to src/code_annotations/contrib/config/feature_toggle_annotations.yaml

File renamed without changes.

0 commit comments

Comments
 (0)