2025-09-22: Added setup procedure

This commit is contained in:
Moussouni, Yaël
2025-09-22 11:04:28 +02:00
parent f526ab4dd2
commit ad4566a9f3
6 changed files with 73 additions and 7 deletions

5
.gitignore vendored
View File

@@ -1,3 +1,8 @@
.DS_Store .DS_Store
*.tmp *.tmp
*.log
tmp/ tmp/
log/
venv/
.venv/
filters/

View File

@@ -1,5 +1,25 @@
# ArXtic: ArXiv T I C # 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 ## Licence
**ArXtic** **ArXtic**

View File

@@ -36,6 +36,3 @@ FILTERS_DIR="./cfg/filters/"
## Remote URLs ## Remote URLs
QUERY_URL="https://export.arxiv.org/api/query?" QUERY_URL="https://export.arxiv.org/api/query?"
RSS_URL="https://rss.arxiv.org/atom/astro-ph" RSS_URL="https://rss.arxiv.org/atom/astro-ph"
## FILTERS
FILTERS_LIST="authors.txt,keywords.txt"

3
cfg/requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
feedparser==6.0.12
numpy==2.3.3
sgmllib3k==1.0.0

40
setup.sh Executable file
View File

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

View File

@@ -37,7 +37,6 @@ FILTERS_DIR = os.environ.get("FILTERS_DIR")
DB_DIR = os.environ.get("DB_DIR") DB_DIR = os.environ.get("DB_DIR")
QUERY_URL = os.environ.get("QUERY_URL") QUERY_URL = os.environ.get("QUERY_URL")
RSS_URL = os.environ.get("RSS_URL") RSS_URL = os.environ.get("RSS_URL")
FILTERS_LIST = os.environ.get("FILTERS_LIST").split(",")
COLOUR_DEFAULT="\033[0m" COLOUR_DEFAULT="\033[0m"
COLOUR_INPUT="\033[36m" COLOUR_INPUT="\033[36m"
@@ -78,8 +77,9 @@ def print_entries(entries, fields=None):
def get_filters(): def get_filters():
filters = [] filters = []
for i in range(len(FILTERS_LIST)): filters_list = [f for f in os.listdir(FILTERS_DIR) if not f[0] == "."]
path = FILTERS_DIR + FILTERS_LIST[i] for i in range(len(filters_list)):
path = FILTERS_DIR + filters_list[i]
filter_file = open(path) filter_file = open(path)
dic = {"fields": [], "values": []} dic = {"fields": [], "values": []}
for line in filter_file.readlines(): for line in filter_file.readlines():
@@ -121,4 +121,5 @@ def today_arxiv():
print_entries(entries, fields) print_entries(entries, fields)
return entries, fields return entries, fields
## Find using arxiv id today_arxiv()