Skip to content

Commit

Permalink
updated requirements and added some test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tholzheim committed Mar 8, 2023
2 parents 8abf9ca + 4f29fc8 commit c67dd4c
Show file tree
Hide file tree
Showing 25 changed files with 242 additions and 893 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, '3.10']
#os: [ubuntu-latest]
python-version: [3.8, 3.9, '3.10','3.11']
#python-version: ['3.10']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/upload-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install hatch
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
hatch build
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# pyCEURmake
CEUR make python implementation

CEUR make python implementation for https://ceur-ws.org/

[![Join the discussion at https://github.com/WolfgangFahl/pyCEURMake/discussions](https://img.shields.io/github/discussions/WolfgangFahl/pyCEURMake)](https://github.com/WolfgangFahl/pyCEURMake/discussions)
[![pypi](https://img.shields.io/pypi/pyversions/pyCEURMake)](https://pypi.org/project/pyCEURMake/)
[![Github Actions Build](https://github.com/WolfgangFahl/pyCEURmake/workflows/Build/badge.svg?branch=main)](https://github.com/WolfgangFahl/pyCEURmake/actions?query=workflow%3ABuild+branch%3Amain)
[![PyPI Status](https://img.shields.io/pypi/v/pyCEURMake.svg)](https://pypi.python.org/pypi/pyCEURMake/)
[![GitHub issues](https://img.shields.io/github/issues/WolfgangFahl/pyCEURmake.svg)](https://github.com/WolfgangFahl/pyCEURmake/issues)
[![GitHub closed issues](https://img.shields.io/github/issues-closed/WolfgangFahl/pyCEURmake.svg)](https://github.com/WolfgangFahl/pyCEURmake/issues/?q=is%3Aissue+is%3Aclosed)
[![License](https://img.shields.io/github/license/WolfgangFahl/pyCEURMake.svg)](https://www.apache.org/licenses/LICENSE-2.0)

## Docs and Tutorials
[Wiki](https://wiki.bitplan.com/index.php/PyCEURmake)

## CEUR-WS Volume Browser
[Volume Browser http://ceur-ws-browser.bitplan.com](http://ceur-ws-browser.bitplan.com)
1 change: 1 addition & 0 deletions ceurws/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.3"
14 changes: 2 additions & 12 deletions ceurws/ceur_ws.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import calendar
import datetime
import os

import re
import typing

Expand All @@ -12,11 +13,9 @@
from pathlib import Path
from ceurws.indexparser import IndexHtmlParser
from ceurws.volumeparser import VolumeParser
from utils.download import Download
from ptp.eventrefparser import Tokenizer, CountryCategory, CityCategory, CityPrefixCategory
from ceurws.utils.download import Download
from geograpy.locator import City, Country, Location, LocationContext, Region


class CEURWS:
'''
CEUR-WS
Expand All @@ -28,7 +27,6 @@ class CEURWS:
CACHE_HTML=f"{CACHE_DIR}/index.html"
CONFIG=StorageConfig(cacheFile=CACHE_FILE)


class Volume(JSONAble):
"""
Represents a volume in ceur-ws
Expand Down Expand Up @@ -618,11 +616,3 @@ def __init__(self):
config=CEURWS.CONFIG,
name=self.__class__.__name__)

if __name__ == '__main__':
manager=VolumeManager()
try:
manager.loadFromBackup()
for volume in manager.getList():
print(volume)
except Exception as ex:
print(ex)
87 changes: 87 additions & 0 deletions ceurws/ceur_ws_cmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
'''
Created on 2023-02-20
@author: wf
'''
from ceurws.ceur_ws import VolumeManager
from ceurws.version import Version
import sys
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
import traceback
import webbrowser
# import after app!
from jpcore.justpy_app import JustpyServer

def getArgParser(description:str,version_msg)->ArgumentParser:
"""
Setup command line argument parser
Args:
description(str): the description
version_msg(str): the version message
Returns:
ArgumentParser: the argument parser
"""
parser = ArgumentParser(description=description, formatter_class=RawDescriptionHelpFormatter)
parser.add_argument("-a","--about",help="show about info [default: %(default)s]",action="store_true")
parser.add_argument("-d", "--debug", dest="debug", action="store_true", help="show debug info [default: %(default)s]")
parser.add_argument("--host",default=JustpyServer.getDefaultHost(),help="the host to serve / listen from [default: %(default)s]")
parser.add_argument("-l", "--list", action="store_true", help="list all volumes [default: %(default)s]")
parser.add_argument("--port",type=int,default=9998,help="the port to serve from [default: %(default)s]")
parser.add_argument("-s","--serve", action="store_true", help="start webserver [default: %(default)s]")
parser.add_argument("-V", "--version", action='version', version=version_msg)
return parser

def main(argv=None): # IGNORE:C0111
'''main program.'''

if argv is None:
argv=sys.argv[1:]

program_name = "ceur-ws"
program_version =f"v{Version.version}"
program_build_date = str(Version.date)
program_version_message = f'{program_name} ({program_version},{program_build_date})'

try:
parser=getArgParser(description=Version.license,version_msg=program_version_message)
args = parser.parse_args(argv)
if len(argv) < 1:
parser.print_usage()
sys.exit(1)
if args.about:
print(program_version_message)
print(f"see {Version.doc_url}")
webbrowser.open(Version.doc_url)
elif args.serve:
from ceurws.volumebrowser import VolumeBrowser
volumeBrowser=VolumeBrowser(version=Version,args=args)
url=f"http://{args.host}:{args.port}"
webbrowser.open(url)
volumeBrowser.start(host=args.host, port=args.port,debug=args.debug)
pass
elif args.list:
manager=VolumeManager()
manager.loadFromBackup()
for volume in manager.getList():
print(volume)
except KeyboardInterrupt:
### handle keyboard interrupt ###
return 1
except Exception as e:
if DEBUG:
raise(e)
indent = len(program_name) * " "
sys.stderr.write(program_name + ": " + repr(e) + "\n")
sys.stderr.write(indent + " for help use --help")
if args.debug:
print(traceback.format_exc())
return 2

DEBUG = 1
if __name__ == "__main__":
if DEBUG:
sys.argv.append("-d")
sys.exit(main())
39 changes: 0 additions & 39 deletions ceurws/resources/templates/base.html

This file was deleted.

111 changes: 0 additions & 111 deletions ceurws/resources/templates/macros.html

This file was deleted.

Loading

0 comments on commit c67dd4c

Please sign in to comment.