mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-24 16:20:59 +00:00
Improving contributing docs/process
This commit is contained in:
parent
30c208226e
commit
5a8b6bb3d0
10 changed files with 107 additions and 4 deletions
35
CONTRIBUTING.md
Normal file
35
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
# Contributing to Takahē
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Takahē requires Python 3.11
|
||||||
|
|
||||||
|
Create and activate a virtual environment
|
||||||
|
|
||||||
|
```
|
||||||
|
python3 -m venv .venv
|
||||||
|
. .venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
Install the development requirements:
|
||||||
|
|
||||||
|
```
|
||||||
|
pip install -r requirements-dev.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Enable git commit hooks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pre-commit install
|
||||||
|
```
|
||||||
|
|
||||||
|
Try running the tests:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pytest
|
||||||
|
```
|
||||||
|
|
||||||
|
# Code of Conduct
|
||||||
|
|
||||||
|
As a contributor, you can help us keep the Takahē community open and inclusive. Takahē
|
||||||
|
follows the [Django Project Code of Conduct](https://www.djangoproject.com/conduct/).
|
26
LICENSE
Normal file
26
LICENSE
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
Copyright 2022 Andrew Godwin
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
13
README.md
13
README.md
|
@ -8,3 +8,16 @@ Goals:
|
||||||
* Multiple account domains possible per server
|
* Multiple account domains possible per server
|
||||||
* Mastodon client API compatible
|
* Mastodon client API compatible
|
||||||
* Async evented core for fan-out/delivery
|
* Async evented core for fan-out/delivery
|
||||||
|
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
### Requirements:
|
||||||
|
|
||||||
|
- **Python** 3.11
|
||||||
|
- **Postgresql** 14+
|
||||||
|
- **Lots of patience** This is *very experimental*
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
If you'd like to contribute, please read [CONTRIBUTING.md](./CONTRIBUTING.md).
|
||||||
|
|
16
manage.py
16
manage.py
|
@ -3,10 +3,26 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
# List of settings files that should guard against running certain commands
|
||||||
|
GUARDED_ENVIRONMENTS = [
|
||||||
|
"production",
|
||||||
|
]
|
||||||
|
|
||||||
|
GUARDED_COMMANDS =[
|
||||||
|
"test",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Run administrative tasks."""
|
"""Run administrative tasks."""
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "takahe.settings.production")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "takahe.settings.production")
|
||||||
|
|
||||||
|
# Guard against running tests in arbitrary environments
|
||||||
|
env_name = os.environ["DJANGO_SETTINGS_MODULE"].rsplit(".", 1)[-1]
|
||||||
|
if env_name in GUARDED_ENVIRONMENTS:
|
||||||
|
for cmd in sys.argv:
|
||||||
|
if cmd in GUARDED_COMMANDS:
|
||||||
|
raise Exception(f"Cannot run {cmd} in {env_name}")
|
||||||
try:
|
try:
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
|
|
8
requirements-dev.txt
Normal file
8
requirements-dev.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
pre-commit~=2.20.0
|
||||||
|
-r requirements.txt
|
||||||
|
black==22.10.0
|
||||||
|
flake8==5.0.4
|
||||||
|
isort==5.10.1
|
||||||
|
pre-commit~=2.20.0
|
||||||
|
pytest-django~=4.5.2
|
||||||
|
pytest-httpx~=0.21
|
|
@ -10,6 +10,4 @@ uvicorn~=0.19
|
||||||
gunicorn~=20.1.0
|
gunicorn~=20.1.0
|
||||||
psycopg2~=2.9.5
|
psycopg2~=2.9.5
|
||||||
bleach~=5.0.1
|
bleach~=5.0.1
|
||||||
pytest-django~=4.5.2
|
|
||||||
pytest-httpx~=0.21
|
|
||||||
pydantic~=1.10.2
|
pydantic~=1.10.2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude = venv/*,tox/*,specs/*
|
exclude = .venv/*,venv/*,tox/*,specs/*
|
||||||
ignore = E123,E128,E203,E266,E402,F405,E501,W503,E731,W601
|
ignore = E123,E128,E203,E266,E402,F405,E501,W503,E731,W601
|
||||||
max-line-length = 119
|
max-line-length = 119
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
||||||
"HOST": os.environ.get("POSTGRES_HOST", "localhost"),
|
"HOST": os.environ.get("POSTGRES_HOST", "localhost"),
|
||||||
|
"PORT": os.environ.get("POSTGRES_PORT", 5432),
|
||||||
"NAME": os.environ.get("POSTGRES_DB", "takahe"),
|
"NAME": os.environ.get("POSTGRES_DB", "takahe"),
|
||||||
"USER": os.environ.get("POSTGRES_USER", "postgres"),
|
"USER": os.environ.get("POSTGRES_USER", "postgres"),
|
||||||
"PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
|
"PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
|
||||||
|
|
|
@ -11,3 +11,9 @@ MIDDLEWARE.insert(0, "core.middleware.AlwaysSecureMiddleware")
|
||||||
# Ensure debug features are on
|
# Ensure debug features are on
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
CRISPY_FAIL_SILENTLY = False
|
CRISPY_FAIL_SILENTLY = False
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = ["*"]
|
||||||
|
CSRF_TRUSTED_ORIGINS = [
|
||||||
|
"http://127.0.0.1:8000",
|
||||||
|
"https://127.0.0.1:8000",
|
||||||
|
]
|
||||||
|
|
|
@ -26,7 +26,7 @@ class ViewIdentity(TemplateView):
|
||||||
fetch=True,
|
fetch=True,
|
||||||
)
|
)
|
||||||
posts = identity.posts.all()[:100]
|
posts = identity.posts.all()[:100]
|
||||||
if identity.data_age > Config.load().IDENTITY_MAX_AGE:
|
if identity.data_age > Config.load().identity_max_age:
|
||||||
identity.transition_perform(IdentityStates.outdated)
|
identity.transition_perform(IdentityStates.outdated)
|
||||||
return {
|
return {
|
||||||
"identity": identity,
|
"identity": identity,
|
||||||
|
|
Loading…
Reference in a new issue