Skip to content

Commit bcf30c6

Browse files
authored
deps: generate and commit requirements.txt (bug 1971461) (#79)
1 parent a2bec59 commit bcf30c6

File tree

5 files changed

+602
-12
lines changed

5 files changed

+602
-12
lines changed

Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,8 @@ COPY install_git-cinnabar.sh .
2222
RUN ./install_git-cinnabar.sh \
2323
&& mv git-cinnabar git-remote-hg /usr/bin/
2424

25-
# install test dependencies
26-
RUN pip install -U pip pytest pytest-mock pip-tools
27-
28-
# setup just the venv so changes to the source won't require a full venv
29-
# rebuild
30-
COPY --chown=app:app README.md .
31-
COPY --chown=app:app pyproject.toml .
32-
RUN pip-compile --verbose pyproject.toml \
33-
&& pip install -r requirements.txt
25+
COPY --chown=app:app requirements.txt .
26+
RUN pip install -r requirements.txt
3427

3528
RUN mkdir -p /clones \
3629
&& chown app:app /clones
@@ -39,6 +32,7 @@ RUN mkdir -p /clones \
3932
COPY docker/hgrc /etc/mercurial/hgrc
4033
COPY docker/entrypoint.sh /entrypoint.sh
4134
COPY --chown=app:app . /app
35+
4236
# Make the install editable so we can mount the local source into a container based on this image.
4337
RUN pip install -e /app
4438
USER app

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ $ docker compose run --rm test
172172
$ docker compose down
173173
```
174174

175+
## Update requirements
176+
177+
```console
178+
$ docker compose run --rm pip-compile
179+
```
180+
175181
## Known limitations
176182

177183
- Merge commits cannot be pushed to mercurial repositories;

docker-compose.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ services:
5656
networks:
5757
- pulse_network
5858

59+
pip-compile:
60+
<<: *sync_config
61+
command: ["--verbose", "--all-build-deps", "--allow-unsafe", "--extra=dev", "--generate-hashes", "--output-file=requirements.txt", "pyproject.toml"]
62+
entrypoint: pip-compile
63+
volumes:
64+
- .:/app
65+
profiles:
66+
- pip-compile
67+
5968
pulse:
6069
image: rabbitmq:3-management-alpine
6170
volumes:

pyproject.toml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ dependencies = [
1515
"mozillapulse",
1616
"mozlog",
1717
"pydantic",
18-
"pytest>=8.3.4",
19-
"pytest-ruff",
20-
"pytest-cov",
2118
"sentry_sdk",
2219
"devtools",
2320
]
2421

22+
[project.optional-dependencies]
23+
dev = [
24+
# Pin due to https://github.com/jazzband/pip-tools/issues/2319,
25+
# otherwise pip-compile doesn't work in the container.
26+
"pip<26.0",
27+
28+
"pip-tools",
29+
"pytest>=8.3.4",
30+
"pytest-cov",
31+
"pytest-mock",
32+
"pytest-ruff",
33+
]
34+
2535
[project.scripts]
2636
git-hg-sync = "git_hg_sync.__main__:main"
2737
git-hg-cli = "git_hg_sync.cli:main"

0 commit comments

Comments
 (0)