Skip to content

Commit

Permalink
Fix issue #545: migrate to pyproject.toml (#547)
Browse files Browse the repository at this point in the history
* enable editable mode via pyproject.toml

* fix issue #545 migrate to pyproject.toml

* fix license field and fix min python version

* Remove version from apispec.yaml

* remove gramps_webpi/_version.py from git cache

---------

Co-authored-by: David Straub <[email protected]>
  • Loading branch information
JohnRDOrazio and DavidMStraub authored Sep 4, 2024
1 parent df1e6d2 commit 9085f1e
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 194 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Generated by setuptools_scm, should be ignored by VCS
gramps_webapi/_version.py
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
repos:
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.4.2
rev: v5.10.1
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/psf/black
rev: 22.8.0
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.782
rev: v1.11.2
hooks:
- id: mypy
args: [--ignore-missing-imports]
- repo: https://github.com/PyCQA/pylint
rev: pylint-2.5.3
rev: v3.2.7
hooks:
- id: pylint
stages: [commit]
args:
- --score=n
- repo: https://github.com/PyCQA/pydocstyle
rev: 5.0.2
rev: 6.3.0
hooks:
- id: pydocstyle
stages: [commit]
82 changes: 4 additions & 78 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ suggestion-mode=yes
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no


[MESSAGES CONTROL]

# Only show warnings with the listed confidence levels. Leave empty to show
Expand All @@ -60,87 +59,14 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
bad-whitespace,
bad-continuation
use-symbolic-message-instead

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -588,5 +514,5 @@ valid-metaclass-classmethod-first-arg=cls

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
21 changes: 0 additions & 21 deletions gramps_webapi/_version.py

This file was deleted.

1 change: 0 additions & 1 deletion gramps_webapi/data/apispec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ info:
* More about Gramps and the numerous features it provides for genealogists can be found at https://gramps-project.org
version: "2.4.2" # make sure to match this version with the one in _version.py
license:
name: "GNU Affero General Public License v3.0"
url: "http://www.gnu.org/licenses/agpl-3.0.html"
Expand Down
64 changes: 64 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[project]
name = "gramps-webapi"
description = "A RESTful web API for the Gramps genealogical database."
authors = [
{ name = "Gramps Development Team" },
{ name = "David M. Straub", email = "[email protected]" }
]
license = { text = "AGPL-3.0-or-later" }
readme = "README.md"
dynamic = ["version"]
keywords = ["RESTful", "web API", "genealogy", "Gramps"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Operating System :: OS Independent",
]
requires-python = ">=3.8"
dependencies = [
"gramps-desktop[GUI,i18n]==5.2.*",
"Click>=7.0",
"Flask>=2.1.0",
"Flask-Caching>=2.0.0",
"Flask-Compress",
"Flask-Cors",
"Flask-JWT-Extended>=4.2.1,!=4.4.0,!=4.4.1",
"Flask-Limiter>=2.9.0",
"Flask-SQLAlchemy",
"marshmallow>=3.13.0",
"webargs",
"SQLAlchemy",
"pdf2image",
"Pillow",
"bleach[css]>=5.0.0",
"jsonschema",
"ffmpeg-python",
"boto3",
"alembic",
"celery[redis]",
"Unidecode",
"pytesseract",
"gramps-ql>=0.3.0",
"sifts>=0.8.3",
]

[project.urls]
homepage = "https://github.com/gramps-project/gramps-web-api"
repository = "https://github.com/gramps-project/gramps-web-api"


[build-system]
requires = ["setuptools>=64.0", "setuptools_scm[toml]>=6.2", "wheel"]
build-backend = "setuptools.build_meta"

[tool.isort]
profile = "black"

[tool.setuptools_scm]
# NOTE: Using a version file avoids some overhead
#
# This file is explicitly ignored by version control.
write_to = "gramps_webapi/_version.py"

[tool.setuptools.packages.find]
include = ["gramps_webapi", "gramps_webapi.*"]
52 changes: 2 additions & 50 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,6 @@

"""The setup script."""

from setuptools import find_packages, setup
from setuptools import setup # pylint: disable=E0401

with open("README.md") as readme_file:
README = readme_file.read()

with open("gramps_webapi/_version.py") as version_file:
exec(version_file.read())


REQUIREMENTS = [
"gramps-desktop[GUI,i18n]==5.2.*",
"Click>=7.0",
"Flask>=2.1.0",
"Flask-Caching>=2.0.0",
"Flask-Compress",
"Flask-Cors",
"Flask-JWT-Extended>=4.2.1, !=4.4.0, !=4.4.1",
"Flask-Limiter>=2.9.0",
"Flask-SQLAlchemy",
"marshmallow>=3.13.0",
"webargs",
"SQLAlchemy",
"pdf2image",
"Pillow",
"bleach[css]>=5.0.0",
"jsonschema",
"ffmpeg-python",
"boto3",
"alembic",
"celery[redis]",
"Unidecode",
"pytesseract",
"gramps-ql>=0.3.0",
"sifts>=0.8.3",
]

setup(
author="Gramps Development Team",
url="https://github.com/gramps-project/web-api",
python_requires=">=3.8",
description="A RESTful web API for the Gramps genealogical database.",
license="AGPL v3 or greater",
install_requires=REQUIREMENTS,
long_description=README,
long_description_content_type="text/markdown",
include_package_data=True,
name="gramps-webapi",
packages=find_packages(include=["gramps_webapi", "gramps_webapi.*"]),
version=__version__,
zip_safe=False,
)
setup()
39 changes: 0 additions & 39 deletions tests/test_version.py

This file was deleted.

0 comments on commit 9085f1e

Please sign in to comment.