execution instructions, remove typing extensions

This commit is contained in:
Guilhem Fauré 2023-06-15 17:00:59 +02:00
parent 8925f27885
commit f82a688187
4 changed files with 32 additions and 21 deletions

View File

@ -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 `<art123>`) 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.
Heres 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`

15
poetry.lock generated
View File

@ -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"

View File

@ -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"

View File

@ -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()