Skip to content
Snippets Groups Projects
Commit 954defec authored by Jérémy Bobbio (Lunar)'s avatar Jérémy Bobbio (Lunar)
Browse files

Migrate to copier-based swh-py-template

parent 9163523f
No related branches found
No related tags found
No related merge requests found
Pipeline #5654 passed
# 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 git loader
distribution_name: swh-loader-git
have_cli: false
have_workers: true
package_root: swh/loader/git
project_name: swh.loader.git
python_minimal_version: '3.7'
readme_format: rst
.eggs/
/sgloader/__pycache__/
/dataset/
*.egg-info/
*.pyc
/.coverage
/.coverage.*
/scratch/swhgitloader.cProfile
/scratch/swhgitloader.profile
/scratch/save.p
*.egg-info
version.txt
/resources/repo-linux-to-load.ini
/resources/repo-to-load.ini
.coverage
.eggs/
.hypothesis
.mypy_cache
.tox
__pycache__
build/
dist/
.hypothesis
.pytest_cache
.tox/
.mypy_cache/
docs/README.rst
docs/README.md
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]
......@@ -29,12 +39,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 ../../swh-docs/Makefile.sphinx
include swh-docs/Makefile.sphinx
[mypy]
namespace_packages = True
warn_unused_ignores = True
explicit_package_bases = True
# ^ Needed for mypy to detect py.typed from swh packages installed
# in editable mode
# 3rd party libraries without stubs (yet)
......
[project]
name = "swh.loader.git"
authors = [
{name="Software Heritage developers", email="swh-devel@inria.fr"},
]
description = "Software Heritage git loader"
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]
testing = {file = ["requirements.txt", "requirements-swh.txt", "requirements-test.txt"]}
[project.entry-points."swh.workers"]
"loader.git" = "swh.loader.git:register"
"loader.git_disk" = "swh.loader.git:register_from_disk"
"loader.git-checkout" = "swh.loader.git:register_checkout"
[project.urls]
"Homepage" = "https://gitlab.softwareheritage.org/swh/devel/swh-loader-git"
"Bug Reports" = "https://gitlab.softwareheritage.org/swh/devel/swh-loader-git/-/issues"
"Funding" = "https://www.softwareheritage.org/donate"
"Documentation" = "https://docs.softwareheritage.org/devel/swh-loader-git/"
"Source" = "https://gitlab.softwareheritage.org/swh/devel/swh-loader-git.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']
......
......@@ -5,4 +5,5 @@ markers =
fs: depends on writing to the filesystem
norecursedirs = build docs .*
asyncio_mode = strict
#!/usr/bin/env python3
# Copyright (C) 2015-2020 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(name=None):
if name:
reqf = "requirements-%s.txt" % name
else:
reqf = "requirements.txt"
requirements = []
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.loader.git",
description="Software Heritage git loader",
long_description=long_description,
long_description_content_type="text/x-rst",
python_requires=">=3.7",
author="Software Heritage developers",
author_email="swh-devel@inria.fr",
url="https://forge.softwareheritage.org/diffusion/DLDG/",
packages=find_packages(),
scripts=[],
install_requires=parse_requirements() + parse_requirements("swh"),
setup_requires=["setuptools-scm"],
use_scm_version=True,
extras_require={"testing": parse_requirements("test")},
include_package_data=True,
entry_points="""
[swh.workers]
loader.git=swh.loader.git:register
loader.git_disk=swh.loader.git:register_from_disk
loader.git-checkout=swh.loader.git:register_checkout
""",
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-loader-git",
"Documentation": "https://docs.softwareheritage.org/devel/swh-loader-git/",
},
)
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
[tox]
requires =
tox>4
envlist=black,flake8,mypy,py3
minversion = 4
envlist =
black
flake8
mypy
py3
[testenv]
extras =
testing
deps =
# the dependency below is needed for now as a workaround for
# https://github.com/pypa/pip/issues/6239
# TODO: remove when this issue is fixed
swh.core[testing] >= 0.0.61
swh.storage[testing]
swh.scheduler[testing] >= 0.5.0
pytest-cov
commands =
pytest --cov={envsitepackagesdir}/swh/loader/git \
pytest --doctest-modules \
--import-mode importlib \
--rootdir {envsitepackagesdir} \
--cov={envsitepackagesdir}/swh/loader/git \
--cov-branch \
{envsitepackagesdir}/swh/loader/git \
--cov-branch {posargs}
{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
......@@ -51,27 +55,11 @@ allowlist_externals = make
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
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