Skip to content

Commit 54fa5be

Browse files
authored
Merge pull request #189 from roboflow/devcontainer
Add devcontainer
2 parents f26827a + 8b0dcc3 commit 54fa5be

File tree

7 files changed

+77
-8
lines changed

7 files changed

+77
-8
lines changed

.devcontainer/bashrc_ext

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
parse_git_branch() {
2+
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
3+
}
4+
export PS1="\[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
5+
alias ll='ls -lah'
6+
source /usr/share/bash-completion/completions/git
7+
8+
#!/bin/bash
9+
RESTORE='\033[0m'
10+
RED='\033[00;31m'
11+
GREEN='\033[00;32m'
12+
YELLOW='\e[0;33m'
13+
14+
function quickstart {
15+
echo -e ""
16+
echo -e "${RED}run tests${RESTORE}"
17+
echo -e "${YELLOW}python -m unittest${RESTORE}"
18+
echo -e ""
19+
}

.devcontainer/devcontainer.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "roboflow-python devcontainer",
3+
"dockerComposeFile": "./docker-compose.yaml",
4+
"service": "devcontainer-roboflow-python",
5+
"workspaceFolder": "/roboflow-python",
6+
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-python.python",
11+
"ms-python.black-formatter"
12+
],
13+
"settings": {
14+
"extensions.verifySignature": false
15+
}
16+
}
17+
}
18+
}

.devcontainer/docker-compose.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3'
2+
services:
3+
devcontainer-roboflow-python:
4+
build:
5+
context: ..
6+
dockerfile: Dockerfile.dev
7+
image: devcontainer-roboflow-python
8+
volumes:
9+
- ..:/roboflow-python
10+
command: sleep infinity

.vscode/settings.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"python.testing.unittestArgs": [
3+
"-v",
4+
"-s",
5+
"./tests",
6+
"-p",
7+
"test_*.py"
8+
],
9+
"python.testing.unittestEnabled": true,
10+
"python.testing.pytestArgs": [
11+
"."
12+
],
13+
"editor.formatOnSave": true,
14+
"[python]": {
15+
"editor.defaultFormatter": "ms-python.black-formatter"
16+
},
17+
"python.formatting.provider": "none"
18+
}

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ make style
3737
make check_code_quality
3838
```
3939

40-
**Note** These tests will be run automatically when you commit thanks to git hooks.
40+
**Note** These tests will be run automatically when you commit thanks to git hooks.
41+
42+
**Note** This project also comes with a [convenient devcontainer](https://www.loom.com/share/a183c4a351ed4700a79476fedf08ab9b) that makes it easier to run tests and has black configured to run on save.

Dockerfile.dev

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
ARG PYTHON_VERSION=3.8
2-
FROM python:$PYTHON_VERSION-slim
3-
RUN apt-get update && apt-get install make && rm -rf /var/lib/apt/lists/*
4-
WORKDIR /workspace
5-
COPY . .
1+
FROM python:3.8
2+
RUN apt-get update && apt-get install -y make libgl1-mesa-glx && rm -rf /var/lib/apt/lists/*
3+
WORKDIR /roboflow-python
4+
COPY .devcontainer/bashrc_ext /root/bashrc_ext
5+
RUN echo "source /root/bashrc_ext" >> ~/.bashrc
6+
COPY ./setup.py ./pyproject.toml ./README.md ./requirements.txt ./
7+
COPY roboflow/__init__.py ./roboflow/__init__.py
68
RUN pip install -e ".[dev]"
7-
ENTRYPOINT [ "/bin/bash" ]
9+
COPY . .

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Within the version object, you can download the dataset version in any model for
152152

153153
## 🏆 Contributing
154154

155-
We would love your input on how we can improve the Roboflow Python package! Please see our [contributing guide](https://github.com/roboflow/roboflow-python) to get started. Thank you 🙏 to all our contributors!
155+
We would love your input on how we can improve the Roboflow Python package! Please see our [contributing guide](./CONTRIBUTING.md) to get started. Thank you 🙏 to all our contributors!
156156

157157
<br>
158158

0 commit comments

Comments
 (0)