Skip to content

Commit

Permalink
updated doctrings, black, and version bump (#85)
Browse files Browse the repository at this point in the history
* updated doctrings, black, and version bump

Signed-off-by: vsoch <[email protected]>

* update container base to bookworm

Signed-off-by: vsoch <[email protected]>

---------

Signed-off-by: vsoch <[email protected]>
Co-authored-by: vsoch <[email protected]>
  • Loading branch information
vsoch and vsoch authored Oct 22, 2023
1 parent cb0cb3a commit 322a123
Show file tree
Hide file tree
Showing 66 changed files with 67 additions and 141 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup black environment
run: conda create --quiet --name black pyflakes
Expand All @@ -21,7 +21,7 @@ jobs:
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate black
pip install black
pip install black==23.3.0
black --check rse
- name: Check imports with pyflakes
Expand All @@ -38,7 +38,7 @@ jobs:
env:
RSE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup testing environment
run: conda create --quiet --name testing pytest

Expand All @@ -56,7 +56,7 @@ jobs:
env:
CONTAINER: quay.io/vanessa/rse
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Build Docker Image
run: docker build -t "${CONTAINER}" .
- name: Tag and Preview Container
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip.

## [0.0.x](https://github.com/rseng/rse/tree/master) (0.0.x)
- allow an erroneous response for GitHub org get repos (0.0.48)
- allow custom import for csv and google-sheet (0.0.47)
- support for csv import (0.0.46)
- ensure Google scraper skips malformed rows, etc (0.0.45)
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM bitnami/minideb:stretch
FROM bitnami/minideb:bookworm

# docker build -t quay.io/vanessa/rse .
LABEL MAINTAINER @vsoch
ENV PATH /opt/conda/bin:${PATH}
Expand Down
10 changes: 0 additions & 10 deletions rse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""

from .version import __version__

assert __version__
2 changes: 1 addition & 1 deletion rse/app/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand Down
2 changes: 1 addition & 1 deletion rse/app/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand Down
3 changes: 1 addition & 2 deletions rse/app/export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand Down Expand Up @@ -157,7 +157,6 @@ def kill():
)

for url, outfile in urls.items():

# Skip if we've already created it
if os.path.exists(outfile):
continue
Expand Down
2 changes: 1 addition & 1 deletion rse/app/server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand Down
4 changes: 1 addition & 3 deletions rse/app/views/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand Down Expand Up @@ -33,11 +33,9 @@ def index():

@app.route("/")
def topics_view():

topics = app.client.topics()
repos = []
for name in app.client.list():

# Obtain the repository and load the data.
repo = app.client.get(name[0])
repo.parser.load(repo.data)
Expand Down
10 changes: 1 addition & 9 deletions rse/app/views/repositories.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -18,7 +18,6 @@

@app.route("%srepository/<path:uid>" % RSE_URL_PREFIX)
def repository_view(uid):

# Obtain the repository and load the data.
repo = app.client.get(uid)
repo.parser.load(repo.data)
Expand Down Expand Up @@ -55,7 +54,6 @@ def annotate_repos(message=""):

@app.route("%sannotate-criteria" % RSE_URL_PREFIX, methods=["POST", "GET"])
def annotate_criteria():

# If it's a post, update the annotation
username = None
if request.method == "POST":
Expand Down Expand Up @@ -96,7 +94,6 @@ def annotate_criteria():

@app.route("%srepository/<path:uid>/annotate-criteria" % RSE_URL_PREFIX)
def annotate_static_criteria(uid):

# Get criteria / annotation set for specific repository
username = request.args.get("username")
repo = app.client.get(uid)
Expand All @@ -115,7 +112,6 @@ def annotate_static_criteria(uid):

@app.route("%srepository/<path:uid>/annotate-taxonomy" % RSE_URL_PREFIX)
def annotate_static_taxonomy(uid):

# Get criteria / annotation set for specific repository
username = request.args.get("username")
repo = app.client.get(uid)
Expand All @@ -137,7 +133,6 @@ def annotate_static_taxonomy(uid):

@app.route("%sannotate-taxonomy" % RSE_URL_PREFIX, methods=["GET", "POST"])
def annotate_taxonomy():

