From 1b274227c1a89182120e1ec8b8ce8d165903a581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7oise=20Conil?= <francoise.conil@insa-lyon.fr> Date: Fri, 4 Nov 2022 08:32:39 +0100 Subject: [PATCH] Explain installation, usage and made some remarks --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/README.md b/README.md index 7d010da..c3d1abc 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,67 @@ Packaging informations : - https://packaging.python.org/en/latest/tutorials/packaging-projects/ - https://choosealicense.com/ +## Remark + +The data files do not need to be packaged, just place them where the data +folder is installed. + +## Build and install the package + +```shell +$ flit build +$ pip install dist/import_resources_example-0.0.1-py3-none-any.whl +``` + +WARNING : The package is installed in the virtual environment, so the data +files must be placed there which is not a very pleasant location. + +```shell +$ tree .venv/lib/python3.10/site-packages/import_resources_example +├── data +│  └── __init__.py +├── get_oms_data.py +├── get_population_info.py +└── __init__.py +``` + +When installing the package in development mode with `pip install -e .`, the +data folder is in the clone repository. + +## Usage + +Install the package and try to execute the functions. + +```ipython +In [1]: from import_resources_example import get_population_info + +In [2]: get_population_info.extract_population_general_info() +{'AUKUS': {'Time': '1950', 'PopTotal': '206513.782', 'PopDensity': '12.096'}, + 'African Group': {'Time': '1950', + 'PopTotal': '227261.208', + 'PopDensity': '7.761'}, + 'African Union': {'Time': '1950', + 'PopTotal': '227274.19', + 'PopDensity': '7.692'}, + +In [3]: from import_resources_example import get_oms_data + +In [4]: get_oms_data.get_oms_data() +Out[4]: +[{'TrialID': 'NCT00173563', + 'Public-title': 'Induction of Cytokines in Human Monocytes by SARS-CoV in Adults and Children', + 'Date-registration': '12/09/2005', + 'Source-Register': 'ClinicalTrials.gov', + 'Recruitment-Status': 'Recruiting', + 'Study type': 'Observational'}, + {'TrialID': 'NCT00523276', + 'Public-title': 'SARS Survivor Evaluations', + 'Date-registration': '30/08/2007', + 'Source-Register': 'ClinicalTrials.gov', + 'Recruitment-Status': 'Not recruiting', + 'Study type': 'Observational'}, +``` + ## Troubleshooting If we have untracked data files in the package tree, flist refuses to build the -- GitLab