-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 111232e
Showing
16 changed files
with
855 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Upload Python Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
create: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: set up | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install make | ||
python -m pip install --upgrade pip | ||
python -m pip install virtualenv | ||
- name: Test | ||
run: make test | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install make | ||
python -m pip install --upgrade pip | ||
python -m pip install virtualenv | ||
- name: Build package | ||
run: make build_dist | ||
- name: Publish package | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
__pycache__/ | ||
|
||
.coverage* | ||
coverage.xml | ||
htmlcov/ | ||
|
||
*.py[cod] | ||
|
||
# Swap | ||
[._]*.s[a-v][a-z] | ||
[._]*.sw[a-p] | ||
[._]s[a-rt-v][a-z] | ||
[._]ss[a-gi-z] | ||
[._]sw[a-p] | ||
|
||
.env_python* | ||
|
||
*egg-info* | ||
|
||
.eggs/ | ||
dist/ | ||
RPMS/ | ||
BUILD/ | ||
BUILDROOT/ | ||
SRPMS/ | ||
SOURCES/ | ||
cache/ | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
PYTHON=python3 | ||
|
||
# TODO: might be nice to have a non threading setting | ||
TEST_CONTEXT=export TEST_ENV=True && | ||
|
||
ENV_DIR=.env_$(PYTHON) | ||
IN_ENV=. $(ENV_DIR)/bin/activate && | ||
|
||
env: $(ENV_DIR) | ||
|
||
setup: | ||
$(PYTHON) -m pip install --upgrade pip | ||
$(PYTHON) -m pip install virtualenv | ||
$(PYTHON) -m virtualenv -p $(PYTHON) $(ENV_DIR) | ||
$(IN_ENV) $(PYTHON) -m pip install --upgrade -r requirements.txt | ||
$(IN_ENV) $(PYTHON) -m pip install --editable . | ||
|
||
test_requirements: | ||
$(IN_ENV) $(PYTHON) -m pip install --upgrade -r test_requirements.txt | ||
|
||
upload_pip: test build_dist | ||
twine upload --repository road_collisions_uk dist/* | ||
|
||
build_dist: setup | ||
rm -fr dist/ | ||
$(IN_ENV) python setup.py sdist bdist_wheel | ||
|
||
build: setup | ||
|
||
quick_build: | ||
$(IN_ENV) $(PYTHON) -m pip install --editable . | ||
|
||
test: build test_requirements quick_test | ||
|
||
quick_test: | ||
$(IN_ENV) $(PYTHON) -m unittest | ||
|
||
load: | ||
$(IN_ENV) load_road_collisions_uk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Road Collisions Ireland | ||
======================= | ||
|
||
| Region | years | | ||
| ---------------- | ----------- | | ||
| United Kingdom | 2016 - 2021 | | ||
|
||
There is UK data from the 70s to present but it's very big. I'll work on making it so it is small enough for pypi when I have the time | ||
|
||
# Quickstart | ||
|
||
To enter a debugger with access to all collision data run `make load_road_collisions_uk` and you will have access to the variable `collisions` which contains everything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
road-collisions-base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from setuptools import ( | ||
find_packages, | ||
setup | ||
) | ||
|
||
INSTALL_REQUIRES = ( | ||
'road-collisions-base' | ||
) | ||
|
||
setup( | ||
name='road_collisions_uk', | ||
version='0.0.1', | ||
python_requires='>=3.6', | ||
description='Road collision data for the UK', | ||
author='Robert Lucey', | ||
url='https://github.com/RobertLucey/road-collisions-uk', | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
install_requires=INSTALL_REQUIRES, | ||
package_data={ | ||
'road_collisions_uk': [ | ||
'resources/uk/uk.csv.tgz' | ||
] | ||
}, | ||
entry_points={ | ||
'console_scripts': [ | ||
'load_road_collisions_uk = road_collisions_uk.bin.load:main', | ||
] | ||
} | ||
) |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from road_collisions_base import logger | ||
|
||
from road_collisions_uk.models.collision import Collisions | ||
|
||
|
||
def main(): | ||
collisions = Collisions.load_all(region='uk') | ||
|
||
logger.info('Loaded %s collisions', (len(collisions))) | ||
logger.info('Do something with the data in the variable \'collisions\'...') | ||
|
||
import pdb; pdb.set_trace() | ||
|
||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
Oops, something went wrong.