Browse Source

Create the first release candidate

Arkadiusz Ryś 2 years ago
parent
commit
b67b22be1b
7 changed files with 95 additions and 49 deletions
  1. 2 0
      .gitignore
  2. 1 1
      HISTORY.rst
  3. 1 1
      LICENSE
  4. 32 32
      ontopoint/main.py
  5. 44 0
      pyproject.toml
  6. 12 12
      requirements.txt
  7. 3 3
      tasks.py

+ 2 - 0
.gitignore

@@ -3,3 +3,5 @@ venv/
 build/
 dist/
 *.egg-info
+
+*.log

+ 1 - 1
HISTORY.rst

@@ -4,4 +4,4 @@ History
 
 0.0.0 (yyyy-mm-dd)
 ------------------
-* No historty yet.
+* No history yet.

+ 1 - 1
LICENSE

@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2022, Arkadiusz Michał Ryś
+Copyright (c) 2023, Arkadiusz Michał Ryś
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

+ 32 - 32
ontopoint/main.py

@@ -1,32 +1,32 @@
-from pathlib import Path
-# import magic
-from fastapi import FastAPI, BackgroundTasks
-from starlette.responses import FileResponse
-# http://127.0.0.1:8000/
-# http://127.0.0.1:8000/docs
-# http://127.0.0.1:8000/redoc
-# http://127.0.0.1:8000/openapi.json
-app = FastAPI()
-
-data_path = Path("data")
-
-
-def write_notification(email: str, message=""):
-    with open("log.txt", mode="w") as email_file:
-        content = f"notification for {email}: {message}"
-        email_file.write(content)
-
-
-@app.get("/")
-async def root():
-    return {"ontologies": [file_path.name for file_path in data_path.glob("*")]}
-
-
-@app.get("/{name}")
-async def ontology(name: str, background_tasks: BackgroundTasks):
-    file_path = data_path / Path(name)
-    # mime = magic.Magic(mime=True)
-    # media_type = mime.from_file(file_path)
-    media_type = "text/xml"
-    background_tasks.add_task(write_notification, name, message="some notification")
-    return FileResponse(file_path, filename=file_path.name, media_type=media_type)
+from pathlib import Path
+# import magic
+from fastapi import FastAPI, BackgroundTasks
+from starlette.responses import FileResponse
+# http://127.0.0.1:8000/
+# http://127.0.0.1:8000/docs
+# http://127.0.0.1:8000/redoc
+# http://127.0.0.1:8000/openapi.json
+app = FastAPI()
+
+data_path = Path("data")
+
+
+def write_notification(name: str):
+    with open("access.log", mode="w") as log_file:
+        log_file.write(f"Accessed: {name}")
+
+
+@app.get("/")
+async def root():
+    ontologies = [file_path.name for file_path in data_path.glob("*")]
+    return {"ontologies": ontologies}
+
+
+@app.get("/{name}")
+async def ontology(name: str, background_tasks: BackgroundTasks):
+    file_path = data_path / Path(name)
+    # mime = magic.Magic(mime=True)
+    # media_type = mime.from_file(file_path)
+    media_type = "text/xml"
+    background_tasks.add_task(write_notification, name)
+    return FileResponse(file_path, filename=file_path.name, media_type=media_type)

+ 44 - 0
pyproject.toml

@@ -0,0 +1,44 @@
+[build-system]
+requires = ["flit_core >=3.2,<4"]
+build-backend = "flit_core.buildapi"
+
+[project]
+name = "octopoint"
+authors = [
+    {name = "Arkadiusz Michał Ryś", email = "Arkadiusz.Michal.Rys@gmail.com"},
+]
+readme = "README.rst"
+requires-python = ">=3.9"
+classifiers = [
+    "License :: OSI Approved :: MIT License",
+    "Programming Language :: Python :: 3",
+    "Development Status :: 2 - Pre-Alpha",
+    "Intended Audience :: Developers",
+    "Natural Language :: English",
+]
+dynamic = ["version", "description"]
+license = {file = "LICENSE"}
+keywords = ["octopoint"]
+dependencies = [
+]
+
+[project.optional-dependencies]
+test = [
+    "pytest~=7.2.0",
+]
+doc = [
+    "sphinx~=6.1.3",
+]
+dev = [
+    "tox~=4.2.8",
+    "pip~=22.3.1",
+    "flit~=3.8.0",
+    "twine~=4.0.2",
+    "invoke~=1.7.3",
+    "jinja2~=3.1.2",
+    "flake8~=6.0.0",
+    "coverage~=7.0.5",
+]
+
+[project.urls]
+source = "https://git.rys.one/dtdesign/octopoint"

+ 12 - 12
requirements.txt

@@ -1,18 +1,18 @@
 # OctoPoint
-fastapi           ~= 0.85.0
-starlette         ~= 0.20.4
+fastapi           ~= 0.89.1
+starlette         ~= 0.23.1
 python-magic      ~= 0.4.27
-uvicorn[standard] ~= 0.18.3
+uvicorn[standard] ~= 0.20.0
 # Test
-pytest ~= 7.1.3
+pytest ~= 7.2.0
 # Doc
-sphinx ~= 5.1.1
+sphinx ~= 6.1.3
 # Dev
-tox      ~= 3.25.1
-pip      ~= 22.2.2
-flit     ~= 3.7.1
-twine    ~= 4.0.1
-invoke   ~= 1.7.1
+tox      ~= 4.2.8
+pip      ~= 22.3.1
+flit     ~= 3.8.0
+twine    ~= 4.0.2
+invoke   ~= 1.7.3
 jinja2   ~= 3.1.2
-flake8   ~= 5.0.4
-coverage ~= 6.4.4
+flake8   ~= 6.0.0
+coverage ~= 7.0.5

+ 3 - 3
tasks.py

@@ -42,7 +42,7 @@ def release(c, version):
         print("Version can be either major, minor or patch.")
         return
 
-    from arklog import __version_info__, __version__
+    from ontopoint import __version_info__, __version__
     _major, _minor, _patch = __version_info__
 
     if version == "patch":
@@ -56,13 +56,13 @@ def release(c, version):
         _patch = 0
 
     c.run(f"git checkout -b release-{_major}.{_minor}.{_patch} dev")
-    c.run(f"sed -i 's/{__version__}/{_major}.{_minor}.{_patch}/g' arklog/__init__.py")
+    c.run(f"sed -i 's/{__version__}/{_major}.{_minor}.{_patch}/g' ontopoint/__init__.py")
     print(f"Update the readme for version {_major}.{_minor}.{_patch}.")
     input("Press enter when ready.")
     c.run(f"git add -u")
     c.run(f'git commit -m "Update changelog version {_major}.{_minor}.{_patch}"')
     c.run(f"git push --set-upstream origin release-{_major}.{_minor}.{_patch}")
-    c.run(f"git checkout master")
+    c.run(f"git checkout main")
     c.run(f"git merge --no-ff release-{_major}.{_minor}.{_patch}")
     c.run(f'git tag -a {_major}.{_minor}.{_patch} -m "Release {_major}.{_minor}.{_patch}"')
     c.run(f"git push")