From 0e00aa9be88f02585cab4679b666403e988a2035 Mon Sep 17 00:00:00 2001 From: Alexandre Marcireau Date: Mon, 9 Oct 2023 09:16:13 +1100 Subject: [PATCH] Add undrdg to Pypi (pip) --- .github/workflows/publish_python.yml | 33 ++++++++++++++++++++++++++++ .gitignore | 1 + README.md | 31 ++++++++++++++++++++++---- pyproject.toml | 5 ++--- scripts/dvs09/dvs09.py | 1 + scripts/requirements.txt | 2 +- undrdg/version.py | 2 +- 7 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/publish_python.yml diff --git a/.github/workflows/publish_python.yml b/.github/workflows/publish_python.yml new file mode 100644 index 0000000..8e8351f --- /dev/null +++ b/.github/workflows/publish_python.yml @@ -0,0 +1,33 @@ +name: Publish Python + +on: + release: + types: + - published + +jobs: + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + - run: python setup.py sdist + working-directory: python + - uses: actions/upload-artifact@v3 + with: + name: undr-sdist + path: python/dist/*.tar.gz + upload_pypi: + name: Upload to PyPI + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: undr-sdist + path: dist + - uses: pypa/gh-action-pypi-publish@v1.5.0 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index 9d57041..25214fa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__ *.egg-info scripts/**/input scripts/**/output +dist diff --git a/README.md b/README.md index 9952f81..82fc02f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,38 @@ -# undrdg +UNDRDG provides building blocks to convert existing datasets to the UNDR format. -UNDR Dataset Generator +The scripts used to convert the datasets that we re-distribute can be found in _scripts_. The converted datasets can be browsed at https://www.undr.space. -## Contribute +# Use UNDRDG in your own project +```sh +python3 -m pip install undrdg ``` + +See _scripts_ for usage examples. + +# Add scripts to this directory + +```sh python3 -m venv .venv source .venv/bin/activate -pip install -e . +pip install -r scripts/requirements.txt ``` +# Contribute to UNDRDG + +1. Install the development version + +```sh +python3 -m venv .venv +source .venv/bin/activate +pip remove undrdg # to avoid name clashes +pip install -e . ``` + +2. Edit files in _undrg_. Changes are automatically reflected in scripts that import the library. + +3. Format and lint. + +```sh isort .; black .; pyright . ``` diff --git a/pyproject.toml b/pyproject.toml index 54e58f7..49ab9c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools >= 42"] +requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] @@ -10,14 +10,13 @@ authors = [ description = "Generate datasets compatible with UNDR" classifiers=[ "Programming Language :: Python :: 3", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", ] dependencies = ["undr"] dynamic = ["version", "readme"] [tool.setuptools.dynamic] -version = {attr = "undrdg.__version__"} +version = {attr = "undrdg.version.__version__"} readme = {file = ["README.md"], content-type = "text/markdown"} [tool.isort] diff --git a/scripts/dvs09/dvs09.py b/scripts/dvs09/dvs09.py index 05257bb..03248f0 100644 --- a/scripts/dvs09/dvs09.py +++ b/scripts/dvs09/dvs09.py @@ -1,6 +1,7 @@ # Before running this script, download the original dataset from http://sensors.ini.uzh.ch/databases.html. # Create the directories 'input' and 'output' next to this file. # Move the unzipped 'DVS09 - DVS128 sample data' directory in the 'input' directory. +# The file structure should be as follows. # # dvs09/ # ├─ input/ diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 0f12eda..222dd55 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -1,2 +1,2 @@ matplotlib -#undrdg +undrdg diff --git a/undrdg/version.py b/undrdg/version.py index 6d8a6ba..f89c9eb 100644 --- a/undrdg/version.py +++ b/undrdg/version.py @@ -1,3 +1,3 @@ -__version__ = "0.1.0" +__version__ = "0.1.1" """UNDRDG's version, conforms to Semantic Versioning 2.0.0. """