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

build!: switch from using extras to dependency groups #330

Merged
merged 4 commits into from
Jan 28, 2025
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- [ ] Have you followed the guidelines for contributing?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `tox`?
- [ ] Have you successfully run `make lint && make test`?

---
16 changes: 9 additions & 7 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ build:
os: ubuntu-24.04
tools:
python: "3.12"

python:
install:
- method: pip
path: .
extra_requirements:
- docs
jobs:
post_system_dependencies:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
create_environment:
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
install:
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs
14 changes: 7 additions & 7 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ help: ## Show this help.

.PHONY: setup
setup: install-uv setup-precommit ## Set up a development environment
uv sync --all-extras
uv sync --all-groups

.PHONY: setup-tests
setup-tests: install-uv install-build-deps ##- Set up a testing environment without linters
uv sync

.PHONY: setup-lint
setup-lint: install-uv install-shellcheck install-pyright install-lint-build-deps ##- Set up a linting-only environment
uv sync --no-install-workspace --extra lint --extra types
uv sync --no-install-workspace --group lint --group types

.PHONY: setup-docs
setup-docs: install-uv ##- Set up a documentation-only environment
uv sync --no-dev --no-install-workspace --extra docs
uv sync --no-dev --group docs

.PHONY: setup-precommit
setup-precommit: install-uv ##- Set up pre-commit hooks in this repository.
Expand Down Expand Up @@ -105,7 +105,7 @@ ifneq ($(CI),)
endif

.PHONY: lint-codespell
lint-codespell: ##- Check spelling with codespell
lint-codespell: install-codespell ##- Check spelling with codespell
ifneq ($(CI),)
@echo ::group::$@
endif
Expand Down Expand Up @@ -163,7 +163,7 @@ lint-docs: ##- Lint the documentation
ifneq ($(CI),)
@echo ::group::$@
endif
uv run --extra docs sphinx-lint --max-line-length 88 --ignore docs/reference/commands --ignore docs/_build --enable all $(DOCS)
uv run --group docs sphinx-lint --max-line-length 88 --ignore docs/reference/commands --ignore docs/_build --enable all $(DOCS)
ifneq ($(CI),)
@echo ::endgroup::
endif
Expand Down Expand Up @@ -199,11 +199,11 @@ test-coverage: ## Generate coverage report

.PHONY: docs
docs: ## Build documentation
uv run --extra docs sphinx-build -b html -W $(DOCS) $(DOCS)/_build
uv run --group docs sphinx-build -b html -W $(DOCS) $(DOCS)/_build

.PHONY: docs-auto
docs-auto: ## Build and host docs with sphinx-autobuild
uv run --extra docs sphinx-autobuild -b html --open-browser --port=8080 --watch $(PROJECT) -W $(DOCS) $(DOCS)/_build
uv run --group docs sphinx-autobuild -b html --open-browser --port=8080 --watch $(PROJECT) -W $(DOCS) $(DOCS)/_build

.PHONY: pack-pip
pack-pip: ##- Build packages for pip (sdist, wheel)
Expand Down
26 changes: 13 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requires-python = ">=3.10"
[project.scripts]
starcraft-hello = "starcraft:hello"

[project.optional-dependencies]
[dependency-groups]
lint = [
"yamllint~=1.34",
]
Expand All @@ -34,11 +34,21 @@ docs = [
"sphinx-toolbox~=3.5",
"sphinx-lint==1.0.0",
]
dev = [
"build>=0.7.0",
"coverage[toml]~=7.4",
"pytest~=8.0",
"pytest-cov~=6.0",
"pytest-mock~=3.12",
"mypy[reports]~=1.14.1",
"types-Pygments",
"types-colorama",
"types-setuptools",
]

[tool.uv]
constraint-dependencies = [
# Basic constraints to allow --resolution=lowest
"build>=0.7.0",
"cffi>=1.15",
"iniconfig>=1.1.0",
"httplib2>=0.20.0",
Expand All @@ -61,17 +71,7 @@ constraint-dependencies = [
"webencodings>=0.4.0",
"wheel>=0.38",
]
dev-dependencies = [
"build",
"coverage[toml]~=7.4",
"pytest~=8.0",
"pytest-cov~=6.0",
"pytest-mock~=3.12",
"mypy[reports]~=1.14.1",
"types-Pygments",
"types-colorama",
"types-setuptools",
]


[build-system]
requires = [
Expand Down
82 changes: 29 additions & 53 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading