Skip to content

Commit cc67e1c

Browse files
authored
Update to modern Python package configuration (#2695)
1 parent b9dd29c commit cc67e1c

File tree

9 files changed

+1472
-61
lines changed

9 files changed

+1472
-61
lines changed

.taskcluster.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ tasks:
4848
- "git clone --quiet ${repository} bugbot &&
4949
cd bugbot &&
5050
git -c advice.detachedHead=false checkout ${head_rev} &&
51-
pip install --quiet -r requirements-test.txt &&
51+
pip install --quiet -e '.[test]' &&
5252
pre-commit run --all-files --show-diff-on-failure &&
5353
tox -e $TOX_ENV &&
5454
coveralls"

README.rst

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ The tool will also notify release managers about potential issues in bugzilla an
1111
The list of checkers is documented on the Mozilla wiki:
1212
https://wiki.mozilla.org/BugBot
1313

14-
1514
This package currently uses Mozilla's `Bugzilla REST API <https://wiki.mozilla.org/Bugzilla:REST_API>`_, and the Mozilla IAM `phonebook <https://github.com/mozilla-iam/cis/blob/master/docs/PersonAPI.md>`_ (to access bug assignees' managers & Mozilla email addresses).
1615

1716

@@ -22,27 +21,16 @@ Installation
2221

2322
git clone https://github.com/mozilla/bugbot.git
2423

25-
#. (optional) Create your virtualenv using virtualenvwrapper::
26-
27-
virtualenv -p python3 venv
28-
source venv/bin/activate
29-
30-
#. Install the dependencies for Python 3 too::
31-
32-
pip install -r requirements.txt
24+
bugbot uses `uv <https://docs.astral.sh/uv/>`_ to manage the Python environment; this must be installed locally.
3325

3426
Auto-formatting with pre-commit
3527
-------------------------------
3628

3729
This project uses `pre-commit <https://pre-commit.com/>`_.
3830

39-
#. Install test dependencies, if not already installed::
31+
#. Install pre-commit::
4032

41-
pip install -r requirements-test.txt
42-
43-
#. Set up the git pre-commit hooks in your clone::
44-
45-
pre-commit install
33+
uv tool install pre-commit
4634

4735
Every time you try to commit, pre-commit checks your files to ensure they follow our style standards and aren't affected by some simple issues. If the checks fail, pre-commit won't let you commit.
4836

@@ -74,7 +62,8 @@ Before running:
7462
}
7563
7664
Do a dryrun::
77-
python -m bugbot.rules.stalled
65+
66+
uv run -m bugbot.rules.stalled
7867

7968
There is a ton of rules in bugbot/rules/ so you should be able to find some good examples.
8069

pyproject.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,66 @@
1+
[project]
2+
name = "bugbot"
3+
description = "Bugzilla management bot"
4+
authors = [
5+
{name = "Mozilla Corporation"}
6+
]
7+
version = "0.1.0"
8+
requires-python = ">=3.10"
9+
readme = "README.rst"
10+
license = "BSD-3-clause"
11+
dependencies = [
12+
"alembic==1.14.1",
13+
"argparse==1.4.0",
14+
"filelock==3.18.0",
15+
"google-cloud-bigquery==3.34.0",
16+
"gspread==6.2.1",
17+
"humanize>=0.5.1",
18+
"icalendar==6.3.1",
19+
"Jinja2==3.1.6",
20+
"libmozdata==0.2.10",
21+
"numpy==2.2.4",
22+
"pep8==1.7.1",
23+
"pyflakes==3.4.0",
24+
"python-dateutil>=2.8.2",
25+
"python-Levenshtein>=0.12.0",
26+
"pytz>=2018.9",
27+
"PyYAML==6.0.2",
28+
"recurring-ical-events==3.8.0",
29+
"requests==2.32.4",
30+
"sqlalchemy==1.3.24",
31+
"tenacity==9.1.2",
32+
"whatthepatch>=0.0.5"
33+
]
34+
35+
[project.optional-dependencies]
36+
dev = [
37+
"coverage==7.9.1",
38+
"mock==5.2.0",
39+
"responses==0.25.7"
40+
]
41+
42+
test = [
43+
"coveralls==4.0.1",
44+
"pre-commit==4.2.0",
45+
"tox==4.27.0"
46+
]
47+
48+
[tool.setuptools]
49+
packages = ["bugbot"]
50+
51+
[tool.tox]
52+
envlist = ["py310", "py311", "py312", "py313"]
53+
skipsdist = true
54+
55+
[tool.tox.env_run_base]
56+
setenv = { PYTHONDONTWRITEBYTECODE = "1", PYTHONPATH = "{toxinidir}/vendor/lib/python" }
57+
deps = [".[dev]"]
58+
commands = [
59+
["alembic", "upgrade", "head"],
60+
["coverage", "erase"],
61+
["coverage", "run", "--branch", "--source", "{toxinidir}/bugbot", "-m", "unittest", "-v", { replace="posargs", extend = true }]
62+
]
63+
164
[tool.djlint]
265
profile="jinja"
366
linter_output_format = "{filename}:{line}: {code} {message} {match}"

requirements-dev.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

requirements-test.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

scripts/cron_common_start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trap ErrorHandler ERR
2525
. venv/bin/activate
2626

2727
# force the update of dependencies
28-
pip install -r requirements.txt
28+
uv sync --locked --no-dev
2929

3030
# Clean the log files
3131
python -m bugbot.log --clean

tox.ini

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)