From ad4566a9f341de8fa442282d6ee80be44552749d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moussouni=2C=20Ya=C3=ABl?= Date: Mon, 22 Sep 2025 11:04:28 +0200 Subject: [PATCH] 2025-09-22: Added setup procedure --- .gitignore | 5 +++++ README.md | 20 ++++++++++++++++++++ cfg/general_config.cfg | 3 --- cfg/requirements.txt | 3 +++ setup.sh | 40 ++++++++++++++++++++++++++++++++++++++++ src/arxtic.py | 9 +++++---- 6 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 cfg/requirements.txt create mode 100755 setup.sh diff --git a/.gitignore b/.gitignore index 0b51443..9be6f28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ .DS_Store *.tmp +*.log tmp/ +log/ +venv/ +.venv/ +filters/ diff --git a/README.md b/README.md index a26f4e2..6e48bd7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,25 @@ # ArXtic: ArXiv T I C +## Setup + +Clone this repository with: +```bash +git clone https://codeberg.org/Yael-II/ArXtic/ +``` +Create a virtual environment with python using: +```bash +python3 -m venv venv +``` +If you decide to use a different virtual environment, please change the `VENV_DIR` variable in `cfg/general_config.cfg`. Then, to allow the execution of the setup script, use: +```bash +chmod u+x setup.sh +``` +and then run: +```bash +./setup.sh +``` +Finally, you may want to add filters. For each field you want to filter, create a file in the `cfg/filters` directory. The fields that are filtered for each file is specified by `#FIELD="field_name"` in the file. Then, filtered keywords are listed, separated by a line break (one item per line). Then name of the file has no incidence (except for masked files using a `.` (dot), such as `.filename`, which are ignored). + ## Licence **ArXtic** diff --git a/cfg/general_config.cfg b/cfg/general_config.cfg index 98531f7..bb884a0 100644 --- a/cfg/general_config.cfg +++ b/cfg/general_config.cfg @@ -36,6 +36,3 @@ FILTERS_DIR="./cfg/filters/" ## Remote URLs QUERY_URL="https://export.arxiv.org/api/query?" RSS_URL="https://rss.arxiv.org/atom/astro-ph" - -## FILTERS -FILTERS_LIST="authors.txt,keywords.txt" diff --git a/cfg/requirements.txt b/cfg/requirements.txt new file mode 100644 index 0000000..008018a --- /dev/null +++ b/cfg/requirements.txt @@ -0,0 +1,3 @@ +feedparser==6.0.12 +numpy==2.3.3 +sgmllib3k==1.0.0 diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..56af843 --- /dev/null +++ b/setup.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# [TLP:AMBER] LIMITED DISTRIBUTION: WORK IN PROGRESS +# Author: Moussouni, Yaël (MSc student; yael.moussouni@etu.unistra.fr) +# Institution: Université de Strasbourg, CNRS, Observatoire astronomique +# de Strasbourg, UMR 7550, F-67000 Strasbourg, France +# Date: 2025-09-22 +# +# Licence: +# ArXtic +# Copyright (C) 2025 Yaël Moussouni (yael.moussouni@etu.unistra.fr) +# +# setup.sh +# Copyright (C) 2025 Yaël Moussouni (yael.moussouni@etu.unistra.fr) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see www.gnu.org/licenses/. + +source activate.sh + +echo "=== [ Directory setup ] ===" +mkdir -p -v cfg/filters +mkdir -p -v db +chmod u+x *.sh +echo "=== Done ===" + +echo "=== [ Python environment setup ] ===" +echo "--> pip" +${VENV_DIR}bin/pip3 install -r cfg/requirements.txt +echo "=== Done ===" +echo "" diff --git a/src/arxtic.py b/src/arxtic.py index f038a85..26ed7af 100644 --- a/src/arxtic.py +++ b/src/arxtic.py @@ -37,7 +37,6 @@ FILTERS_DIR = os.environ.get("FILTERS_DIR") DB_DIR = os.environ.get("DB_DIR") QUERY_URL = os.environ.get("QUERY_URL") RSS_URL = os.environ.get("RSS_URL") -FILTERS_LIST = os.environ.get("FILTERS_LIST").split(",") COLOUR_DEFAULT="\033[0m" COLOUR_INPUT="\033[36m" @@ -78,8 +77,9 @@ def print_entries(entries, fields=None): def get_filters(): filters = [] - for i in range(len(FILTERS_LIST)): - path = FILTERS_DIR + FILTERS_LIST[i] + filters_list = [f for f in os.listdir(FILTERS_DIR) if not f[0] == "."] + for i in range(len(filters_list)): + path = FILTERS_DIR + filters_list[i] filter_file = open(path) dic = {"fields": [], "values": []} for line in filter_file.readlines(): @@ -121,4 +121,5 @@ def today_arxiv(): print_entries(entries, fields) return entries, fields -## Find using arxiv id +today_arxiv() +