From 5c0e319daf63ea893854f5f0e0a22d40b4833401 Mon Sep 17 00:00:00 2001 From: Felipe Morato Date: Wed, 22 Feb 2023 09:48:56 +0200 Subject: [PATCH 1/3] Migrate to using pyproject.toml with hatch as build tool --- CHANGELOG.md | 1 + pyproject.toml | 67 +++++++++++++++++++++++ requirements.txt | 2 +- setup.py | 73 ------------------------- swift_browser_ui_frontend/dist/.gitkeep | 0 tox.ini | 2 +- 6 files changed, 70 insertions(+), 75 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py create mode 100644 swift_browser_ui_frontend/dist/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e767f37..8dc997303 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Migrate to using pyproject.toml with hatch as build tool - Allow installing js deps with pnpm install --prod for faster and smaller install - (GH #514) Cypress integration tests run against keystone-swift container from https://github.com/CSCfi/docker-keystone-swift. - Improved development workflow, and added development and testing instructions. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..0cb49d379 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,67 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "swift-browser-ui" +dynamic = ["version"] +description = "Object browser Web UI for Openstack Swift API" +readme = "README.md" +license = "MIT" +authors = [ + { name = "CSC Developers" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.10", + "Topic :: Internet :: WWW/HTTP :: HTTP Servers", +] +dependencies = [ + "aiohttp-session==2.12.0", + "aiohttp==3.8.3", + "aioredis==2.0.1", + "asyncpg==0.27.0", + "certifi==2022.12.7", + "click==8.1.3", + "cryptography==39.0.0", + "gunicorn==20.1.0", + "keystoneauth1==5.1.1", + "oidcrp==2.1.4", + "python-swiftclient==4.1.0", + "uvloop==0.17.0", +] + +[project.optional-dependencies] +docs = [ + "sphinx==6.1.3", + "sphinx_rtd_theme==1.2.0", +] +test = [ + "black==23.1.0", + "coverage==7.1.0", + "flake8-docstrings==1.7.0", + "flake8==6.0.0", + "pytest-cov==4.0.0", + "pytest-xdist==3.1.0", + "pytest==7.2.1", + "tox==4.4.4", +] +ui_test = [ + "pytest-timeout==2.1.0", + "pytest==7.2.1", +] + +[project.scripts] +swift-browser-ui = "swift_browser_ui.launcher:run_ui" +swift-sharing-request = "swift_browser_ui.launcher:run_request" +swift-upload-runner = "swift_browser_ui.launcher:run_upload" +swift-x-account-sharing = "swift_browser_ui.launcher:run_sharing" + +[project.urls] +Source = "https://github.com/CSCfi/swift-browser-ui" + +[tool.hatch.version] +path = "swift_browser_ui/__init__.py" diff --git a/requirements.txt b/requirements.txt index c1ef16325..945779fcf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ aioredis==2.0.1 asyncpg==0.27.0 certifi==2022.12.7 click==8.1.3 -cryptography==39.0.0 +cryptography==39.0.1 gunicorn==20.1.0 keystoneauth1==5.1.1 oidcrp==2.1.4 diff --git a/setup.py b/setup.py deleted file mode 100644 index a9fd8af27..000000000 --- a/setup.py +++ /dev/null @@ -1,73 +0,0 @@ -import setuptools -from swift_browser_ui import __name__, __version__, __author__ - - -setuptools.setup( - name=__name__, - version=__version__, - description="Object browser Web UI for Openstack Swift API", - author=__author__, - project_urls={ - "Source": "https://github.com/CSCfi/swift-browser-ui", - }, - license="MIT", - install_requires=[ - "aiohttp==3.8.3", - "aiohttp-session==2.12.0", - "aioredis==2.0.1", - "asyncpg==0.27.0", - "certifi==2022.12.7", - "click==8.1.3", - "cryptography==39.0.0", - "gunicorn==20.1.0", - "keystoneauth1==5.1.1", - "oidcrp==2.1.4", - "python-swiftclient==4.1.0", - "uvloop==0.17.0", - ], - extras_require={ - "test": [ - "black==23.1.0", - "flake8==6.0.0", - "coverage==7.1.0", - "flake8-docstrings==1.7.0", - "pytest==7.2.1", - "pytest-cov==4.0.0", - "pytest-xdist==3.1.0", - "tox==4.4.4", - ], - "docs": ["sphinx==6.1.3", "sphinx_rtd_theme==1.2.0"], - "ui_test": ["pytest==7.2.1", "pytest-timeout==2.1.0"], - }, - packages=setuptools.find_packages(), - package_data={ - __name__: [ - "ui/static/*", - "ui/static/js/*", - "ui/static/sw/*", - "ui/static/css/*", - "ui/static/img/*", - ] - }, - include_package_data=True, - platforms="any", - entry_points={ - "console_scripts": [ - "swift-browser-ui=swift_browser_ui.launcher:run_ui", - "swift-x-account-sharing=swift_browser_ui.launcher:run_sharing", - "swift-sharing-request=swift_browser_ui.launcher:run_request", - "swift-upload-runner=swift_browser_ui.launcher:run_upload", - ] - }, - classifiers=[ - "Development Status :: 4 - Beta", - # Indicate who your project is intended for - "Intended Audience :: Developers", - "Intended Audience :: Information Technology", - "Topic :: Internet :: WWW/HTTP :: HTTP Servers", - # Pick your license as you wish - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - ], -) diff --git a/swift_browser_ui_frontend/dist/.gitkeep b/swift_browser_ui_frontend/dist/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tox.ini b/tox.ini index 4c0258083..ff40352e6 100644 --- a/tox.ini +++ b/tox.ini @@ -58,7 +58,7 @@ deps = skip_instal = true deps = black -commands = black swift_browser_ui tests setup.py -l 90 --check +commands = black swift_browser_ui tests -l 90 --check [gh-actions] python = From 801240f208add987400d4f01413d90ce97cb2213 Mon Sep 17 00:00:00 2001 From: Felipe Morato Date: Wed, 22 Feb 2023 11:41:14 +0200 Subject: [PATCH 2/3] Update cryptography dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0cb49d379..fdab9dae1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ "asyncpg==0.27.0", "certifi==2022.12.7", "click==8.1.3", - "cryptography==39.0.0", + "cryptography==39.0.1", "gunicorn==20.1.0", "keystoneauth1==5.1.1", "oidcrp==2.1.4", From 6330907646509772451626878b8fd376dc4ac595 Mon Sep 17 00:00:00 2001 From: Felipe Morato Date: Fri, 24 Feb 2023 11:43:23 +0200 Subject: [PATCH 3/3] Add missing mypy and dev dependencies --- README.md | 5 ++--- pyproject.toml | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6694f572d..6f068c05f 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ pnpm install pnpm run build cd .. pip install -r requirements.txt -pip install . +pip install .[] ``` After install there should be `swift-browser-ui` command available: @@ -117,8 +117,7 @@ Install python dependencies, optionally in a virtual environment. ```bash python3 -m venv venv --prompt swiftui # Optional step, creates python virtual environment source venv/bin/activate # activates virtual environment -pip install -Ue . -pip install honcho # to run the Procfile +pip install -Ue .[docs,test,dev] ``` Set up the environment variables diff --git a/pyproject.toml b/pyproject.toml index fdab9dae1..6ff4b2f9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ test = [ "coverage==7.1.0", "flake8-docstrings==1.7.0", "flake8==6.0.0", + "mypy==1.0.1", "pytest-cov==4.0.0", "pytest-xdist==3.1.0", "pytest==7.2.1", @@ -53,6 +54,10 @@ ui_test = [ "pytest-timeout==2.1.0", "pytest==7.2.1", ] +dev = [ + "honcho==1.1.0", + "pyspelling==2.8.2", +] [project.scripts] swift-browser-ui = "swift_browser_ui.launcher:run_ui"