Skip to content
Snippets Groups Projects
Commit ea1e16e8 authored by David Douard's avatar David Douard
Browse files

Migrate to copier-based swh-py-template

parent accabc73
No related branches found
No related tags found
No related merge requests found
# Changes here will be overwritten by Copier
_commit: v0.1.5
_src_path: https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git
description: Software Heritage deposit server
distribution_name: swh-deposit
have_cli: true
have_workers: true
package_root: swh/deposit
project_name: swh.deposit
python_minimal_version: '3.7'
readme_format: rst
*.egg-info/
*.pyc
*.sw?
*~
/.coverage
/.coverage.*
.coverage
.eggs/
.hypothesis
.mypy_cache
.tox
__pycache__
*.egg-info/
version.txt
build/
dist/
/analysis.org
/swh/deposit/fixtures/private_data.yaml
/swh/deposit.json
/test.json
/swh/test
db.sqlite3
/.noseids
*.tgz
*.zip
*.tar.gz
*.tar.bz2
*.tar.lzma
.tox/
.mypy_cache/
.hypothesis/
docs/README.rst
docs/README.md
......@@ -2,14 +2,24 @@ exclude: ^swh/deposit/tests/data/atom/.*$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: check-json
- id: check-yaml
- repo: https://github.com/python/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear==22.9.23]
......@@ -32,12 +42,3 @@ repos:
language: system
types: [python]
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
- id: isort
- repo: https://github.com/python/black
rev: 22.10.0
hooks:
- id: black
include Makefile
include requirements*.txt
include version.txt
recursive-include swh/deposit/static *
recursive-include swh/deposit/fixtures *
recursive-include swh/deposit/templates *
recursive-include swh/deposit/tests/data *
recursive-include swh/deposit/tests/*/data *
recursive-include swh/deposit/xsd *
recursive-include swh py.typed
include tox.ini
include pytest.ini
_build/
apidoc/
*-stamp
include ../../swh-docs/Makefile.sphinx
include swh-docs/Makefile.sphinx
APIDOC_EXCLUDES += ../swh/*/settings/*
......
......@@ -9,6 +9,9 @@ plugins = mypy_django_plugin.main
[mypy.plugins.django-stubs]
django_settings_module = swh.deposit.settings.testing
explicit_package_bases = True
# ^ Needed for mypy to detect py.typed from swh packages installed
# in editable mode
# 3rd party libraries without stubs (yet)
......@@ -24,9 +27,6 @@ ignore_missing_imports = True
[mypy-psycopg2.*]
ignore_missing_imports = True
[mypy-pytest.*]
ignore_missing_imports = True
[tenacity.*]
ignore_missing_imports = True
......
[project]
name = "swh.deposit"
authors = [
{name="Software Heritage developers", email="swh-devel@inria.fr"},
]
description = "Software Heritage deposit server"
readme = {file = "README.rst", content-type = "text/x-rst"}
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
]
dynamic = ["version", "dependencies", "optional-dependencies"]
[tool.setuptools.packages.find]
include = ["swh.*"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt", "requirements-swh.txt"]}
[tool.setuptools.dynamic.optional-dependencies]
server = {file = ["requirements-server.txt", "requirements-swh-server.txt"]}
azure = {file = ["requirements-azure.txt"]}
testing = {file = [
"requirements-test.txt",
"requirements-server.txt",
"requirements-swh-server.txt",
"requirements-azure.txt",
]}
[project.entry-points."swh.cli.subcommands"]
"swh.deposit" = "swh.deposit.cli"
[project.entry-points."swh.workers"]
"swh.deposit" = "swh.deposit.loader:register"
[project.urls]
"Homepage" = "https://gitlab.softwareheritage.org/swh/devel/swh-deposit"
"Bug Reports" = "https://gitlab.softwareheritage.org/swh/devel/swh-deposit/-/issues"
"Funding" = "https://www.softwareheritage.org/donate"
"Documentation" = "https://docs.softwareheritage.org/devel/swh-deposit/"
"Source" = "https://gitlab.softwareheritage.org/swh/devel/swh-deposit.git"
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
fallback_version = "0.0.1"
[tool.black]
target-version = ['py37']
......
#!/usr/bin/env python3
# Copyright (C) 2015-2021 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from io import open
from os import path
from setuptools import find_packages, setup
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = f.read()
def parse_requirements(*names):
requirements = []
for name in names:
if name:
reqf = "requirements-%s.txt" % name
else:
reqf = "requirements.txt"
if not path.exists(reqf):
return requirements
with open(reqf) as f:
for line in f.readlines():
line = line.strip()
if not line or line.startswith("#"):
continue
requirements.append(line)
return requirements
setup(
name="swh.deposit",
description="Software Heritage Deposit Server",
long_description=long_description,
long_description_content_type="text/markdown",
python_requires=">=3.7",
author="Software Heritage developers",
author_email="swh-devel@inria.fr",
url="https://forge.softwareheritage.org/source/swh-deposit/",
packages=find_packages(),
install_requires=parse_requirements(None, "swh"),
tests_require=parse_requirements("test"),
setup_requires=["setuptools-scm"],
use_scm_version=True,
extras_require={
"testing": parse_requirements("test", "server", "swh-server"),
"server": parse_requirements("server", "swh-server"),
"azure": parse_requirements("azure"),
},
include_package_data=True,
entry_points="""
[console_scripts]
swh-deposit=swh.deposit.cli:main
[swh.cli.subcommands]
deposit=swh.deposit.cli
[swh.workers]
deposit.worker=swh.deposit.loader:register
""",
classifiers=[
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
],
project_urls={
"Bug Reports": "https://forge.softwareheritage.org/maniphest",
"Funding": "https://www.softwareheritage.org/donate",
"Source": "https://forge.softwareheritage.org/source/swh-deposit",
"Documentation": "https://docs.softwareheritage.org/devel/swh-deposit/",
},
)
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
[tox]
requires =
tox>4
envlist=flake8,mypy,py3-django2,py3-django3
minversion = 4
envlist =
black
flake8
mypy
py3-django2
py3-django3
[testenv]
extras =
......@@ -16,10 +20,16 @@ deps =
django2: Django>=2,<3
django3: Django>=3,<4
commands =
pytest \
!dev: --cov {envsitepackagesdir}/swh/deposit --cov-branch \
{envsitepackagesdir}/swh/deposit \
{posargs}
pytest --doctest-modules \
--import-mode importlib \
--rootdir {envsitepackagesdir} \
--cov={envsitepackagesdir}/swh/deposit \
--cov-branch \
{envsitepackagesdir}/swh/deposit \
{posargs}
# --rootdir and --import-mode are required to make tests that depends
# on the test file to be a proper submodule of the swh namespace after
# migration to PEP420 (implicit namespace).
[testenv:black]
skip_install = true
......@@ -52,32 +62,14 @@ commands =
# breaking doc build
[testenv:sphinx]
allowlist_externals = make
usedevelop = true
extras =
testing
deps =
# fetch and install swh-docs in develop mode
-e git+https://gitlab.softwareheritage.org/swh/devel/swh-docs.git\#egg=swh.docs
# fetch and install swh-docs
git+https://gitlab.softwareheritage.org/swh/devel/swh-docs.git\#egg=swh.docs
setenv =
SWH_PACKAGE_DOC_TOX_BUILD = 1
# turn warnings into errors
SPHINXOPTS = -W
commands =
make -I ../.tox/sphinx/src/swh-docs/swh/ -C docs
# build documentation only inside swh-environment using local state
# of swh-docs package
[testenv:sphinx-dev]
allowlist_externals = make
usedevelop = true
extras =
testing
deps =
# install swh-docs in develop mode
-e ../swh-docs
setenv =
SWH_PACKAGE_DOC_TOX_BUILD = 1
# turn warnings into errors
SPHINXOPTS = -W
commands =
make -I ../.tox/sphinx-dev/src/swh-docs/swh/ -C docs
make -I {env_dir}/share/ -C docs
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment