Skip to content

Commit

Permalink
Fixed run() entrypoint
Browse files Browse the repository at this point in the history
Added debug files to .gitignore
Added f-Strings in print statements
Added Dockerfile
Removed unnecessary packages from requirements.txt
  • Loading branch information
louis-e committed Oct 9, 2022
1 parent 46d7da1 commit 867d20d
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 262 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,8 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Debug files
arnis-debug-raw_data.json
arnis-debug-processed_data.json
arnis-debug-map.png
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.9
RUN apt-get update && apt-get -y install git ffmpeg libsm6 libxext6
RUN cd /home && mkdir /home/region && git clone https://github.com/louis-e/arnis.git
WORKDIR /home/arnis
RUN pip install -r requirements.txt
ENTRYPOINT ["python", "arnis.py"]
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ Notes:
- The city, state and country name should be in the local language of the respective country. Otherwise the city might not be found.
- You can optionally use the parameter ```--debug``` in order to see the processed values as a text output during runtime.

### Docker image
If you want to run this project in a container, you can use the Dockerfile provided in this repository. It will automatically scrape the latest source code. After running the container, you have to manually copy the generated region files from the container to the host machine in order to use them. When running the Docker image, set the ```--path``` parameter to ```/home```. An image on Dockerhub will follow soon.
```
docker build -t arnis .
docker run arnis --city "Arnis" --state "Schleswig Holstein" --country "Deutschland" --path "/home"
docker cp CONTAINER_ID:/home/region DESTINATION_PATH
```

## :cd: Requirements
- Python 3
- At least 8 Gigabyte RAM memory
Expand Down Expand Up @@ -84,17 +92,18 @@ ID | Name | Note |
70-79 | House interior | The last digit refers to the building height |

## :memo: ToDo
- [ ] Add Dockerfile
- [ ] Use f-Strings in print statements
- [ ] Implement multiprocessing in floodfill algorithm in order to boost CPU bound calculation performance
- [ ] Add code comments
- [ ] Implement elevation
- [ ] Find alternative for CV2 package
- [ ] Improve RAM usage
- [ ] Add interior to buildings
- [ ] Optimize region file size
- [ ] Street markings
- [x] Automated Tests
- [x] PEP8
- [x] Use f-Strings in print statements
- [x] Add Dockerfile

## :copyright: License
MIT License[^3]
Expand Down
29 changes: 3 additions & 26 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
anvil-parser==0.9.0
argparse==1.4.0
black==22.8.0
certifi==2022.9.24
charset-normalizer==2.0.12
click==8.1.3
cycler==0.11.0
flake8==5.0.4
fonttools==4.37.4
frozendict==2.3.4
idna==3.4
kiwisolver==1.4.4
matplotlib==3.5.2
mccabe==0.7.0
mypy-extensions==0.4.3
NBT==1.5.1
numpy==1.22.3
opencv-python==4.5.5.64
packaging==21.3
pathspec==0.10.1
Pillow==9.2.0
platformdirs==2.5.2
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.0.9
python-dateutil==2.8.2
python-polylabel==0.6
requests==2.27.1
six==1.16.0
tomli==2.0.1
typing_extensions==4.3.0
urllib3==1.26.12
argparse==1.4.0
black==22.8.0
flake8==5.0.4
4 changes: 2 additions & 2 deletions src/getData.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def getData(city, state, country, debug):
"""
)

print("Chosen server: " + url)
print(f"Chosen server: {url}")
try:
data = requests.get(url, params={"data": query1}).json()

Expand All @@ -51,7 +51,7 @@ def getData(city, state, country, debug):
elif "Dispatcher_Client::request_read_and_idx::rate_limited" in str(e):
print("Error! IP rate limited")
else:
print("Error! " + str(e))
print(f"Error! {e}")
os._exit(1)

if debug:
Expand Down
Loading

0 comments on commit 867d20d

Please sign in to comment.