Default template for PDM package
Project description
SciOp
collecting at-risk data in torrent rss feeds
Running a SciOp Instance
These instructions are for executing the sciop tool.
Installing Dependencies
With pip
Make a python virtual environment and activate it:
python -m venv ~/.envs/sciop
. ~/.envs/sciop/bin/activate
Make sure pip is reasonably new:
pip install --upgrade pip
Install dependencies and then sciop itself in-place as an editable requirement:
pip install -e .
With PDM
Install dependencies, automatically creating a virtual environment by default
pdm install
Running SciOp
Create a configuration starting from the sample:
cp .env.sample .env
$EDITOR .env
Two fields must be set:
SCIOP_ENV: one ofdev,testorprod. One should only make a sciop instance publicly available inprodmode.devmode is for local development purposes, as istest. You must ensure that you do not re-use the same db between adev/testandprodinstance, e.g. if theSCIOP_DBlocation is explicitly set to something other than the defaults.SCIOP_SECRET_KEY: must be a securely-generated random hex value. A key can be generated withopenssl rand -hex 32.
With pip
sciop
With pdm
pdm run start
Contributing
We use pdm to build and interact with the code in this repo for contributions. This workflow is slightly different than simply executing the tool.
Setup Development Environment
pdm can be installed at the top level, without entering a virtual environment:
pip install pdm
However, it is also possible to install pdm within an existing venv.
Then, pdm can install dependencies, implicitly creating a venv if not already within one:
pdm install
Testing Your Changes
To run the code within the worktree:
pdm run start
To fix formatting and imports:
pdm run format
To run lint:
pdm run lint
To run automated testing:
pdm run test
Changes can then be submitted as a pull request against this repository on Codeberg.
DB Migrations
Any changes to the database must have corresponding migrations.
Migrations can be autogenerated with alembic
alembic -c ./src/sciop/migrations/alembic.ini revision -m "{migration-slug}" --autogenerate
Where {migration-slug} is some description of the changes made in the migration.
The migration generator compares the current state of the ORM models to the current state of the database, so the database must be equal to the state at the last migration.
To get a clean database, before you generate the migration, remove your development database and create a new one using alembic
alembic -c ./src/sciop/migrations/alembic.ini upgrade head
Then generate the migration with the command above.
Migrations can be tested with pytest
python -m pytest tests/test_migrations.py
# or
pdm run pytest tests/test_migrations.py
To test trickier migrations, you might want to create a version of the db in the previous state to compare what happens after the migration.
rm db.dev.sqlite
git switch main
pdm run start
# wait for startup... then quit
git switch {feature-branch}
pdm run migrate
License
Vendored Software
This project includes the following vendored software:
- htmx - Zero-Clause BSD
- form-json - GPL 3.0
- fastapi_rss - MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sciop-202503.18.1.tar.gz.
File metadata
- Download URL: sciop-202503.18.1.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.3 CPython/3.13.1 Darwin/23.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b7b8610a7c493fb65e140cf6c0a8efdddff4755de88e903f5673db10268426d
|
|
| MD5 |
655dc6107de9ae15081ab4276bf4530d
|
|
| BLAKE2b-256 |
cc8b199aa75f5acecfcfcf6f27c401384defbb4fc89fc2102cd019ccf6c3f32a
|
File details
Details for the file sciop-202503.18.1-py3-none-any.whl.
File metadata
- Download URL: sciop-202503.18.1-py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.3 CPython/3.13.1 Darwin/23.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b97bdbbd3e90dc198d4724a94745d0b5176eb61c1528ba30fee9e52f51473832
|
|
| MD5 |
83cec68db8ef0eaeaa4c401c0592f8ba
|
|
| BLAKE2b-256 |
41d84a0e93f2f04edc9abdd64e5ee14ed921abfe52af01a91c68f6b981b60a56
|