From 2602093b4fcbde14c15b8cdb80e5d3ac991a6767 Mon Sep 17 00:00:00 2001 From: "r.jaepel" <ronald.jaepel@gmail.com> Date: Tue, 20 Feb 2024 10:42:00 +0100 Subject: [PATCH] Switch to pyproject.toml --- .gitignore | 3 +- cadetrdm/__init__.py | 7 ++-- cadetrdm/initialize_repo.py | 2 +- cadetrdm/repositories.py | 3 +- cadetrdm/version.py | 1 - docs/source/conf.py | 6 +-- pyproject.toml | 79 ++++++++++++++++++++++++++++++++++++- setup.cfg | 68 ------------------------------- setup.py | 6 --- 9 files changed, 89 insertions(+), 86 deletions(-) delete mode 100644 cadetrdm/version.py delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index c44a98c..881fb92 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ tests/test_repo* dist .token tmp -.ipynb_checkpoints \ No newline at end of file +.ipynb_checkpoints +/tests/non_rdm_repo/ diff --git a/cadetrdm/__init__.py b/cadetrdm/__init__.py index 79c8268..32b67a7 100644 --- a/cadetrdm/__init__.py +++ b/cadetrdm/__init__.py @@ -1,6 +1,5 @@ -from .repositories import ProjectRepo, JupyterInterfaceRepo -from .initialize_repo import initialize_repo, clone from .conda_env_utils import prepare_conda_env -from .version import version +from .initialize_repo import initialize_repo, clone +from .repositories import ProjectRepo, JupyterInterfaceRepo -__version__ = version +__version__ = "0.0.19" diff --git a/cadetrdm/initialize_repo.py b/cadetrdm/initialize_repo.py index 927f821..5d99595 100644 --- a/cadetrdm/initialize_repo.py +++ b/cadetrdm/initialize_repo.py @@ -1,5 +1,5 @@ -import os import json +import os import uuid from pathlib import Path diff --git a/cadetrdm/repositories.py b/cadetrdm/repositories.py index 1b64226..af9d3a4 100644 --- a/cadetrdm/repositories.py +++ b/cadetrdm/repositories.py @@ -12,10 +12,10 @@ from urllib.request import urlretrieve from tabulate import tabulate +import cadetrdm from cadetrdm.io_utils import recursive_chmod, write_lines_to_file, wait_for_user, init_lfs from cadetrdm.jupyter_functionality import Notebook from cadetrdm.remote_integration import GitHubRemote, GitLabRemote -from cadetrdm.version import version as cadetrdm_version try: import git @@ -601,6 +601,7 @@ class ProjectRepo(BaseRepo): with open(repository_path / ".cadet-rdm-data.json", "r") as handle: metadata = json.load(handle) repo_version = metadata["cadet_rdm_version"] + cadetrdm_version = cadetrdm.__version__ if cadetrdm_version != repo_version: print(f"Repo version {repo_version} is outdated. Current CADET-RDM version is {cadetrdm_version}\n" "Updating the repository now.") diff --git a/cadetrdm/version.py b/cadetrdm/version.py deleted file mode 100644 index adaa077..0000000 --- a/cadetrdm/version.py +++ /dev/null @@ -1 +0,0 @@ -version = "0.0.19" diff --git a/docs/source/conf.py b/docs/source/conf.py index 433ef56..5644d71 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,6 +13,8 @@ import os import sys +import cadetrdm + sys.path.insert(0, os.path.abspath('../..')) from datetime import date @@ -22,10 +24,8 @@ project = 'CADET-RDM' copyright = f'2023-{date.today().year}' author = 'IBG-1 ModSim Group' -import cadetrdm - version = cadetrdm.__version__ -release = cadetrdm.__version__.replace("_", "") +release = version.replace("_", "") # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 8cf3256..51101c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,80 @@ [build-system] requires = ["setuptools>=61.0"] -build-backend = "setuptools.build_meta" \ No newline at end of file +build-backend = "setuptools.build_meta" + +[project] +name = "CADET-RDM" +dynamic = ["version"] +authors = [ + { name = "Ronald Jäpel", email = "r.jaepel@fz-juelich.de" }, + { name = "Johannes Schmölder", email = "j.schmoelder@fz-juelich.de" }, + { name = "Eric von Lieres", email = "e.von.lieres@fz-juelich.de" } +] +description = "A Python toolbox for research data management." +readme = "README.md" +requires-python = ">3.7" +keywords = ["research data management"] +license = { text = "GPLv3" } +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", + "License :: OSI Approved :: GNU General Public License v3", + "Intended Audience :: Science/Research", +] +dependencies = [ + "gitpython>=3.1", + "python-gitlab", + "pygithub", + "git-lfs", + "click", + "tabulate", + "keyring", +] + +[project.scripts] +rdm = "cadetrdm.cli_integration:cli" + + +[project.urls] +homepage = "https://jugit.fz-juelich.de/IBG-1/ModSim/cadet/CADET-RDM" +documentation = "https://cadet-rdm.readthedocs.io/en/latest/index.html" +"Bug Tracker" = "https://jugit.fz-juelich.de/IBG-1/ModSim/cadet/CADET-RDM/Issues" + + +[project.optional-dependencies] +testing = [ + "setuptools", + "pytest", + "certifi", # tries to prevent certificate problems on windows + "pre-commit", # system tests run pre-commit + "flake8", # system tests run flake8 + "matplotlib", + "numpy", + "build", +] +jupyter = [ + "nbformat", + "nbconvert", + "ipylab", + "junix", + "jupytext", +] +docs = [ + "sphinx>=5.3.0", + "sphinxcontrib-bibtex>=2.5.0", + "sphinx_book_theme>=1.0.0", + "sphinx_copybutton>=0.5.1", + "sphinx-sitemap>=2.5.0", + "numpydoc>=1.5.0", + "myst-nb>=0.17.1", +] + + +[tool.pytest.ini_options] +markers = [ + "slow: marks tests as slow (deselect with '-m \"not slow\"')", + "server_api: marks tests as using the GitLab/GitHub API" +] + +[tool.setuptools.dynamic] +version = { attr = "cadetrdm.__version__" } diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2fa3638..0000000 --- a/setup.cfg +++ /dev/null @@ -1,68 +0,0 @@ -[metadata] -name = CADET-RDM -version = 0.0.19 -author = ModSim -author_email = r.jaepel@fz-juelich.de -description = A solution for research data management -long_description = file: README.md -long_description_content_type = text/markdown -url = https://jugit.fz-juelich.de/IBG-1/ModSim/cadet/CADET-RDM -project_urls = - Bug Tracker = https://jugit.fz-juelich.de/IBG-1/ModSim/cadet/CADET-RDM/Issues -classifiers = - Programming Language :: Python :: 3 - License :: OSI Approved :: GNU General Public License v3 (GPLv3) - Operating System :: OS Independent - -[options] -packages = find: -python_requires = >=3.8 -install_requires = - gitpython>=3.1 - python-gitlab - pygithub - git-lfs - click - tabulate - keyring - -include_package_data = True - -[options.entry_points] -console_scripts = - rdm = cadetrdm.cli_integration:cli - -[options.extras_require] -testing = - setuptools - pytest - certifi # tries to prevent certificate problems on windows - pre-commit # system tests run pre-commit - flake8 # system tests run flake8 - matplotlib - numpy - build - -jupyter = - nbformat - nbconvert - ipylab - junix - jupytext - -docs = - sphinx>=5.3.0 - sphinxcontrib-bibtex>=2.5.0 - sphinx_book_theme>=1.0.0 - sphinx_copybutton>=0.5.1 - sphinx-sitemap>=2.5.0 - numpydoc>=1.5.0 - myst-nb>=0.17.1 - -[flake8] -max_line_length = 88 -exclude = - build - dist - .eggs - docs/conf.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 45f160d..0000000 --- a/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -import setuptools - -if __name__ == "__main__": - setuptools.setup() \ No newline at end of file -- GitLab