Skip to content

Commit 0fd4176

Browse files
committed
use uv
1 parent cb621cb commit 0fd4176

File tree

4 files changed

+20
-275
lines changed

4 files changed

+20
-275
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,19 @@ jobs:
4949
with:
5050
python-version: ${{ matrix.python-version }}
5151

52-
- name: Install Hatch
53-
run: pip install --upgrade hatch hatch-pip-compile
52+
- name: Install uv
53+
uses: astral-sh/setup-uv@v5
5454

55-
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
56-
name: Lint
57-
run: hatch run lint:check
55+
- name: Intall dependencies
56+
run: uv sync --frozen
5857

5958
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
6059
name: Run tests with coverage tracking
61-
run: hatch run +py=${{ matrix.python-version }} test:cov --cdist-group=${{ matrix.cdist-group }}/4 --cdist-justify-items=file
60+
run: uv run pytest --cdist-group=${{ matrix.cdist-group }}/4 --cdist-justify-items=file
6261

6362
- if: matrix.python-version != '3.12' || runner.os != 'Linux'
6463
name: Run tests without tracking coverage
65-
run: hatch run +py=${{ matrix.python-version }} test:no-cov --cdist-group=${{ matrix.cdist-group }}/4 --cdist-justify-items=file
64+
run: uv run pytest --cdist-group=${{ matrix.cdist-group }}/4 --cdist-justify-items=file
6665

6766
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
6867
uses: actions/upload-artifact@v4
@@ -127,11 +126,11 @@ jobs:
127126
with:
128127
python-version: "3.11"
129128

130-
- name: Install Hatch
131-
run: pip install --upgrade hatch hatch-containers hatch-pip-compile
129+
- name: Install uv
130+
uses: astral-sh/setup-uv@v5
132131

133132
- name: Build docs
134-
run: hatch run docs:build
133+
run: uv run sphinx-build -M html docs docs/_build/ -E -a -j auto --keep-going
135134

136135
- name: Save PR number
137136
env:

.github/workflows/docs.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
- name: Set up Python 3.12
19+
- name: Set up Python 3.11
2020
uses: actions/setup-python@v5
2121
with:
2222
python-version: 3.11
2323

24-
- name: Install Hatch
25-
run: pip install --upgrade hatch hatch-pip-compile
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v5
2626

2727
- name: Build release docs
28-
run: hatch run docs:python scripts/build_docs.py docs-build
2928
if: github.event_name == 'release'
29+
run: uv run scripts/build_docs.py docs-build
3030

3131
- name: Build dev docs
32-
run: hatch run docs:python scripts/build_docs.py docs-build
3332
if: github.event_name == 'push'
33+
run: uv run scripts/build_docs.py docs-build
3434

3535
- name: Deploy
3636
uses: JamesIves/github-pages-deploy-action@v4

pyproject.toml

