Skip to content

Commit 15d8e92

Browse files
authored
Merge pull request #306 from codecrafters-io/andy/fix
[Redis] CC-1750: Fix python Dockerfiles missing pipenv
2 parents c5d133c + c137912 commit 15d8e92

File tree

19 files changed

+226
-11
lines changed

19 files changed

+226
-11
lines changed

compiled_starters/python/.codecrafters/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
set -e # Exit on failure
1010

11-
exec python3 -m app.main "$@"
11+
exec pipenv run python3 -m app.main "$@"

compiled_starters/python/.gitignore

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ ipython_config.py
9494
# install all needed dependencies.
9595
#Pipfile.lock
9696

97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
97103
# poetry
98104
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99105
# This is especially recommended for binary packages to ensure reproducibility, and is more
@@ -106,8 +112,10 @@ ipython_config.py
106112
#pdm.lock
107113
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108114
# in version control.
109-
# https://pdm.fming.dev/#use-with-ide
115+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110116
.pdm.toml
117+
.pdm-python
118+
.pdm-build/
111119

112120
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113121
__pypackages__/
@@ -151,3 +159,16 @@ dmypy.json
151159

152160
# Cython debug symbols
153161
cython_debug/
162+
163+
# PyCharm
164+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166+
# and can be added to the global gitignore or merged into this file. For a more nuclear
167+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168+
.idea/
169+
170+
# Ruff stuff:
171+
.ruff_cache/
172+
173+
# PyPI configuration file
174+
.pypirc

compiled_starters/python/Pipfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
4+
[[source]]
5+
url = "https://pypi.org/simple"
6+
verify_ssl = true
7+
name = "pypi"
8+
9+
[packages]
10+
11+
[dev-packages]
12+
13+
[requires]
14+
python_version = "3"

compiled_starters/python/Pipfile.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiled_starters/python/your_program.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ set -e # Exit early if any commands fail
1212
#
1313
# - Edit this to change how your program runs locally
1414
# - Edit .codecrafters/run.sh to change how your program runs remotely
15-
exec python3 -m app.main "$@"
15+
exec pipenv run python3 -m app.main "$@"

dockerfiles/python-3.13.Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
11
FROM python:3.13-alpine
2+
3+
RUN pip install --no-cache-dir pipenv==2025.0.2
4+
5+
COPY Pipfile /app/Pipfile
6+
COPY Pipfile.lock /app/Pipfile.lock
7+
8+
WORKDIR /app
9+
10+
ENV WORKON_HOME=/venvs
11+
12+
RUN pipenv install
13+
14+
# Force environment creation
15+
RUN pipenv run python3 -c "1+1"
16+
17+
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Pipfile,Pipfile.lock"

solutions/python/01-jm1/code/.codecrafters/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
set -e # Exit on failure
1010

11-
exec python3 -m app.main "$@"
11+
exec pipenv run python3 -m app.main "$@"

solutions/python/01-jm1/code/.gitignore

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ ipython_config.py
9494
# install all needed dependencies.
9595
#Pipfile.lock
9696

97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
97103
# poetry
98104
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99105
# This is especially recommended for binary packages to ensure reproducibility, and is more
@@ -106,8 +112,10 @@ ipython_config.py
106112
#pdm.lock
107113
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108114
# in version control.
109-
# https://pdm.fming.dev/#use-with-ide
115+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110116
.pdm.toml
117+
.pdm-python
118+
.pdm-build/
111119

112120
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113121
__pypackages__/
@@ -151,3 +159,16 @@ dmypy.json
151159

152160
# Cython debug symbols
153161
cython_debug/
162+
163+
# PyCharm
164+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166+
# and can be added to the global gitignore or merged into this file. For a more nuclear
167+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168+
.idea/
169+
170+
# Ruff stuff:
171+
.ruff_cache/
172+
173+
# PyPI configuration file
174+
.pypirc

solutions/python/01-jm1/code/Pipfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
4+
[[source]]
5+
url = "https://pypi.org/simple"
6+
verify_ssl = true
7+
name = "pypi"
8+
9+
[packages]
10+
11+
[dev-packages]
12+
13+
[requires]
14+
python_version = "3"

solutions/python/01-jm1/code/Pipfile.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

solutions/python/01-jm1/code/your_program.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ set -e # Exit early if any commands fail
1212
#
1313
# - Edit this to change how your program runs locally
1414
# - Edit .codecrafters/run.sh to change how your program runs remotely
15-
exec python3 -m app.main "$@"
15+
exec pipenv run python3 -m app.main "$@"

solutions/python/02-rg2/code/Pipfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
4+
[[source]]
5+
url = "https://pypi.org/simple"
6+
verify_ssl = true
7+
name = "pypi"
8+
9+
[packages]
10+
11+
[dev-packages]
12+
13+
[requires]
14+
python_version = "3"

solutions/python/02-rg2/code/Pipfile.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

solutions/python/02-rg2/code/your_program.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ set -e # Exit early if any commands fail
1212
#
1313
# - Edit this to change how your program runs locally
1414
# - Edit .codecrafters/run.sh to change how your program runs remotely
15-
exec python3 -m app.main "$@"
15+
exec pipenv run python3 -m app.main "$@"

starter_templates/python/code/.codecrafters/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
set -e # Exit on failure
1010

11-
exec python3 -m app.main "$@"
11+
exec pipenv run python3 -m app.main "$@"

starter_templates/python/code/.gitignore

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ ipython_config.py
9494
# install all needed dependencies.
9595
#Pipfile.lock
9696

97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
97103
# poetry
98104
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99105
# This is especially recommended for binary packages to ensure reproducibility, and is more
@@ -106,8 +112,10 @@ ipython_config.py
106112
#pdm.lock
107113
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108114
# in version control.
109-
# https://pdm.fming.dev/#use-with-ide
115+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110116
.pdm.toml
117+
.pdm-python
118+
.pdm-build/
111119

112120
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113121
__pypackages__/
@@ -151,3 +159,16 @@ dmypy.json
151159

152160
# Cython debug symbols
153161
cython_debug/
162+
163+
# PyCharm
164+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166+
# and can be added to the global gitignore or merged into this file. For a more nuclear
167+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168+
.idea/
169+
170+
# Ruff stuff:
171+
.ruff_cache/
172+
173+
# PyPI configuration file
174+
.pypirc

starter_templates/python/code/Pipfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
4+
[[source]]
5+
url = "https://pypi.org/simple"
6+
verify_ssl = true
7+
name = "pypi"
8+
9+
[packages]
10+
11+
[dev-packages]
12+
13+
[requires]
14+
python_version = "3"

starter_templates/python/code/Pipfile.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

starter_templates/python/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
attributes:
2-
required_executable: python (3.13)
3-
user_editable_file: app/main.py
2+
required_executable: "python (3.13)"
3+
user_editable_file: "app/main.py"

0 commit comments

Comments
 (0)