Compare commits

...

7 commits

Author SHA1 Message Date
Izalia Mae c67b26760b convert setup.cfg to pyproject.toml 2024-04-01 15:38:29 -04:00
Izalia Mae 3707d3f5f6 change metadata name to ActivityRelay 2024-04-01 15:12:01 -04:00
Izalia Mae 87d58c95e6 fetch barkshark-sql from pypi 2024-04-01 14:49:40 -04:00
Izalia Mae 22bba6e85e use jinja2-haml from pypi
jinja2-haml is the renamed hamlish-jinja fork at https://git.barkshark.xyz/barkshark/hamlish-jinja
2024-04-01 13:09:54 -04:00
Izalia Mae 12b9ee317a simplify dev lint command with watch flag 2024-04-01 13:05:32 -04:00
Izalia Mae 9708d526a9 use correct license name 2024-04-01 13:04:41 -04:00
Izalia Mae 673175b80b add clean dev command 2024-04-01 07:18:10 -04:00
7 changed files with 92 additions and 68 deletions

2
.gitignore vendored
View file

@ -12,7 +12,7 @@ __pycache__/
env/ env/
build/ build/
develop-eggs/ develop-eggs/
dist/ dist*/
downloads/ downloads/
eggs/ eggs/
.eggs/ .eggs/

View file

@ -1,7 +1,59 @@
[build-system] [build-system]
requires = ["setuptools","wheel"] requires = ["setuptools>=61.2"]
build-backend = 'setuptools.build_meta' build-backend = "setuptools.build_meta"
[project]
name = "ActivityRelay"
description = "Generic LitePub relay (works with all LitePub consumers and Mastodon)"
license = {text = "AGPLv3"}
classifiers = [
"Environment :: Console",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.8"
dynamic = ["version", "dependencies", "optional-dependencies"]
[project.readme]
file = "README.md"
content-type = "text/markdown; charset=UTF-8"
[project.urls]
Documentation = "https://git.pleroma.social/pleroma/relay/-/blob/main/docs/index.md"
Source = "https://git.pleroma.social/pleroma/relay"
Tracker = "https://git.pleroma.social/pleroma/relay/-/issues"
[project.scripts]
activityrelay = "relay.manage:main"
[tool.setuptools]
zip-safe = false
packages = [
"relay",
"relay.database",
"relay.views",
]
include-package-data = true
license-files = ["LICENSE"]
[tool.setuptools.package-data]
relay = [
"data/*",
"frontend/*",
"frontend/page/*",
"frontend/static/*"
]
[tool.setuptools.dynamic]
version = {attr = "relay.__version__"}
dependencies = {file = ["requirements.txt"]}
[tool.setuptools.dynamic.optional-dependencies]
dev = {file = ["dev-requirements.txt"]}
[tool.mypy] [tool.mypy]
show_traceback = true show_traceback = true

View file

@ -1,5 +1,6 @@
import click import click
import platform import platform
import shutil
import subprocess import subprocess
import sys import sys
import time import time
@ -46,21 +47,23 @@ def cli_install():
@cli.command('lint') @cli.command('lint')
@click.argument('path', required = False, default = 'relay') @click.argument('path', required = False, type = Path, default = REPO.joinpath('relay'))
@click.option('--strict', '-s', is_flag = True, help = 'Enable strict mode for mypy') @click.option('--strict', '-s', is_flag = True, help = 'Enable strict mode for mypy')
@click.option('--watch', '-w', is_flag = True, @click.option('--watch', '-w', is_flag = True,
help = 'Automatically, re-run the linters on source change') help = 'Automatically, re-run the linters on source change')
def cli_lint(path: str, strict: bool, watch: bool) -> None: def cli_lint(path: Path, strict: bool, watch: bool) -> None:
flake8 = [sys.executable, '-m', 'flake8', path] path = path.expanduser().resolve()
mypy = [sys.executable, '-m', 'mypy', path]
if watch:
handle_run_watcher([sys.executable, "-m", "relay.dev", "lint", str(path)], wait = True)
return
flake8 = [sys.executable, '-m', 'flake8', str(path)]
mypy = [sys.executable, '-m', 'mypy', str(path)]
if strict: if strict:
mypy.append('--strict') mypy.append('--strict')
if watch:
handle_run_watcher(mypy, flake8, wait = True)
return
click.echo('----- flake8 -----') click.echo('----- flake8 -----')
subprocess.run(flake8) subprocess.run(flake8)
@ -68,6 +71,24 @@ def cli_lint(path: str, strict: bool, watch: bool) -> None:
subprocess.run(mypy) subprocess.run(mypy)
@cli.command('clean')
def cli_clean():
dirs = {
'dist',
'build',
'dist-pypi'
}
for directory in dirs:
shutil.rmtree(directory, ignore_errors = True)
for path in REPO.glob('*.egg-info'):
shutil.rmtree(path)
for path in REPO.glob('*.spec'):
path.unlink()
@cli.command('build') @cli.command('build')
def cli_build(): def cli_build():
with TemporaryDirectory() as tmp: with TemporaryDirectory() as tmp:

View file

@ -2,10 +2,10 @@ activitypub-utils == 0.2.1
aiohttp >= 3.9.1 aiohttp >= 3.9.1
aiohttp-swagger[performance] == 1.0.16 aiohttp-swagger[performance] == 1.0.16
argon2-cffi == 23.1.0 argon2-cffi == 23.1.0
barkshark-sql @ https://git.barkshark.xyz/barkshark/bsql/archive/0.1.2.tar.gz barkshark-sql == 0.1.2
click >= 8.1.2 click >= 8.1.2
hamlish-jinja @ https://git.barkshark.xyz/barkshark/hamlish-jinja/archive/0.3.5.tar.gz
hiredis == 2.3.2 hiredis == 2.3.2
jinja2-haml == 0.3.5
markdown == 3.5.2 markdown == 3.5.2
platformdirs == 4.2.0 platformdirs == 4.2.0
pyyaml >= 6.0 pyyaml >= 6.0

View file

@ -1,51 +0,0 @@
[metadata]
name = relay
version = attr: relay.__version__
description = Generic LitePub relay (works with all LitePub consumers and Mastodon)
long_description = file: README.md
long_description_content_type = text/markdown; charset=UTF-8
url = https://git.pleroma.social/pleroma/relay
license = AGPLv3
license_file = LICENSE
classifiers =
Environment :: Console
License :: OSI Approved :: AGPLv3 License
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
project_urls =
Source = https://git.pleroma.social/pleroma/relay
Tracker = https://git.pleroma.social/pleroma/relay/-/issues
[options]
zip_safe = False
packages =
relay
relay.database
relay.views
include_package_data = true
install_requires = file: requirements.txt
python_requires = >=3.8
[options.extras_require]
dev = file: dev-requirements.txt
[options.package_data]
relay =
data/*
frontend/*
frontend/page/*
[options.entry_points]
console_scripts =
activityrelay = relay.manage:main
[flake8]
extend-ignore = E128,E251,E261,E303,W191
max-line-length = 100
indent-size = 4
per-file-ignores =
__init__.py: F401

View file

@ -1,4 +0,0 @@
import setuptools
if __name__ == "__main__":
setuptools.setup()

6
tox.ini Normal file
View file

@ -0,0 +1,6 @@
[flake8]
extend-ignore = E128,E251,E261,E303,W191
max-line-length = 100
indent-size = 4
per-file-ignores =
__init__.py: F401