From 59feb8ad35c241e685a01a803da8fe06d645cd0a Mon Sep 17 00:00:00 2001 From: RC-Aiden Date: Tue, 14 Feb 2023 13:54:24 +0000 Subject: [PATCH 1/7] windows related changes --- .../getters/download_public_data.py | 18 +++++++++++++++--- setup.py | 7 +++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ojd_daps_skills/getters/download_public_data.py b/ojd_daps_skills/getters/download_public_data.py index 02ba3717..c905e25d 100644 --- a/ojd_daps_skills/getters/download_public_data.py +++ b/ojd_daps_skills/getters/download_public_data.py @@ -1,17 +1,29 @@ from ojd_daps_skills import PUBLIC_DATA_FOLDER_NAME, PROJECT_DIR import os - +import platform +import zipfile def download(): public_data_dir = os.path.join(PROJECT_DIR, PUBLIC_DATA_FOLDER_NAME) + if platform.system() == "Windows": + public_data_dir = f'"{public_data_dir}"' + os.system( f"aws --no-sign-request --region=eu-west-1 s3 cp s3://open-jobs-indicators/escoe_extension/{PUBLIC_DATA_FOLDER_NAME}.zip {public_data_dir}.zip" ) - os.system(f"unzip {public_data_dir}.zip -d {PROJECT_DIR}") - os.system(f"rm {public_data_dir}.zip") + + if platform.system() == "Windows": + with zipfile.ZipFile(f"{public_data_dir}.zip", 'r') as zip_ref: + zip_ref.extractall(f"{PROJECT_DIR}") + zip_ref.close() + os.remove(f"{public_data_dir}.zip") + else: + os.system(f"unzip {public_data_dir}.zip -d {PROJECT_DIR}") + os.system(f"rm {public_data_dir}.zip") + if __name__ == "__main__": diff --git a/setup.py b/setup.py index c6dfa506..79695e12 100644 --- a/setup.py +++ b/setup.py @@ -4,14 +4,17 @@ from setuptools import setup import os +import platform import subprocess -tag_cmd = "echo $(git describe --tags --abbrev=0)" +tag_cmd = "git describe --tags --abbrev=0" +tag_cmd = tag_cmd if platform.system() == "Windows" else f"echo $({tag_cmd})" tag_version = ( subprocess.check_output(tag_cmd, shell=True).decode("ascii").replace("\n", "") ) +print(platform.system()) def read_lines(path): """Read lines of `path`.""" @@ -24,7 +27,7 @@ def read_lines(path): setup( name="ojd_daps_skills", - long_description=open(os.path.join(BASE_DIR, "README.md")).read(), + long_description=open(os.path.join(BASE_DIR, "README.md"), encoding="utf-8").read(), long_description_content_type="text/markdown", install_requires=read_lines(os.path.join(BASE_DIR, "requirements.txt")), extras_require={"dev": read_lines(os.path.join(BASE_DIR, "requirements_dev.txt"))}, From 4da1db02362aa9d6be31564eb646d3dd4b8fe806 Mon Sep 17 00:00:00 2001 From: RC-Aiden Date: Tue, 14 Feb 2023 14:54:51 +0000 Subject: [PATCH 2/7] change structure --- .../getters/download_public_data.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ojd_daps_skills/getters/download_public_data.py b/ojd_daps_skills/getters/download_public_data.py index c905e25d..a04656bc 100644 --- a/ojd_daps_skills/getters/download_public_data.py +++ b/ojd_daps_skills/getters/download_public_data.py @@ -9,20 +9,21 @@ def download(): public_data_dir = os.path.join(PROJECT_DIR, PUBLIC_DATA_FOLDER_NAME) if platform.system() == "Windows": - public_data_dir = f'"{public_data_dir}"' - - os.system( - f"aws --no-sign-request --region=eu-west-1 s3 cp s3://open-jobs-indicators/escoe_extension/{PUBLIC_DATA_FOLDER_NAME}.zip {public_data_dir}.zip" - ) - - if platform.system() == "Windows": + os.system( + f'aws --no-sign-request --region=eu-west-1 s3 cp s3://open-jobs-indicators/escoe_extension/{PUBLIC_DATA_FOLDER_NAME}.zip "{public_data_dir}.zip"' + ) with zipfile.ZipFile(f"{public_data_dir}.zip", 'r') as zip_ref: zip_ref.extractall(f"{PROJECT_DIR}") zip_ref.close() os.remove(f"{public_data_dir}.zip") - else: - os.system(f"unzip {public_data_dir}.zip -d {PROJECT_DIR}") - os.system(f"rm {public_data_dir}.zip") + + return + + os.system( + f"aws --no-sign-request --region=eu-west-1 s3 cp s3://open-jobs-indicators/escoe_extension/{PUBLIC_DATA_FOLDER_NAME}.zip {public_data_dir}.zip" + ) + os.system(f"unzip {public_data_dir}.zip -d {PROJECT_DIR}") + os.system(f"rm {public_data_dir}.zip") From cf29aabe1dc8654851644696b23b7c66309bd545 Mon Sep 17 00:00:00 2001 From: RC-Aiden Date: Tue, 14 Feb 2023 18:40:49 +0000 Subject: [PATCH 3/7] action test + forgotten print --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 79695e12..d66c0f72 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,6 @@ subprocess.check_output(tag_cmd, shell=True).decode("ascii").replace("\n", "") ) -print(platform.system()) def read_lines(path): """Read lines of `path`.""" From 80d012bef9176311c1b0123ad0ae5280b08cf617 Mon Sep 17 00:00:00 2001 From: RC-Aiden Date: Tue, 14 Feb 2023 18:49:27 +0000 Subject: [PATCH 4/7] fix for fork PR not running unit tests --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 7a4aab61..dadb7cb3 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,6 +1,6 @@ name: Unit Tests -on: [push] +on: [push, pull_request] jobs: build: From 2c1cb571b24579112ebba5db062417b26375885d Mon Sep 17 00:00:00 2001 From: lizgzil Date: Wed, 15 Feb 2023 09:07:31 +0000 Subject: [PATCH 5/7] empty commit to trigger tests From 4128a9cc4a10db050f8712c4e28aea1daa168dbb Mon Sep 17 00:00:00 2001 From: lizgzil Date: Thu, 16 Feb 2023 13:04:29 +0000 Subject: [PATCH 6/7] Remove pull request from check trigger and add information to readme --- .github/workflows/pytest.yml | 2 +- README.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index dadb7cb3..7a4aab61 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,6 +1,6 @@ name: Unit Tests -on: [push, pull_request] +on: [push] jobs: build: diff --git a/README.md b/README.md index 629d67dd..efeb5ef6 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ You will also need to download [spaCy's](https://spacy.io/models/en) `en_core_we python -m spacy download en_core_web_sm ``` +Note that this package was developed on MacOS and tested on Ubuntu, as such it may not work smoothly on Windows. + ### AWS CLI When the package is first used it will automatically download a folder of neccessary data and models. This file is ~ 1GB. Although you don't need to have AWS credentials for this to work, you will need to download the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html). @@ -181,6 +183,8 @@ Various pieces of analysis are done in the [analysis folder](https://github.com/ The technical and working style guidelines can be found [here](https://github.com/nestauk/ds-cookiecutter/blob/master/GUIDELINES.md). +If contributing, changes will need to be pushed to a new branch in order for our code checks to be triggered. + ---

This project was made possible via funding from the Economic Statistics Centre of Excellence

From fc593097376300f53c61711dd8c73480a5e8d109 Mon Sep 17 00:00:00 2001 From: Liz G Date: Fri, 17 Feb 2023 10:17:06 +0000 Subject: [PATCH 7/7] Update README.md Co-authored-by: India <46863334+india-kerle@users.noreply.github.com> --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index efeb5ef6..95519283 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,7 @@ You will also need to download [spaCy's](https://spacy.io/models/en) `en_core_we python -m spacy download en_core_web_sm ``` -Note that this package was developed on MacOS and tested on Ubuntu, as such it may not work smoothly on Windows. - +Note that this package was developed on MacOS and tested on Ubuntu. Changes have been made to be compatible on a Windows system but are not tested and cannot be guaranteed. ### AWS CLI When the package is first used it will automatically download a folder of neccessary data and models. This file is ~ 1GB. Although you don't need to have AWS credentials for this to work, you will need to download the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).