Skip to content

Commit

Permalink
Merge pull request #1618 from ThomasWaldmann/pyproject-toml
Browse files Browse the repository at this point in the history
Adopt pyproject.toml
  • Loading branch information
RogerHaase authored Feb 29, 2024
2 parents cb35dcb + 59f28b0 commit b447b5e
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 297 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Lint with flake8
- name: Lint
run: |
pip install flake8
flake8 src/moin scripts setup.py quickinstall.py
pip install tox
tox -e ruff
pytest:

needs: lint
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
python -m pip install pytest
pip install -r requirements.d/development.txt
pip install -e .
- name: Test with pytest
Expand Down
9 changes: 9 additions & 0 deletions babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[python: **/**.py]
encoding = utf-8

[jinja2: **/templates/**.html]
encoding = utf-8

[jinja2: **/templates/dictionary.js]
# all JS translatable strings must be defined here for jQuery i18n plugin
encoding = utf-8
2 changes: 1 addition & 1 deletion docs/admin/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ In many cases, those external static files are maintained by someone else (like
javascript library or larger js libraries) and we definitely do not want to merge
them into our project.

For MoinMoin we require the following XStatic Packages in setup.py:
For MoinMoin we require the following XStatic Packages in pyproject.toml:

* `jquery <https://pypi.org/project/XStatic-jQuery>`_
for jquery lib functions loaded in the template file base.html
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Dependencies
============

Dependent packages will be automatically downloaded and installed during the
moin2 installation process. For a list of dependencies, see setup.py.
moin2 installation process. For a list of dependencies, see pyproject.toml.


Clients
Expand Down
14 changes: 10 additions & 4 deletions docs/devel/translate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ language doesn't exist yet`_.

2. Go to the top directory and execute::

python setup.py update_catalog -l <locale>
pybabel update -l <locale> -i src/moin/translations/MoinMoin.pot \
-d src/moin/translations/ -w 116

where locale is the short language descriptor of your desired
language. It should be the name of a folder in MoinMoin/translations.
Expand Down Expand Up @@ -59,7 +60,7 @@ language doesn't exist yet`_.

4. Save the messages.po file and execute::

python setup.py compile_catalog -l <locale>
pybabel compile -l <locale> -d src/moin/translations/


Guidelines for translators
Expand All @@ -83,7 +84,8 @@ the developers, but ...

1. Initialize a new catalog::

python setup.py init_catalog -l <locale>
pybabel init -l <locale> -i src/moin/translations/MoinMoin.pot \
-d src/moin/translations/ -w 116

2. Adjust the ``src/moin/translations/<locale>/LC_MESSAGES/messages.po``.

Expand Down Expand Up @@ -139,7 +141,11 @@ string replacement.
If you made changes to any gettext() string, please update the .pot file
using::

python setup.py extract_messages
pybabel extract -F babel.cfg -o src/moin/translations/MoinMoin.pot \
-k "_ gettext L_ lazy_gettext N_ ngettext" \
--msgid-bugs-address "English <[email protected]>" \
--copyright-holder "Moin Core Team, see http://moinmo.in/MoinCoreTeamGroup" \
--project "moin" --version "<version>" -w 116 src/

Because this sometimes creates large diffs, just because of a
change in line numbers, you can of course use this command sparingly.
Expand Down
74 changes: 0 additions & 74 deletions moin.spec

This file was deleted.

158 changes: 158 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
[project]
name = "moin"
dynamic = ["version"]
authors = [{name="Juergen Hermann et al."}]
maintainers = [
{name="RogerHaase", email="[email protected]"},
{name="Thomas Waldmann", email="[email protected]"},
]
description = "MoinMoin is an easy to use, full-featured and extensible wiki software package"
readme = {file="README.rst", content-type="text/x-rst"}
requires-python = ">=3.9"
keywords = ["wiki", "web"]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Web Environment",
"Intended Audience :: Education",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Information Technology",
"Intended Audience :: Other Audience",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Office/Business :: Groupware",
"Topic :: Text Processing :: Markup",
]
license = {text="GNU GPL v2 (or any later version)"}
dependencies = [
"Babel >= 2.10.0", # internationalization support
"blinker >= 1.5", # event signalling (e.g. for change notification trigger)
"docutils >= 0.18.1", # reST markup processing
"Markdown >= 3.4.1", # Markdown markup processing
"mdx_wikilink_plus >= 1.4.1", # Markdown Wikilinks extension
"Flask < 2.3.0", # micro framework
"Flask-Babel >= 3.0.0", # i18n support
"Flask-Caching >= 1.2.0", # caching support
"Flask-Theme >= 0.3.6", # theme support
"emeraldtree >= 0.10.0", # xml processing
"feedgen == 0.9.*", # Atom feed
"flatland >= 0.8", # form handling
"Jinja2 >= 3.1.0", # template engine
"markupsafe <= 2.2.0", # safe html and xml
"pygments >= 1.4", # src code / text file highlighting
"Werkzeug", # wsgi toolkit
"whoosh >= 2.7.0", # needed for indexed search
"pdfminer.six", # pdf -> text/plain conversion
"passlib >= 1.6.0", # strong password hashing (1.6 needed for consteq)
"setuptools >= 51", # dependency with setuptools_scm
"sqlalchemy < 2.0", # used by sqla store
"XStatic >= 0.0.2", # support for static file pypi packages
"XStatic-Bootstrap == 3.1.1.2",
"XStatic-Font-Awesome >= 6.2.1.0",
"XStatic-CKEditor >= 3.6.1.2",
"XStatic-autosize",
"XStatic-jQuery >= 1.8.2",
"XStatic-jQuery-File-Upload >= 10.31.0",
"XStatic-svg-edit-moin >= 2012.11.15.1",
"XStatic-JQuery.TableSorter >= 2.14.5.1",
"XStatic-Pygments >= 1.6.0.1",
]

