Skip to content

Commit

Permalink
[WIP] Moving to pyproject.toml Based Packaging (#280)
Browse files Browse the repository at this point in the history
* Adding option to disable Numba during tests to run code as pure Python to get coverage information

* Add check for correctly raised warning

* Update to unitest job name

* Fix

* Adding journal test back

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Install problem fix

* Install problem fix

* Moving to toml based packaging

* Better versioning

* Fix

* Fix

* Fix

* Tweaking action

* Tweaking action

* Tweak
  • Loading branch information
ericspod authored Apr 1, 2022
1 parent e100af6 commit 69706be
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 coverage
pip install -r requirements.txt
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 wheel twine
pip install -r requirements.txt
- if: runner.os == 'Linux'
name: Set up GCC
uses: egor-tensin/setup-gcc@v1
Expand All @@ -46,17 +41,23 @@ jobs:
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 wheel twine
- name: Build package
run: python setup.py bdist_wheel
run: |
pip install -e .
pip wheel .
- if: github.event_name == 'push' || github.event_name == 'pull_request'
name: Test publish package
run: |
python3 -m twine check dist/*
python3 -m twine check exetera-*.whl
- if: github.event_name == 'release'
name: Publish package on release
run: |
python3 -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
python3 -m twine upload exetera-*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,27 @@ format more suited to performing analytics. This is done through `exetera import


### `exetera import`

```
exetera import
-s path/to/covid_schema.json \
-i "patients:path/to/patient_data.csv, assessments:path/to/assessmentdata.csv, tests:path/to/covid_test_data.csv, diet:path/to/diet_study_data.csv" \
-o /path/to/output_dataset_name.hdf5
--include "patients:(id,country_code,blood_group), assessments:(id,patient_id,chest_pain)"
--exclude "tests:(country_code)"
exetera import \
-s path/to/covid_schema.json \
-i "patients:path/to/patient_data.csv, assessments:path/to/assessmentdata.csv, tests:path/to/covid_test_data.csv, diet:path/to/diet_study_data.csv" \
-o /path/to/output_dataset_name.hdf5 \
--include "patients:(id,country_code,blood_group), assessments:(id,patient_id,chest_pain)" \
--exclude "tests:(country_code)"
```


#### Arguments
* `-s/--schema`: The location and name of the schema file
* `-te/--territories`: If set, this only imports the listed territories. If left unset, all
territories are imported
* `-i/--inputs` : A comma separated list of 'name:file' pairs. This should be put in parentheses if it contains any
whitespace. See the example above.
* `-te/--territories`: If set, this only imports the listed territories. If left unset, all territories are imported
* `-i/--inputs` : A comma separated list of 'name:file' pairs. This should be put in parentheses if it contains any whitespace. See the example above.
* `-o/--output_hdf5`: The path and name to where the resulting hdf5 dataset should be written
* `-ts/--timestamp`: An override for the timestamp to be written
(defaults to `datetime.now(timezone.utc)`)
* `-ts/--timestamp`: An override for the timestamp to be written (defaults to `datetime.now(timezone.utc)`)
* `-w/--overwrite`: If set, overwrite any existing dataset with the same name; appends to existing dataset otherwise
* `-n/--include`: If set, filters out all fields apart from those in the list.
* `-x/--exclude`: If set, filters out the fields in this list.

Expect this script to take about an hour or more to execute on very large datasets.


Expand Down
2 changes: 1 addition & 1 deletion exetera/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = '0.6.0b'
__version__ = '0.6.0b5'
File renamed without changes.
26 changes: 23 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@

[build-system]
requires = ["setuptools<61.0.0", "wheel"]
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "ExeTera"

name = "exetera"
description = "High-volume key-value store and analytics, based on hdf5"
license = {file = "LICENSE.txt"}
dependencies = ["numpy", "pandas", "h5py", "numba", "parameterized"]
requires-python = ">=3.7"
authors = [{ name = "Ben Murray", email = "benjamin.murray@kcl.ac.uk" }]
dynamic = ["version", "readme"]

[project.urls]
homepage = "https://github.com/kcl-bmeis/ExeTera"

[project.scripts]
exetera = "exetera.bin.exetera:main"

[tool.setuptools.packages.find]
include = ["exetera*"]

[tool.setuptools.dynamic]
version = {attr = "exetera._version.__version__"}
readme = {file = ["README.md"], content-type = "text/markdown"}

[metadata]
description-file = "README.md"
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

37 changes: 3 additions & 34 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
from setuptools import setup, find_packages
from pkg_resources import parse_requirements
#from Cython.Build import cythonize

from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
from setuptools import setup

# read the version and other strings from _version.py
with open(path.join(this_directory, "exetera", "_version.py")) as o:
exec(o.read())

# read install requirements from requirements.txt
with open(path.join(this_directory, "requirements.txt")) as o:
requirements = [str(r) for r in parse_requirements(o.read())]

#pyxfiles = ['ops.pyx']
#pyx_full_path = [path.join(this_directory, 'exetera', '_libs', pyx) for pyx in pyxfiles]

setup(
name='exetera',
version=__version__,
description='High-volume key-value store and analytics, based on hdf5',
long_description=long_description,
long_description_content_type = "text/markdown",
url='https://github.com/kcl-bmeis/ExeTera',
author='Ben Murray',
author_email='benjamin.murray@kcl.ac.uk',
license='http://www.apache.org/licenses/LICENSE-2.0',
packages=find_packages(),
scripts=['exetera/bin/exetera'],
#ext_modules = cythonize(pyx_full_path),
python_requires='>=3.7',
install_requires=requirements
)
if __name__ == "__main__":
setup()

0 comments on commit 69706be

Please sign in to comment.