From f82a68818706e8af300bbe62aecb54ba09706c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Faur=C3=A9?= Date: Thu, 15 Jun 2023 17:00:59 +0200 Subject: [PATCH] execution instructions, remove typing extensions --- README.md | 34 +++++++++++++++++++++++++++++----- poetry.lock | 15 ++------------- pyproject.toml | 1 - spip2md/extended_models.py | 3 +-- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 24e3e32..2982e57 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,34 @@ Markdown + YAML repository, usable with static site generators. - Convert SPIP [Markup language](https://www.spip.net/fr_article1578.html) - Convert SPIP ID-based internal links (like ``) into path-based, normal links +## Dependencies + +`spip2md` needs Python version 3.9 or supperior. + +`spip2md` uses three Python libraries (as defined in pyproject.toml) : + +- Peewee, with a database connection for your database : + - pymysql (MySQL/MariaDB) +- PyYaml +- python-slugify (unidecode) + ## Usage -To use the app, simply run the command `spip2md`. However, you probably want to -configure certain settings before running it, like the database credentials. -Here are the available _configuration options_, to put in a `spip2md.yml` file : +First make sure you have the dependencies installed (system-wide or in a +Python virtual-environment). + +Next, make sure you have access to the SPIP database you want to export on a +MySQL/MariaDB server. By default, `spip2md` expects a database named `spip` hosted on +`localhost`, with a user named `spip` of which password is `password`, but you can +totally configure this as well as other settings in the YAML config file. + +If you want to copy over attached files like images, you also need access to +the data directory of your SPIP website, usually named `IMG`, and either rename it +`data` in your current working directory, or set `data_dir` setting to its path. + +Currently, the config file can be given as the only CLI parameter, or if no parameter +is given, the program searches a `spip2md.yml` file in the current working directory. +Here’s the *configuration options* : ```yaml db: Name of the database (default is spip) @@ -50,7 +73,8 @@ logfile: Name of the logs file (default is spip2md.log) ## TODO -These tables could represent additional data to export : +These tables seem to contain not-as-useful information, +but this needs to be investicated : - `spip_evenements` - `spip_meta` @@ -64,7 +88,7 @@ These tables could represent additional data to export : - `spip_syndic` - `spip_zones` -These tables seem more technical : +These tables seem technical, SPIP specific : - `spip_depots` - `spip_depots_plugins` diff --git a/poetry.lock b/poetry.lock index 4e5a6b7..7de8c94 100644 --- a/poetry.lock +++ b/poetry.lock @@ -103,17 +103,6 @@ files = [ {file = "text_unidecode-1.3-py2.py3-none-any.whl", hash = "sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8"}, ] -[[package]] -name = "typing-extensions" -version = "4.6.3" -description = "Backported and Experimental Type Hints for Python 3.7+" -optional = false -python-versions = ">=3.7" -files = [ - {file = "typing_extensions-4.6.3-py3-none-any.whl", hash = "sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26"}, - {file = "typing_extensions-4.6.3.tar.gz", hash = "sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5"}, -] - [[package]] name = "unidecode" version = "1.3.6" @@ -127,5 +116,5 @@ files = [ [metadata] lock-version = "2.0" -python-versions = "^3.10" -content-hash = "0bfb6e7994de7f053afb14ff957e88f751f60339e05660d96e34a184278b8c47" +python-versions = "^3.9" +content-hash = "b2f6a06875c1c40404e891bf9765fab11ecf7fbf04a486962c27f71b3084857a" diff --git a/pyproject.toml b/pyproject.toml index 77bec75..d10feb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,6 @@ pyyaml = "^6.0" python-slugify = {extras = ["unidecode"], version = "^8.0.1"} pymysql = "^1.0.3" peewee = "^3.16.2" -typing-extensions = "^4.6.3" [tool.poetry.scripts] spip2md = "spip2md.lib:cli" diff --git a/spip2md/extended_models.py b/spip2md/extended_models.py index 92c2db7..c0442ab 100644 --- a/spip2md/extended_models.py +++ b/spip2md/extended_models.py @@ -27,7 +27,6 @@ from peewee import ( DoesNotExist, ) from slugify import slugify -from typing_extensions import Self from yaml import dump from spip2md.config import CFG @@ -804,7 +803,7 @@ class Section(SpipRedactional, SpipRubriques): ) # Get subsections of this section - def sections(self, limit: int = 10**6) -> tuple[Self]: + def sections(self, limit: int = 10**6) -> tuple["Section"]: LOG.debug(f"Initialize subsections of `{self._url_title}`") return ( Section.select()