[project.optional-dependencies]
pillow = ["pillow"] # successor to PIL; used by image get for scaling/rotating/etc.;
# requires special libs/header to be installed before it can be compiled successfully
ldap = ["python-ldap"] # used by ldap auth; requires special libs/header
# to be installed before it can be compiled successfully

[project.urls]
"Homepage" = "https://moinmo.in/"
"Bug Tracker" = "https://github.com/moinwiki/moin/issues"
"Documentation" = "https://moin-20.readthedocs.io/"
"Repository" = "https://github.com/moinwiki/moin"
"Changelog" = "https://github.com/moinwiki/moin/blob/master/docs/changes/CHANGES"

[project.scripts]
moin = "moin.cli:cli"

[tool.setuptools]
# See also the MANIFEST.in file.
# We want to install all the files in the package directories...
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]
exclude = ["_tests"]

[tool.setuptools.package-data]
"moin.translations" = ["MoinMoin.pot", "*.po", ]
"moin.static" = ["*", ]
"moin.themes.modernized" = ["*", ]
"moin.themes.basic" = ["*", ]
"moin.themes.topside" = ["*", ]
"moin.themes.topside_cms" = ["*", ]
"moin.templates" = ["*.html", "*.xml", ]
"moin.apps.admin.templates" = ["*.html", ]
"moin.apps.misc.templates" = ["*.html", "*.txt", ]

[build-system]
requires = ["setuptools", "setuptools_scm[toml] >= 6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/moin/_version.py"

[tool.pytest.ini_options]
norecursedirs = [".git", "_build", "tmp*", "env*", "dlc", "wiki", "support"]


[tool.ruff]
line-length = 120
target-version = "py39"

# Exclude a variety of commonly ignored directories.
exclude = [
"contrib",
".cache",
".eggs",
".git",
".git-rewrite",
".idea",
".ruff_cache",
".tox",
"build",
"dist",
]

[tool.ruff.lint]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]

ignore = ["F405", "E401", "E402", "E501"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []

# Code style violation exceptions:
# please note that the values are adjusted so that they do not cause failures
# with existing code. if you want to change them, you should first fix all
# ruff failures that appear with your change.
[tool.ruff.lint.per-file-ignores]
"scripts/coding_std.py" = ["E713"]
"docs/conf.py" = ["F401"] # sphinx config, automatically generated
"src/moin/utils/SubProcess.py" = ["F401", "F821"] # 3rd party stuff, patched stdlib code
"src/moin/config/default.py" = ["F401", "F403"]
"src/moin/datastructures/__init__.py" = ["F401"]
7 changes: 3 additions & 4 deletions quickinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def cmd_dist(self, *args):
print('Deleting wiki data, then creating distribution archive in /dist, output written to {0}.'.format(
DIST))
self.cmd_del_wiki(*args)
command = '{0} setup.py sdist bdist_wheel'.format(sys.executable)
command = 'pip install build ; python -m build'
with open(DIST, 'w') as messages:
result = subprocess.call(command, shell=True, stderr=messages, stdout=messages)
print('Summary message from {0} is shown below:'.format(DIST))
Expand Down Expand Up @@ -578,9 +578,8 @@ def do_install(self):

def do_catalog(self):
subprocess.check_call((
os.path.join(self.dir_venv_bin, 'python'),
os.path.join(self.dir_source, 'setup.py'),
'compile_catalog', '--statistics',
os.path.join(self.dir_venv_bin, 'pybabel'),
'compile', '--statistics',
# needed in case user runs quickinstall.py with a cwd other than the repo root
'--directory', os.path.join(os.path.dirname(__file__), 'src', 'moin', 'translations'),
))
Expand Down
Loading

0 comments on commit b447b5e

Please sign in to comment.