Skip to content

Commit

Permalink
modernization
Browse files Browse the repository at this point in the history
  • Loading branch information
sg-s committed Aug 9, 2023
1 parent 117c09a commit 68b3e7e
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 92 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
*__pycache__*
*.DS_Store
*sublime-workspace
pyvocab.sublime-project
.clientid
.clientsecret
distractors.csv

*pyvocab.egg-info/*
*pyvocab.egg-info/*
poetry.lock
streamlit.pid
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

PID := $(shell cat streamlit.pid)

.PHONY: nightly start-app stop-app restart-app install-launch-agent test coverage-report bump-version jupyter

jupyter:
@echo "Installing kernel <pyvocab> in jupyter"
-yes | jupyter kernelspec uninstall pyvocab
poetry run python -m ipykernel install --user --name pyvocab




start-app: stop-app
@echo "Starting streamlit app.."
@bash start-app.sh

stop-app:
@echo "Stopping streamlit app..."
-kill $(PID)


restart-app: stop-app start-app
@echo "Restarting app..."

test:
poetry run coverage run -m pytest -sx --failed-first
-rm coverage.svg
poetry run coverage-badge -o coverage.svg

coverage-report: .coverage
poetry run coverage html --omit="*/test*"
open htmlcov/index.html

bump-version:
poetry run bump
50 changes: 1 addition & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,5 @@

A simple python vocabulary builder

## Usage


The recommended way of using this is within [Jupyter Lab](https://jupyter.org/install). Once you have that installed, import it using:

```python
from pyvocab import vocab
```




### Read all words in the dictionary

```python
words = vocab.read()
```

### Lookup all words using a dictionary service, and save definitions

```python
vocab.lookup()
```

### Interactive test

```python
vocab.test()
```


### Scrape /r/logophilia for new words

First, create two files called `.clientid` and `.clientsecret` with your reddit bot clientID and client secret. Then:

```python
vocab.reddit()
```


## Developing

If you are developing this, you probably want to make your life a little easier. Before importing `pyvocab`,

```python
%load_ext autoreload
%autoreload 2

```
## Installation

9 changes: 9 additions & 0 deletions config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# configuration file for pyvocab
# rename this file to "config.ini"
# and populate the fields below before running anything in this package

["pyvocab"]


# streamlit app options
streamlit_port = 8510
44 changes: 17 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
[tool.poetry]
name = "pyvocab"
description = "Simple python-based vocabulary builder"
version = "23.1.10"
description = ""
authors = ["Srinivas Gorur-Shandilya <[email protected]>"]
readme = "README.md"
requires-python = ">=3.8"
version = "22.9.11"
authors = [
{name = "Srinivas Gorur-Shandilya", email="[email protected]"}
]

license = {text = "GPLv3 License"}
classifiers = [
"Framework :: streamlit",
"Programming Language :: Python :: 3",
]
dependencies = [
"pandas>=1.3.2",
"watchdog",
"streamlit>=1.11.0",
"interrogate>=1.0",
"python-Levenshtein",
"pycore @ git+https://github.com/sg-s/pycore.git",
]
[tool.poetry.dependencies]
python = "^3.10"
streamlit = "^1.16.0"
pandas = "^1.5.2"
watchdog = "^2.2.1"
pycore = {git = "https://github.com/sg-s/pycore.git"}
python-levenshtein = "^0.20.9"


[project.optional-dependencies]
dev = ["pytest"]
[tool.poetry.group.dev.dependencies]
ipykernel = "^6.20.1"
debugpy = "1.6"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
3 changes: 0 additions & 3 deletions pyvocab/vocab.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

from pathlib import Path

import numpy as np
import pandas as pd
import praw

from PyDictionary import PyDictionary


Expand Down
2 changes: 1 addition & 1 deletion pyvocab/words.csv
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ toska | a dull ache of the soul, a longing with nothing to long for, a sick pin
tosspot | a drunkard, a habitual drinker
tranche | A division or portion of a pool or whole.
trichiliocosm | (Buddhism) A concept in cosmology of a third-orderuniverse containing one thousand second-order clusters, which are made of one thousand first-order clusters, which are in turn made of a thousand worlds each. Billion-fold universe.
tricoteuse | a woman who sits and knits (personally found from a David Bowie song)
tricoteuse | a woman who sits and knits
trilemma |
trumpery | worthless nonsense
tulpa | A magical creature that attains corporeal reality, having been originally merely imaginary; thought that has taken physical form.
Expand Down
6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

5 changes: 0 additions & 5 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions start-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nohup poetry run streamlit run --server.port $(less config.ini | grep "streamlit_port" | cut -d = -f 2) pyvocab/game.py > /dev/null 2>&1 & echo $! > streamlit.pid

0 comments on commit 68b3e7e

Please sign in to comment.