Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run? #1

Open
shelvacu opened this issue Jul 19, 2018 · 1 comment
Open

How to run? #1

shelvacu opened this issue Jul 19, 2018 · 1 comment

Comments

@shelvacu
Copy link

Could you please add some documentation as to how to get this up and running? All the commands from cloning the repo (I already figured that part out :P but I figure it's good to include for completeness) to creating the final zip.

@JockeTF
Copy link
Owner

JockeTF commented Jul 25, 2018

Definitely! Until then, clone the repo end enter the directory.

git clone https://github.com/JockeTF/fimfarchive.git
cd fimfarchive

Then create a virtual environment. The commands may vary slightly depending on your platform.

python3 -m venv venv
source venv/bin/activate

Make sure the above command succeeded, and install the development dependencies.

pip install -r requirements.txt

You can now run fimfarchive as a python module.

python -m fimfarchive

Note that there isn't really anything useful you can do with that command now. However, you can mess around with an archive release through the interactive interpreter.

>>> # Create a fetcher instance for reading from the archive.
>>> from fimfarchive.fetchers import FimfarchiveFetcher
>>> fetcher = FimfarchiveFetcher('fimfarchive.zip')
>>>
>>> # Inspect the title of a story.
>>> story = fetcher.fetch(9) 
>>> story.meta['title']
'The Greatest Equine Who has Ever Lived!'
>>> 
>>> # Check the number of total words in the archive.
>>> sum(story.meta['num_words'] for story in fetcher)
2081635416
>>> 
>>> # Do the same thing, but with a fancy progress bar.
>>> from fimfarchive.utils import tqdm
>>> sum(story.meta['num_words'] for story in tqdm(fetcher))
 72%|##################       | 120536/166411 [00:15<00:06, 7639.93it/s]

JockeTF pushed a commit that referenced this issue Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants