From b6a4538846b6dfde2cf7dc28cf1be51fb3c05968 Mon Sep 17 00:00:00 2001 From: Tom de Geus Date: Mon, 23 Oct 2023 20:53:41 +0200 Subject: [PATCH] Switching to `pyproject.toml` --- .pre-commit-config.yaml | 45 +++++++++++++++++++++---------------- pyproject.toml | 33 +++++++++++++++++++++++++++ setup.py | 50 ----------------------------------------- 3 files changed, 59 insertions(+), 69 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba11885..3b1513f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,52 +1,59 @@ repos: -- repo: https://github.com/psf/black - rev: 22.10.0 - hooks: - - id: black - args: [--safe, --quiet, --line-length=100] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml + - id: check-toml - id: debug-statements - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.4.0 + rev: v2.11.0 hooks: - id: pretty-format-yaml args: [--preserve-quotes, --autofix, --indent, '2'] + - id: pretty-format-toml + args: [--autofix] +- repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 + hooks: + - id: python-check-blanket-noqa + - id: python-check-blanket-type-ignore + - id: python-no-log-warn + - id: python-use-type-annotations + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal +- repo: https://github.com/psf/black + rev: 23.10.0 + hooks: + - id: black + args: [--safe, --quiet, --line-length=100] - repo: https://github.com/humitos/mirrors-autoflake.git rev: v1.1 hooks: - id: autoflake args: [--in-place, --remove-unused-variable] - repo: https://github.com/asottile/reorder_python_imports - rev: v3.9.0 + rev: v3.12.0 hooks: - id: reorder-python-imports - repo: https://github.com/asottile/pyupgrade - rev: v3.2.0 + rev: v3.15.0 hooks: - id: pyupgrade args: [--py36-plus] - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.1.0 hooks: - id: flake8 args: ['--ignore=E722,W503', --max-line-length=100, '--per-file-ignores=*/__init__.py:F401'] - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.2.0 + rev: v2.5.0 hooks: - id: setup-cfg-fmt - repo: https://github.com/tdegeus/conda_envfile - rev: v0.4.1 + rev: v0.4.2 hooks: - id: conda_envfile_parse - files: environment.yaml -# check docstrings -# - repo: https://github.com/econchick/interrogate -# rev: 1.4.0 -# hooks: -# - id: interrogate -# args: [-vv, -i, --fail-under=80] + files: environment.yaml \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f23f158 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] + +[project] +authors = [{name = "Tom de Geus", email = "tom@geus.me"}] +classifiers = ["License :: OSI Approved :: MIT License"] +dependencies = ["arxiv", "bibtexparser", "click", "docopt", "GitPython", "numpy", "PyYAML", "requests", "tqdm"] +description = "Reformat BibTeX files" +dynamic = ["version"] +name = "GooseBib" +readme = "README.md" +requires-python = ">=3.6" + +[project.scripts] +GbibCheckAuthors = "GooseBib.cli.GbibCheckAuthors:main" +GbibCheckKeys = "GooseBib.cli.GbibCheckKeys:main" +GbibCheckLink = "GooseBib.cli.GbibCheckLink:main" +GbibClean = "GooseBib.bibtex:GbibClean" +GbibDiscover = "GooseBib.bibtex:GbibDiscover" +GbibList = "GooseBib.cli.GbibList:main" +GbibParse = "GooseBib.cli.GbibParse:main" +GbibSelect = "GooseBib.cli.GbibSelect:main" +GbibSelectAlias = "GooseBib.cli.GbibSelectAlias:main" +GbibShowAuthorRename = "GooseBib.bibtex:GbibShowAuthorRename" + +[project.urls] +Source = "https://github.com/tdegeus/GooseBib" + +[tool.setuptools.package-data] +myModule = ["*.yaml"] + +[tool.setuptools_scm] +write_to = "GooseBib/_version.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index fa0ee04..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -from pathlib import Path - -from setuptools import find_packages -from setuptools import setup - -project_name = "GooseBib" - -this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() - -setup( - name=project_name, - license="MIT", - author="Tom de Geus", - author_email="tom@geus.me", - description="Reformat BibTeX files", - long_description=long_description, - long_description_content_type="text/markdown", - keywords="LaTeX; BibTeX", - url=f"https://github.com/tdegeus/{project_name:s}", - packages=find_packages(), - package_data={"": ["*.yaml"]}, - use_scm_version={"write_to": f"{project_name}/_version.py"}, - setup_requires=["setuptools_scm"], - install_requires=[ - "arxiv", - "bibtexparser", - "click", - "docopt", - "GitPython", - "numpy", - "PyYAML", - "requests", - "tqdm", - ], - entry_points={ - "console_scripts": [ - f"GbibCheckAuthors = {project_name}.cli.GbibCheckAuthors:main", - f"GbibCheckKeys = {project_name}.cli.GbibCheckKeys:main", - f"GbibCheckLink = {project_name}.cli.GbibCheckLink:main", - f"GbibClean = {project_name}.bibtex:GbibClean", - f"GbibList = {project_name}.cli.GbibList:main", - f"GbibParse = {project_name}.cli.GbibParse:main", - f"GbibSelect = {project_name}.cli.GbibSelect:main", - f"GbibSelectAlias = {project_name}.cli.GbibSelectAlias:main", - f"GbibShowAuthorRename = {project_name}.bibtex:GbibShowAuthorRename", - f"GbibDiscover = {project_name}.bibtex:GbibDiscover", - ] - }, -)