# If we don't have a color lookup, make one
if not hasattr(app, "taxonomy"):
app.taxonomy = generate_taxonomy(app)
Expand Down Expand Up @@ -181,7 +176,6 @@ def annotate_taxonomy():


def generate_taxonomy(app):

taxonomy = app.client.list_taxonomy()

# Update the color list with existing colors (consistency)
Expand Down Expand Up @@ -209,7 +203,6 @@ def generate_taxonomy(app):


def update_criteria():

updates = {}
repo_uid = request.form.get("repo_uid")
username = request.form.get("username")
Expand All @@ -231,7 +224,6 @@ def update_criteria():


def update_taxonomy():

uids = []
repo_uid = request.form.get("repo_uid")
username = request.form.get("username")
Expand Down
2 changes: 1 addition & 1 deletion rse/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""
Copyright (C) 2020 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand Down
3 changes: 1 addition & 2 deletions rse/client/add.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -14,7 +14,6 @@


def main(args, extra):

# Create a research software encyclopedia
enc = Encyclopedia(config_file=args.config_file, database=args.database)

Expand Down
3 changes: 1 addition & 2 deletions rse/client/annotate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -13,7 +13,6 @@


def main(args, extra):

# Create a research software encyclopedia
client = Encyclopedia(config_file=args.config_file, database=args.database)

Expand Down
3 changes: 1 addition & 2 deletions rse/client/clear.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -12,7 +12,6 @@


def main(args, extra):

# Clear a parser, uid, or target
enc = Encyclopedia(config_file=args.config_file, database=args.database)
enc.clear(args.target, noprompt=args.force)
3 changes: 1 addition & 2 deletions rse/client/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -17,7 +17,6 @@


def main(args, extra):

bot = logging.getLogger("rse.client")

# The user wants to set the database
Expand Down
3 changes: 1 addition & 2 deletions rse/client/exists.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -16,7 +16,6 @@


def main(args, extra):

enc = Encyclopedia(config_file=args.config_file)

# Case 1: empty list indicates listing all
Expand Down
4 changes: 1 addition & 3 deletions rse/client/export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -19,7 +19,6 @@


def main(args, extra):

client = Encyclopedia(config_file=args.config_file, database=args.database)

# Case 1: empty list indicates listing all
Expand All @@ -28,7 +27,6 @@ def main(args, extra):

# Export a list of repos
if args.export_type == "repos-txt":

# We just want the unique id, the first result
repos = [x[0] for x in client.list()]
write_file("\n".join(repos), args.path)
Expand Down
3 changes: 1 addition & 2 deletions rse/client/generate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -13,7 +13,6 @@


def main(args, extra):

punctuation = "!#$%&()*+,-./:;<=>?@^_{|}~"
choices = string.ascii_letters + string.digits + punctuation
selected = [random.SystemRandom().choice(choices) for _ in range(50)]
Expand Down
3 changes: 1 addition & 2 deletions rse/client/get.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -18,7 +18,6 @@


def main(args, extra):

# Create a research software encyclopedia
enc = Encyclopedia(config_file=args.config_file, database=args.database)

Expand Down
4 changes: 1 addition & 3 deletions rse/client/imp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -20,7 +20,6 @@ def parse_extra(extra):
args = []
kwargs = {}
for arg in extra:

# This is a key value pair (extra)
if arg.startswith("--") and "=" in arg:
key, val = arg.strip().split("=")
Expand All @@ -33,7 +32,6 @@ def parse_extra(extra):


def main(args, extra):

try:
importer = get_importer(args.import_type)
except:
Expand Down
3 changes: 1 addition & 2 deletions rse/client/init.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -15,7 +15,6 @@


def main(args, extra):

# present working directory
path = args.path
if args.path == ".":
Expand Down
3 changes: 1 addition & 2 deletions rse/client/label.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Copyright (C) 2020-2022 Vanessa Sochat.
Copyright (C) 2020-2023 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
Expand All @@ -12,7 +12,6 @@


def main(args, extra):

enc = Encyclopedia(config_file=args.config_file, database=args.database)

# Grab the repository uid, label key and value
Expand Down
Loading

0 comments on commit 322a123

Please sign in to comment.