Maintenance tasks

- switch to Poetry
- document translations
- update ChangeLog
This commit is contained in:
Jan Dittberner 2023-06-03 16:06:25 +02:00
parent d02f4906e1
commit 362b6dff35
13 changed files with 1497 additions and 173 deletions

View file

@ -1,3 +1,8 @@
2023-06-03 Jan Dittberner <jan@dittberner.info>
* add updated translations from Weblate
* switch to Poetry for dependency management
* describe translation workflow in developer documentation
2022-09-24 Jan Dittberner <jan@dittberner.info>
* add updated translations from Weblate
* update dependencies

14
README.md Normal file
View file

@ -0,0 +1,14 @@
# Debian Member Portfolio Service
This is a service implementation that returns a set of personalized URLs as outlined in
https://wiki.debian.org/DDPortfolio. It takes the Debian Member's full name and email address as input and returns
a JSON formatted array or an HTML page of URLs.
See https://debian-member-portfolio-service.readthedocs.org/ for more documentation (or its source in
docs/source/devdocs.rst), including how to configure a development environment.
## Translations
Translations for the Debian Member Portfolio service are maintained using
[Weblate](https://hosted.weblate.org/projects/debian-member-portfolio-service/translations/). Thanks to Weblate for
hosting the translation service and to all contributors of translations.

View file

@ -1,11 +0,0 @@
This is the source code for the Debian Member Portfolio Service
application [0].
Cf. https://debian-member-portfolio-service.readthedocs.org/ for more
documentation (or its source in docs/source/devdocs.rst), including
how to configure a development environment.
[0] https://wiki.debian.org/DDPortfolio

60
docs/doc-requirements.txt Normal file
View file

@ -0,0 +1,60 @@
alabaster==0.7.13 ; python_version >= "3.8" and python_version < "4.0"
babel==2.12.1 ; python_version >= "3.8" and python_version < "4.0"
cachecontrol[filecache]==0.12.11 ; python_version >= "3.8" and python_version < "4.0"
cachy==0.3.0 ; python_version >= "3.8" and python_version < "4.0"
certifi==2023.5.7 ; python_version >= "3.8" and python_version < "4.0"
cffi==1.15.1 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "linux"
charset-normalizer==3.1.0 ; python_version >= "3.8" and python_version < "4.0"
cleo==1.0.0a5 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "win32"
crashtest==0.3.1 ; python_version >= "3.8" and python_version < "4.0"
cryptography==41.0.1 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "linux"
distlib==0.3.6 ; python_version >= "3.8" and python_version < "4.0"
docutils==0.17.1 ; python_version >= "3.8" and python_version < "4.0"
entrypoints==0.3 ; python_version >= "3.8" and python_version < "4.0"
filelock==3.12.0 ; python_version >= "3.8" and python_version < "4.0"
html5lib==1.1 ; python_version >= "3.8" and python_version < "4.0"
idna==3.4 ; python_version >= "3.8" and python_version < "4.0"
imagesize==1.4.1 ; python_version >= "3.8" and python_version < "4.0"
importlib-metadata==6.6.0 ; python_version >= "3.8" and python_version < "3.12"
importlib-resources==5.12.0 ; python_version >= "3.8" and python_version < "3.9"
jaraco-classes==3.2.3 ; python_version >= "3.8" and python_version < "4.0"
jeepney==0.8.0 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "linux"
jinja2==3.1.2 ; python_version >= "3.8" and python_version < "4.0"
keyring==23.13.1 ; python_version >= "3.8" and python_version < "4.0"
lockfile==0.12.2 ; python_version >= "3.8" and python_version < "4.0"
markupsafe==2.1.3 ; python_version >= "3.8" and python_version < "4.0"
more-itertools==9.1.0 ; python_version >= "3.8" and python_version < "4.0"
msgpack==1.0.5 ; python_version >= "3.8" and python_version < "4.0"
packaging==20.9 ; python_version >= "3.8" and python_version < "4.0"
pexpect==4.8.0 ; python_version >= "3.8" and python_version < "4.0"
pkginfo==1.9.6 ; python_version >= "3.8" and python_version < "4.0"
platformdirs==3.5.1 ; python_version >= "3.8" and python_version < "4.0"
poetry-babel-plugin==0.1.0 ; python_version >= "3.8" and python_version < "4.0"
poetry-core==1.6.1 ; python_version >= "3.8" and python_version < "4.0"
poetry==1.2.0b1 ; python_version >= "3.8" and python_version < "4.0"
ptyprocess==0.7.0 ; python_version >= "3.8" and python_version < "4.0"
pycparser==2.21 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "linux"
pygments==2.15.1 ; python_version >= "3.8" and python_version < "4.0"
pylev==1.4.0 ; python_version >= "3.8" and python_version < "4.0"
pyparsing==3.0.9 ; python_version >= "3.8" and python_version < "4.0"
pytz==2023.3 ; python_version >= "3.8" and python_version < "3.9"
pywin32-ctypes==0.2.0 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "win32"
requests-toolbelt==0.9.1 ; python_version >= "3.8" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.8" and python_version < "4.0"
secretstorage==3.3.3 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "linux"
shellingham==1.5.0.post1 ; python_version >= "3.8" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.8" and python_version < "4.0"
snowballstemmer==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
sphinx==5.1.1 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-applehelp==1.0.4 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-htmlhelp==2.0.1 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-qthelp==1.0.3 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-serializinghtml==1.1.5 ; python_version >= "3.8" and python_version < "4.0"
tomlkit==0.11.8 ; python_version >= "3.8" and python_version < "4.0"
urllib3==1.26.16 ; python_version >= "3.8" and python_version < "4.0"
virtualenv==20.23.0 ; python_version >= "3.8" and python_version < "4.0"
webencodings==0.5.1 ; python_version >= "3.8" and python_version < "4.0"
zipp==3.15.0 ; python_version >= "3.8" and python_version < "3.12"

View file

@ -39,14 +39,14 @@ templates_path = ["_templates"]
# General information about the project.
project = "Debian Member Portfolio Service"
copyright = "2009-2021, Jan Dittberner"
copyright = "2009-2023, Jan Dittberner"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "0.7.2"
version = "0.7.4-dev"
# The full version, including alpha/beta/rc tags.
release = version
@ -87,15 +87,15 @@ htmlhelp_basename = "DebianMemberPortfolioServicedoc"
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class
# [howto/manual]).
latex_documents = [
(
"index",
"DebianMemberPortfolioService.tex",
"Debian Member Portfolio Service Documentation",
"Jan Dittberner",
"manual",
),
]
#latex_documents = [
# (
# "index",
# "DebianMemberPortfolioService.tex",
# "Debian Member Portfolio Service Documentation",
# "Jan Dittberner",
# "manual",
# ),
#]
# The name of an image file (relative to this directory) to place at the top of
# the title page.

View file

@ -21,38 +21,18 @@ To start working on the source code you need to have `git`_ installed::
.. _git: http://www.git-scm.com/
The canonical git repository for the Debian Member Portfolio Service is
available at https://debianstuff.dittberner.info/git/debianmemberportfolio.git.
available at https://git.dittberner.info/jan/debianmemberportfolio
To get a clone of the source code you change to a directory of your choice and
invoke git clone::
cd ~/src
git clone https://debianstuff.dittberner.info/git/debianmemberportfolio.git
git clone https://git.dittberner.info/jan/debianmemberportfolio.git
You should use `venv`_ to separate the development environment from your
system wide Python installation. You can install virtualenv using::
We use `Poetry <https://python-poetry.org/>`_ for dependency management. Run::
sudo aptitude install python3-venv
poetry install
.. _venv: https://docs.python.org/3/library/venv.html
When you have :command:`pyvenv` installed you should create a virtual
environment for Debian Member Portfolio Service development and install the
requirements using `pip <https://pypi.python.org/pypi/pip>`_::
mkdir ~/.virtualenvs
pyvenv ~/.virtualenvs/dmportfolio
. ~/.virtualenvs/dmportfolio/bin/activate
cd ~/src/debianmemberportfolio
pip install -r stretchreq.pip
.. note::
The Debian Member Portfolio Service instance at http://portfolio.debian.net/
is running on a Debian Stretch server, therefore :file:`stretchreq.pip`
contains dependency versions matching that Debian release.
The dependency download and installation into the virtual environment takes
some time.
to install all required dependencies in a Poetry managed virtual environment.
Debian Member Portfolio Service needs the JQuery JavaScript library to function
properly. The JQuery library is not included in the git clone and must be
@ -80,9 +60,8 @@ use by the code.
When you have both installed you can run::
. ~/.virtualenvs/dmportfolio/bin/activate
./synckeyrings.sh
python3 debianmemberportfolio/model/keyringanalyzer.py
poetry run python3 debianmemberportfolio/model/keyringanalyzer.py
The first synchronizes the keyrings in :file:`$HOME/debian/keyring.debian.org`
with files on the `keyring.debian.org <http://keyring.debian.org>`_ host. And
@ -94,7 +73,7 @@ Run a development server
You can run a development server using::
python3 run.py
poetry run python3 run.py
The output of this command should look like the following::
@ -152,3 +131,28 @@ the :py:func:`~debianmemberportfolio.model.dddatabuilder.build_data` function
of the module :py:mod:`debianmemberportfolio.model.dddatabuilder`, which uses
several helper functions from :py:mod:`debianmemberportfolio.model.keyfinder`
to access the key information.
Update translations
~~~~~~~~~~~~~~~~~~~
To update the translations you need to include the weblate repository as git remote::
git remote add weblate https://hosted.weblate.org/git/debian-member-portfolio-service/translations/
git fetch --all
Run the following to merge the latest translations into your local branch::
git merge weblate main
To extract translations from source files use::
poetry run pybabel extract --mapping-file=mapping.cfg --output-file=messages.pot --input-dirs=.
To merge translations with existing catalogs use::
poetry run pybabel update -i messages.pot -d debianmemberportfolio/translations
Compile the translations to gettext's .mo format using::
poetry run pybabel compile -d debianmemberportfolio/translations

7
mapping.cfg Normal file
View file

@ -0,0 +1,7 @@
[jinja2: debianmemberportfolio/templates/*.html]
encoding = utf-8
[jinja2: debianmemberportfolio/templates/*.js]
encoding = utf-8
[python: **.py]

1324
poetry.lock generated Normal file

File diff suppressed because it is too large Load diff

44
pyproject.toml Normal file
View file

@ -0,0 +1,44 @@
[tool.poetry]
name = "debianmemberportfolio"
version = "0.8.0-dev"
description = "Service to create Debian Member Portfolio URLs"
authors = ["Jan Dittberner <jan@dittberner.info>"]
license = "AGPL-3.0+"
readme = "README.md"
include = [
"**/*.mo",
]
exclude = [
"**/*.pot",
"**/*.po",
]
[tool.poetry.dependencies]
python = "^3.8"
Flask = "^2.2.2"
Jinja2 = "^3.1.2"
MarkupSafe = "^2.1.1"
itsdangerous = "^2.1.2"
Babel = "^2.10.3"
Flask-Babel = "^2.0.0"
pytz = "^2023.3"
speaklater = "^1.3"
flask-wtf = "^1.0.1"
email-validator = "^1.3.0"
[tool.poetry.dev-dependencies]
poetry-babel-plugin = "~0.1.0"
[tool.poetry.group.dev.dependencies]
sphinx = "<6"
docutils = "<0.18"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[[tool.poetry_babel_plugin.compile]]
domains = ["messages"]
directory = "debianmemberportfolio/translations"
fuzzy = false

View file

@ -1,12 +0,0 @@
Flask==2.2.2
Jinja2==3.1.2
MarkupSafe==2.1.1
Werkzeug==2.2.2
itsdangerous==2.1.2
Babel==2.10.3
Flask-Babel==2.0.0
pytz==2022.2.1
speaklater==1.3
Flask-WTF==1.0.1
WTForms==3.0.1
email-validator==1.3.0

View file

@ -1,39 +0,0 @@
[egg_info]
tag_build = dev
tag_svn_revision = true
[build_sphinx]
source-dir = docs/source
build-dir = docs/build
all_files = 1
[publish]
doc-dir=docs/html
make-dirs=1
[nosetests]
cover-package = debianmemberportfolio
# Babel configuration
[compile_catalog]
domain = messages
directory = debianmemberportfolio/translations
statistics = true
[extract_messages]
charset = UTF-8
add_comments = TRANSLATORS:
output_file = messages.pot
width = 80
msgid_bugs_address = jan@dittberner.info
[init_catalog]
domain = messages
input_file = messages.pot
output_dir = debianmemberportfolio/translations
[update_catalog]
domain = messages
input_file = messages.pot
output_dir = debianmemberportfolio/translations
previous = true

View file

@ -1,62 +0,0 @@
# -*- python -*-
# -*- coding: utf-8 -*-
#
# Debian Member Portfolio Service setup
# Copyright © 2009-2022 Jan Dittberner <jan@dittberner.info>
#
# This file is part of the Debian Member Portfolio Service.
#
# Debian Member Portfolio Service is free software: you can redistribute it
# and/or modify it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# Debian Member Portfolio Service is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License along with this program. If not, see <https://www.gnu.org/licenses/>.
#
try:
from setuptools import setup, find_packages
except ImportError:
# noinspection PyUnresolvedReferences
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='debianmemberportfolio',
version='0.7.3',
description='service to create Debian Member Portfolio URLs',
long_description="""This is a service implementation that returns a set of
personalized URLs as outlined in https://wiki.debian.org/DDPortfolio. It
takes the Debian Member's full name and email address as input and returns
a JSON formatted array of URLs.""",
# Get strings from https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=['Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'License :: DFSG approved',
'License :: OSI approved :: ' +
'GNU Affero General Public License v3',
'Programming Language :: Python'],
keywords='Debian service JSON',
author='Jan Dittberner',
author_email='jan@dittberner.info',
url='http://debian-stuff.dittberner.info/debianmemberportfolio',
license='AGPL-3.0+',
install_requires=["Flask>=0.12.2", 'Babel>=2.5.0', 'Flask-Babel>=0.11.2', 'wtforms'],
packages=find_packages(exclude=['ez_setup']),
include_package_data=True,
test_suite='nose.collector',
package_data={'debianmemberportfolio':
['*.ini', 'translations/*/LC_MESSAGES/*.mo']},
message_extractors={'debianmemberportfolio': [
('**.py', 'python', None),
('templates/**.html', 'jinja2', None),
('templates/**.js', 'jinja2', None),
('static/**', 'ignore', None)]},
zip_safe=False,
)

View file

@ -1,10 +0,0 @@
Flask==0.12
Jinja2==2.8
MarkupSafe==0.23
Werkzeug==0.11.15
itsdangerous==0.24
Babel==2.3.4
Flask-Babel==0.11.1
pytz==2016.7
Flask-WTF==0.12
WTForms==2.1