From dbbb4073a8d00f2a5a974f7ed61b5d1cafc6b18a Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 7 Feb 2024 19:56:02 +0000 Subject: [PATCH 01/10] Migrate mypy and pytest config --- pyproject.toml | 25 ++++++++++++++++++++++++- setup.cfg | 14 -------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c340ca8..d8098e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,27 @@ -# TODO: Move entire setup.cfg to pyproject.toml +[build-system] +build-backend = "setuptools.build_meta" +# Version 64.0.0 is needed for editable installs without setup.py file +# https://setuptools.pypa.io/en/latest/references/keywords.html +requires = [ + "setuptools>=64.0.0", + "wheel" +] + +[tool] + +[tool.mypy] +warn_unused_configs = true +disallow_untyped_calls = true + +[[tool.mypy.overrides]] +module = "docker.*" +ignore_missing_imports = true + +[tool.pytest.ini_options] +addopts = ["--cov=aiidalab_launch", "--cov-fail-under=80"] +asyncio_mode = "auto" +markers = ["slow: marks tests as slow"] +filterwarnings = ["ignore::DeprecationWarning:docker.*:"] [tool.ruff] line-length = 88 diff --git a/setup.cfg b/setup.cfg index de59097..17a184e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,12 +45,6 @@ tests = pytest-cov~=4.1.0 responses~=0.23.1 -[mypy] -warn_unused_configs = True -disallow_untyped_calls = True - -[mypy-docker.*] -ignore_missing_imports = True [bumpver] current_version = "v2023.1019" @@ -63,11 +57,3 @@ push = True [bumpver:file_patterns] aiidalab_launch/version.py = __version__ = "{version}" - -[tool:pytest] -addopts = --cov=aiidalab_launch --cov-fail-under=80 -asyncio_mode = auto -markers = - slow: marks tests as slow -filterwarnings = - ignore::DeprecationWarning:docker.*: From e6c045cd421e1fb8ddabae74ff215dfa1a26793c Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 7 Feb 2024 19:56:22 +0000 Subject: [PATCH 02/10] Remove check-manifest pre-commit hook --- .pre-commit-config.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cb9615..ca1b0f8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,8 +34,3 @@ repos: - types-requests - types-tabulate - types-toml - - - repo: https://github.com/mgedmin/check-manifest - rev: '0.49' - hooks: - - id: check-manifest From df5d3d915773ef32b9fb67dde870895570885495 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 7 Feb 2024 20:03:03 +0000 Subject: [PATCH 03/10] Remove setup.py --- setup.py | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 5948248..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -"""This file is required for editable installs of the package.""" -from setuptools import setup - -setup() From a7599c7ec9b0bdab4f19ba6797a02fe966de335e Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 7 Feb 2024 20:40:48 +0000 Subject: [PATCH 04/10] Migrate fully to pyproject and flit --- pyproject.toml | 72 +++++++++++++++++++++++++++++++++++++++++++++----- setup.cfg | 59 ----------------------------------------- 2 files changed, 66 insertions(+), 65 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index d8098e5..a21bc9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,57 @@ [build-system] -build-backend = "setuptools.build_meta" -# Version 64.0.0 is needed for editable installs without setup.py file -# https://setuptools.pypa.io/en/latest/references/keywords.html -requires = [ - "setuptools>=64.0.0", - "wheel" +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "aiidalab_launch" +authors = [{name = "Carl Simon Adorf and the AiiDAlab team", email = "aiidalab@materialscloud.org"}] +readme = "README.md" +license = {file = "LICENSE"} +description = "Tool to launch AiiDAlab on a local workstation." +dynamic = ["version"] +requires-python = '>=3.8' + +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'Framework :: AiiDA', + 'License :: OSI Approved :: MIT License', + 'Operating System :: POSIX :: Linux', + 'Operating System :: MacOS :: MacOS X', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: Implementation :: CPython', + 'Topic :: Scientific/Engineering', +] + +dependencies = [ + 'click==8.1', + 'click-spinner==0.1.10', + 'docker==7.0.0', + 'packaging==21.3', + 'requests==2.26.0', + 'requests-cache==0.9.1', + 'tabulate==0.9.0', + 'toml==0.10.2', +] + +[project.scripts] +aiidalab-launch = "aiidalab_launch.__main__:cli" + +[project.urls] +Home = "https://github.com/aiidalab/aiidalab-launch" + +[project.optional-dependencies] +dev = [ + 'bumpver==2023.1129', + 'dunamai==1.19.0', + 'pre-commit>=3.5.0', +] + +tests = [ + 'pytest~=7.4.3', + 'pytest-asyncio~=0.21.1', + 'pytest-cov~=4.1.0', + 'responses~=0.23.1', ] [tool] @@ -46,3 +93,16 @@ select = [ [tool.ruff.lint.per-file-ignores] "tests/*" = ["ARG001"] + +[tool.bumpver] +current_version = "v2023.1019" +version_pattern = "vYYYY.BUILD[PYTAGNUM]" +commit_message = "Bump version {old_version} -> {new_version}" +commit = true +tag = true +push = true + +[tool.bumpver.file_patterns] +"aiidalab_launch/version.py" = [ + '__version__ = "{version}"', +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 17a184e..0000000 --- a/setup.cfg +++ /dev/null @@ -1,59 +0,0 @@ -[metadata] -name = aiidalab_launch -version = attr: aiidalab_launch.__version__ -description = Tool to launch AiiDAlab on a local workstation. -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/aiidalab/aiidalab-launch -author = Carl Simon Adorf and the AiiDAlab team -author_email = aiidalab@materialscloud.org -license = MIT -license_files = LICENSE -classifiers = - Development Status :: 4 - Beta - Framework :: AiiDA - License :: OSI Approved :: MIT License - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: Implementation :: CPython - -[options] -packages = find: -install_requires = - click==8.1 - click-spinner==0.1.10 - docker==7.0.0 - packaging==21.3 - requests==2.26.0 - requests-cache==0.9.1 - tabulate==0.9.0 - toml==0.10.2 -python_requires = >=3.8 - -[options.entry_points] -console_scripts = - aiidalab-launch = aiidalab_launch.__main__:cli - -[options.extras_require] -dev = - bumpver==2023.1129 - dunamai==1.19.0 - pre-commit==3.5.0 -tests = - pytest~=7.4.3 - pytest-asyncio~=0.21.1 - pytest-cov~=4.1.0 - responses~=0.23.1 - - -[bumpver] -current_version = "v2023.1019" -version_pattern = "vYYYY.BUILD[PYTAGNUM]" -commit_message = "Bump version {old_version} -> {new_version}" -commit = True -tag = True -push = True - -[bumpver:file_patterns] -aiidalab_launch/version.py = - __version__ = "{version}" From a8a6400762faedc029ff753bb8e4d21637799a0e Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 7 Feb 2024 20:41:20 +0000 Subject: [PATCH 05/10] remove check-toml hook, ruff gets us covered --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ca1b0f8..92bacc7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,6 @@ repos: rev: v4.5.0 hooks: - id: check-yaml - - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace From 794f174a667d0bf8e556f45e2cd865b7949b9959 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 7 Feb 2024 20:49:07 +0000 Subject: [PATCH 06/10] Move .coveragerc to pyproject --- .coveragerc | 11 ----------- MANIFEST.in | 1 - pyproject.toml | 11 +++++++++++ 3 files changed, 11 insertions(+), 12 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 55bce31..0000000 --- a/.coveragerc +++ /dev/null @@ -1,11 +0,0 @@ -# .coveragerc to control coverage.py -[run] -omit = - */venv/* - */tests/* - */docs/* - */dist/* - setup.py - -[html] -directory=./htmlcov diff --git a/MANIFEST.in b/MANIFEST.in index acc2f99..ab890ff 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,7 +4,6 @@ recursive-exclude tests * exclude .pre-commit-config.yaml exclude .readthedocs.yml -include .coveragerc include CHANGELOG.md include CONTRIBUTING.md include LICENSE diff --git a/pyproject.toml b/pyproject.toml index a21bc9c..b005a44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,3 +106,14 @@ push = true "aiidalab_launch/version.py" = [ '__version__ = "{version}"', ] + +[tool.coverage.run] +omit = [ + '*/venv/*', + '*/tests/*', + '*/docs/*', + '*/dist/*', +] + +[tool.coverage.html] +directory = './htmlcov' From d60390bb6a57e7c554530f6410620b38f6698bee Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 7 Feb 2024 21:02:39 +0000 Subject: [PATCH 07/10] Add cache folders to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ee78566..d48f0a8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ __pycache__/ build/ dist/ docs/_build/ +*cache/ From 8215a534ac480faf69e5893b2ca23cc6adfeaac9 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 7 Feb 2024 21:36:08 +0000 Subject: [PATCH 08/10] Revert "Add cache folders to gitignore" This reverts commit d60390bb6a57e7c554530f6410620b38f6698bee. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index d48f0a8..ee78566 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ __pycache__/ build/ dist/ docs/_build/ -*cache/ From 8e9023e7f6acde926d39309229c0e52a98dddb59 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Thu, 15 Feb 2024 15:29:33 +0000 Subject: [PATCH 09/10] Flit include/exclude in pyproject.toml --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index b005a44..6cfad3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,10 @@ tests = [ [tool] +[tool.flit.sdist] +exclude = ["tests", "aiidalab_launch/.mypy_cache"] +include = ["*.md", "LICENSE", "logos/*.png"] + [tool.mypy] warn_unused_configs = true disallow_untyped_calls = true From 26f0cee1050b8614479f94c0ed651265dd573771 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Thu, 15 Feb 2024 15:30:18 +0000 Subject: [PATCH 10/10] Remove MANIFEST.in --- MANIFEST.in | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index ab890ff..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,12 +0,0 @@ -exclude tests -recursive-exclude tests * - -exclude .pre-commit-config.yaml -exclude .readthedocs.yml - -include CHANGELOG.md -include CONTRIBUTING.md -include LICENSE -include README.md -include ssh-forward.md -recursive-include logos *.png