Lines changed: 5 additions & 259 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description = 'Reusable database fixtures for any and all databases.'
1111
license = "MIT"
1212
name = "pytest-databases"
1313
readme = "README.md"
14-
requires-python = ">=3.8"
14+
requires-python = ">=3.9"
1515
version = "0.10.0"
1616
#
1717
authors = [{ name = "Cody Fincher", email = "[email protected]" }]
@@ -36,7 +36,6 @@ keywords = [
3636
classifiers = [
3737
"Development Status :: 4 - Beta",
3838
"Programming Language :: Python",
39-
"Programming Language :: Python :: 3.8",
4039
"Programming Language :: Python :: 3.9",
4140
"Programming Language :: Python :: 3.10",
4241
"Programming Language :: Python :: 3.11",
@@ -69,64 +68,10 @@ redis = ["redis"]
6968
spanner = ["google-cloud-spanner"]
7069

7170

72-
######################
73-
# Build & Versioning #
74-
######################
75-
[tool.hatch.build.targets.sdist]
76-
exclude = ["/.github", "/docs"]
77-
78-
[tool.hatch.metadata]
79-
allow-direct-references = true
80-
81-
#####################
82-
# Environment Setup #
83-
#####################
84-
85-
86-
# Default environment with production dependencies
87-
[tool.hatch.envs.default]
88-
extra-dependencies = [
89-
# tests
90-
"coverage[toml]>=6.2",
91-
"coverage[toml]>=6.2",
92-
"pytest",
93-
"pytest-cov",
94-
"pytest-mock",
95-
"pytest-vcr",
96-
"pytest-click",
97-
"pytest-xdist",
98-
"pytest-sugar",
99-
# lint
100-
"mypy",
101-
"ruff",
102-
"pylint",
103-
"pre-commit",
104-
"types-click",
105-
"types-six",
106-
"types-decorator",
107-
"types-pyyaml",
108-
"types-docutils",
109-
"types-redis",
110-
"types-pymysql",
111-
# docs
112-
"sphinx>=7.1.2",
113-
"sphinx-autobuild>=2021.3.14",
114-
"sphinx-copybutton>=0.5.2",
115-
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
116-
"sphinx-click>=5.0.1",
117-
"sphinx-toolbox>=3.5.0",
118-
"sphinx-design>=0.5.0",
119-
"sphinxcontrib-mermaid>=0.9.2",
120-
"auto-pytabs[sphinx]>=0.4.0",
121-
]
122-
installer = "uv"
123-
python = "3.12"
124-
125-
126-
# Test environment with test-only dependencies
127-
[tool.hatch.envs.test]
128-
extra-dependencies = [
71+
[dependency-groups]
72+
dev = [
12973
# tests
74+
"pytest-databases[azure-storage,bigquery,cockroachdb,dragonfly,elasticsearch7,elasticsearch8,keydb,mssql,mysql,oracle,postgres,redis,spanner]",
13075
"coverage[toml]>=6.2",
13176
"coverage[toml]>=6.2",
13277
"pytest",
@@ -159,205 +104,6 @@ extra-dependencies = [
159104
"auto-pytabs[sphinx]>=0.4.0",
160105
"pytest-cdist>=0.2",
161106
]
162-
features = [
163-
"oracle",
164-
"mysql",
165-
"mssql",
166-
"postgres",
167-
"spanner",
168-
"cockroachdb",
169-
"spanner",
170-
"redis",
171-
"elasticsearch7",
172-
"elasticsearch8",
173-
"bigquery",
174-
"azure-storage",
175-
]
176-
template = "default"
177-
type = "virtual"
178-
179-
[tool.hatch.envs.test.env-vars]
180-
PYTHONPATH = ".:src/"
181-
PYTHONUNBUFFERED = "1"
182-
SOURCE_DATE_EPOCH = "1580601600"
183-
184-
# Test matrix for various Python versions replacing the functionality of tox
185-
[[tool.hatch.envs.test.matrix]]
186-
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
187-
188-
[tool.hatch.envs.test.scripts]
189-
cov = "pytest --cov=pytest_databases --cov-report=xml"
190-
debug = "cov --no-cov -s --pdb --pdbcls=IPython.core.debugger:Pdb"
191-
no-cov = "cov --no-cov"
192-
193-
194-
# Docs environment
195-
[tool.hatch.envs.docs]
196-
extra-dependencies = [
197-
# tests
198-
"coverage[toml]>=6.2",
199-
"coverage[toml]>=6.2",
200-
"pytest",
201-
"pytest-cov",
202-
"pytest-mock",
203-
"pytest-vcr",
204-
"pytest-click",
205-
"pytest-xdist",
206-
# lint
207-
"mypy",
208-
"ruff",
209-
"pylint",
210-
"pre-commit",
211-
"types-click",
212-
"types-six",
213-
"types-decorator",
214-
"types-pyyaml",
215-
"types-docutils",
216-
"types-redis",
217-
"types-pymysql",
218-
# docs
219-
"sphinx>=7.1.2",
220-
"sphinx-autobuild>=2021.3.14",
221-
"sphinx-copybutton>=0.5.2",
222-
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
223-
"sphinx-click>=5.0.1",
224-
"sphinx-toolbox>=3.5.0",
225-
"sphinx-design>=0.5.0",
226-
"sphinxcontrib-mermaid>=0.9.2",
227-
"auto-pytabs[sphinx]>=0.4.0",
228-
]
229-
features = [
230-
"oracle",
231-
"mysql",
232-
"mssql",
233-
"postgres",
234-
"spanner",
235-
"cockroachdb",
236-
"spanner",
237-
"redis",
238-
"elasticsearch7",
239-
"elasticsearch8",
240-
"bigquery",
241-
"azure-storage",
242-
]
243-
python = "3.11"
244-
template = "default"
245-
type = "virtual"
246-
247-
[tool.hatch.envs.docs.env-vars]
248-
PYTHONPATH = "."
249-
PYTHONUNBUFFERED = "1"
250-
SOURCE_DATE_EPOCH = "1580601600"
251-
[tool.hatch.envs.docs.scripts]
252-
build = "sphinx-build -M html docs docs/_build/ -E -a -j auto --keep-going"
253-
serve = "sphinx-autobuild docs docs/_build/ -j auto --watch pytest_databases --watch docs --watch tests --watch CONTRIBUTING.rst --port 8002 {args}"
254-
# --ignore-url=None since the SUMMARY.md file leaves a <toc>None</toc> in sitemap.xml
255-
validate = "linkchecker --config .linkcheckerrc --ignore-url=/reference --ignore-url=None site"
256-
# https://github.com/linkchecker/linkchecker/issues/678
257-
build-check = ["build", "validate"]
258-
259-
[tool.hatch.envs.local]
260-
extra-dependencies = [
261-
# tests
262-
"coverage[toml]>=6.2",
263-
"coverage[toml]>=6.2",
264-
"pytest",
265-
"pytest-cov",
266-
"pytest-mock",
267-
"pytest-vcr",
268-
"pytest-click",
269-
"pytest-xdist",
270-
# lint
271-
"mypy",
272-
"ruff",
273-
"pylint",
274-
"pre-commit",
275-
"types-click",
276-
"types-six",
277-
"types-decorator",
278-
"types-pyyaml",
279-
"types-docutils",
280-
"types-redis",
281-
"types-pymysql",
282-
# docs
283-
"sphinx>=7.1.2",
284-
"sphinx-autobuild>=2021.3.14",
285-
"sphinx-copybutton>=0.5.2",
286-
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
287-
"sphinx-click>=5.0.1",
288-
"sphinx-toolbox>=3.5.0",
289-
"sphinx-design>=0.5.0",
290-
"sphinxcontrib-mermaid>=0.9.2",
291-
"auto-pytabs[sphinx]>=0.4.0",
292-
]
293-
features = [
294-
"oracle",
295-
"mysql",
296-
"mssql",
297-
"postgres",
298-
"cockroachdb",
299-
"spanner",
300-
"redis",
301-
"elasticsearch7",
302-
"elasticsearch8",
303-
"bigquery",
304-
"azure-storage",
305-
]
306-
path = ".venv/"
307-
python = "3.11"
308-
template = "docs"
309-
type = "virtual"
310-
311-
312-
# Lint environment
313-
[tool.hatch.envs.lint]
314-
extra-dependencies = [
315-
# tests
316-
"coverage[toml]>=6.2",
317-
"coverage[toml]>=6.2",
318-
"pytest",
319-
"pytest-cov",
320-
"pytest-mock",
321-
"pytest-vcr",
322-
"pytest-click",
323-
"pytest-xdist",
324-
# lint
325-
"mypy",
326-
"ruff",
327-
"pylint",
328-
"pre-commit",
329-
"types-click",
330-
"types-six",
331-
"types-decorator",
332-
"types-pyyaml",
333-
"types-docutils",
334-
"types-redis",
335-
"types-pymysql",
336-
# docs
337-
"sphinx>=7.1.2",
338-
"sphinx-autobuild>=2021.3.14",
339-
"sphinx-copybutton>=0.5.2",
340-
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
341-
"sphinx-click>=5.0.1",
342-
"sphinx-toolbox>=3.5.0",
343-
"sphinx-design>=0.5.0",
344-
"sphinxcontrib-mermaid>=0.9.2",
345-
"auto-pytabs[sphinx]>=0.4.0",
346-
]
347-
python = "3.12"
348-
type = "virtual"
349-
350-
[tool.hatch.envs.lint.scripts]
351-
check = ["style", "typing"]
352-
fix = [
353-
"typing",
354-
"ruff format {args:.}",
355-
"ruff check --fix {args:.}",
356-
"style", # feedback on what is not fixable
357-
"pre-commit run --all-files",
358-
]
359-
style = ["echo \"VERSION: `ruff --version`\"", "ruff check {args:.}", "ruff format --check {args:.}"]
360-
typing = ["echo \"VERSION: `mypy --version`\"", "mypy --install-types --non-interactive {args}"]
361107

362108

363109
##################
@@ -691,4 +437,4 @@ exclude_lines = [
691437

692438

693439
[project.entry-points.pytest11]
694-
myproject = "pytest_databases._service"
440+
pytest_databases = "pytest_databases._service"

src/pytest_databases/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ def get_xdist_worker_num() -> int | None:
3434

3535

3636
def get_xdist_worker_count() -> int:
37-
return int(os.getenv("PYTEST_XDIST_WORKER_COUNT", "0"))
37+
return int(os.getenv("PYTEST_XDIST_WORKER_COUNT", "0"))

0 commit comments

Comments
 (0)