Skip to content

Commit cd19aa5

Browse files
authored
enter: docker (#48)
* enter: docker * Remove unnecessary dockerfile dependency. Update README. * Kill Dockerfile in favor of CLI
1 parent 176b57b commit cd19aa5

2 files changed

Lines changed: 67 additions & 21 deletions

File tree

.env-example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ROBOFLOW_API_KEY=your-roboflow-private-api-key
2+
PROJECT_NAME=your-project-name
3+
PROJECT_VERSION=1

README.md

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,41 +87,84 @@ Selecting the format you'd like your project to be exported as while choosing th
8787

8888
![Alt Text](https://media.giphy.com/media/I5g06mUnVzdX7iT2Gf/giphy.gif)
8989

90-
## Deving locally
91-
1. clone repo
92-
2. create a virtual env: `virtualenv local_dev`
93-
3. activate virtual env: `source local_dev/bin/activate`
94-
4. install packages from repo: `pip3 install -e ".[dev]"`
95-
5. create script on top level of `ROBOFLOW-PYTHON` and reference local `roboflow` directory: `from roboflow import Roboflow`
96-
6. when done, uptick the pip package minor version number in `setup.py`
97-
7. manually add any new dependencies to the `requirements.txt` and list of dependencies in `setup.py` (careful not to overwrite any packages that might screw up backwards dependencies for object detection, etc.)
90+
## Developing locally
9891

99-
### Code Quality
92+
### Using Docker
10093

101-
We provide a `Makefile` to format and ensure code quality. **Be sure to run them before creating a PR**.
94+
To set the Docker container up for the first time:
95+
96+
```bash
97+
# Clone this repo
98+
git clone git@github.com:roboflow-ai/roboflow-python.git && cd roboflow-python
99+
100+
# Copy the environment variables template
101+
# Be sure to update the values with your account's information
102+
cp .env-example .env
102103

104+
# Build and run a new docker container image
105+
docker run -it -v $(pwd):/roboflow --name roboflow python:3.8.14-slim /bin/bash
106+
107+
# Install Dependencies
108+
cd roboflow/ && pip install -e ".[dev]"
109+
110+
# Run tests
111+
python -m unittest
103112
```
104-
# format your code with `black` and `isort` run
105-
make style
106-
# check code with flake8
107-
make check_code_quality
113+
114+
Running the Docker container after initial build:
115+
116+
```bash
117+
docker start roboflow
118+
docker exec -it roboflow /bin/bash
119+
cd roboflow/ && python -m unittest
108120
```
109121

110-
**Note** This tests will be run automatically when you commit thanks to git hooks.
122+
### Using Virtualenv
123+
124+
```bash
125+
# Clone this repo
126+
git clone git@github.com:roboflow-ai/roboflow-python.git && cd roboflow-python
127+
128+
# create virtual env
129+
virtualenv local_dev
111130

112-
### Tests
131+
# activate virtual env
132+
source local_dev/bin/activate
113133

114-
You need to have the following `env` variables,
134+
# install dependencies
135+
pip3 install -e ".[dev]"
136+
```
137+
138+
### Testing
139+
140+
You need to have the following `env` variables defined. If using docker along with the `.env` file, these will be automatically defined.
115141

116142
```
117-
ROBOFLOW_API_KEY="<YOUR_ROBOFLOW_API>"
143+
ROBOFLOW_API_KEY="<YOUR_ROBOFLOW_PRIVATE_API_KEY>"
118144
PROJECT_NAME="<YOUR_PROJECT_NAME>"
119-
PROJECT_VERSION="" # by default "1"
145+
PROJECT_VERSION="1"
120146
```
121147

122-
Then, assuming you have installed the `dev` packages (`pip install -e ".[dev]`), you can run the tests
148+
Run tests:
123149

124150
```bash
125-
126151
python -m unittest
127152
```
153+
154+
### Contributing
155+
156+
1. Increment the pip package minor version number in `setup.py`
157+
1. Manually add any new dependencies to `requirements.txt` and list of dependencies in `setup.py` (Be careful not to overwrite any packages that might screw up backwards dependencies for object detection, etc.)
158+
159+
### Code Quality
160+
161+
We provide a `Makefile` to format and ensure code quality. **Be sure to run them before creating a PR**.
162+
163+
```
164+
# format your code with `black` and `isort` run
165+
make style
166+
# check code with flake8
167+
make check_code_quality
168+
```
169+
170+
**Note** These tests will be run automatically when you commit thanks to git hooks.

0 commit comments

Comments
 (0)