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

Project structure #146

Merged
merged 24 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
91e58d1
refactor: pyproject.toml
Jerakin Feb 21, 2024
d8d3a65
refactor: moved all files
Jerakin Feb 21, 2024
a06c7fc
fix: tests using src directory
Jerakin Feb 21, 2024
6d6676a
fix: template folder
Jerakin Feb 21, 2024
c0b76a7
fix: update static urls to use dynamic values
Jerakin Feb 21, 2024
3bd34e4
cicd: docker and cicd fixes
Jerakin Feb 21, 2024
dbfc9b2
chore: remove libs that are not explicitly used by the project
Jerakin Feb 21, 2024
e07d25e
fix: ignore plugin generated files
Jerakin Feb 21, 2024
b177a3a
fix: clean up tests
Jerakin Feb 21, 2024
dac9377
chore: add ruff tool chain config
Jerakin Feb 21, 2024
25d9138
feat: keep wiki template as a separate folder and copy it over if i…
Jerakin Feb 21, 2024
780c0f2
fix: error in refactor move
Jerakin Feb 21, 2024
207f3eb
fix: template path fix
Jerakin Feb 23, 2024
2d060db
doc: update docker build instruction
Jerakin Feb 25, 2024
12c73e5
fix: default update locations
Jerakin Feb 25, 2024
c29e419
fix: image fetching
Jerakin Feb 25, 2024
e07d623
fix: moved wiki template folder
Jerakin Feb 25, 2024
cf5ab00
fix: force project root as base of template and static folder
Jerakin Feb 25, 2024
f2efb43
fix: add the extra data when building the app
Jerakin Feb 25, 2024
54b91bf
docs: updated documentation
Jerakin Feb 25, 2024
f88c7a5
test: wiki template path within the test
Jerakin Feb 25, 2024
37993ea
cicd: updated dockerfile to build and setup image correctly
Jerakin Feb 25, 2024
39e419e
fix: add default draw to built page
Jerakin Feb 25, 2024
d0f1c6a
fix: allow space within file name
Jerakin Feb 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Build & export
uses: docker/build-push-action@v3
with:
file: docker/Dockerfile
file: Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
outputs: type=docker,dest=/tmp/wikmd.tar
Expand Down Expand Up @@ -96,6 +96,10 @@ jobs:
- name: Assert wikmd status
run: curl -I localhost:5000 2>&1 | awk '/HTTP\// {print $2}' | grep -w "200\|301"

# Check that wikmd is rendering
- name: Check wikmd rendering status
run: curl -s localhost:5000 | grep -w "What is it?"

publish:
# Publish if official repo and push to 'main' or new tag
if: |
Expand All @@ -116,6 +120,6 @@ jobs:
- name: Publish
uses: docker/build-push-action@v3
with:
file: docker/Dockerfile
file: Dockerfile
push: true
tags: ${{ needs.build.outputs.wikmd_tags }}
11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]
- name: Test with pytest
run: |
python -m pytest -v
python -m pytest
- name: Start wikmd
run: python wiki.py &

run: |
cd src
python -m wikmd.wiki &
- name: screenshots-ci-action
uses: flameddd/screenshots-ci-action@master
with:
Expand Down
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,12 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Generated plugin files
src/wikmd/plugins/draw/drawings/*
!src/wikmd/plugins/draw/drawings/.gitkeep


# Personal wiki pages
wiki/*
wiki/src/*

!wiki/Features.md
!wiki/How to use the wiki.md
!wiki/Markdown cheatsheet.md
!wiki/Using the version control system.md
!wiki/homepage.md
!wiki/src

temp/*
6 changes: 1 addition & 5 deletions docker/README.md → DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

[wikmd](https://github.com/Linbreux/wikmd) is a file based wiki that uses markdown.

This repo provides Docker files that are loosely based on those of the [linuxserver](https://www.linuxserver.io/) community.

Docker files are available for arm, arm64 and amd64.

## Usage
Jerakin marked this conversation as resolved.
Show resolved Hide resolved

Here are some example snippets to help you get started creating a container.

Build the image,

```bash
docker build -t linbreux/wikmd:latest -f docker/Dockerfile .
docker build -t linbreux/wikmd:latest -f Dockerfile .
```

### docker-compose (recommended, [click here for more info](https://docs.linuxserver.io/general/docker-compose))
Expand Down
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM python:3.9-alpine3.17 as final

RUN apk update
RUN apk add git
RUN apk add pandoc
RUN apk add build-base linux-headers

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser

WORKDIR /code

COPY ./pyproject.toml /code/

RUN python -m pip install --no-cache-dir --upgrade .


COPY ./src/wikmd /code/wikmd
COPY ./wiki_template /wiki_template

# Expose the port that the application listens on.
EXPOSE 5000

# Run the application.
CMD ["python", "-m", "wikmd.wiki"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It’s a file-based wiki that aims to simplicity. Instead of storing the data in

To view the documents in the browser, the document is converted to html.

![preview](static/images/readme-img.png)
![preview](src/wikmd/static/images/readme-img.png)

## Features

Expand Down
39 changes: 0 additions & 39 deletions docker/Dockerfile

This file was deleted.

38 changes: 0 additions & 38 deletions docker/Dockerfile.aarch64

This file was deleted.

38 changes: 0 additions & 38 deletions docker/Dockerfile.armhf

This file was deleted.

34 changes: 0 additions & 34 deletions docker/root/etc/cont-init.d/30-config

This file was deleted.

5 changes: 0 additions & 5 deletions docker/root/etc/services.d/wikmd/run

This file was deleted.

1 change: 0 additions & 1 deletion plugins/draw/drawings/.gitignore

This file was deleted.

69 changes: 69 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[project]
requires-python = ">= 3.8"
name = "wikmd"
description = "A file-based wiki that aims for simplicity."
authors = [
{ name = "linbreux" }
]

version = "1.9.0"

dependencies=[
"Flask==3.0.2",
"GitPython==3.1.42",
"Markdown==3.5.2",
"PyYAML==6.0.1",
"Werkzeug==3.0.1",
"Whoosh==2.7.4",
"beautifulsoup4==4.12.3",
"pandoc-eqnos==2.5.0",
"pandoc-fignos==2.4.0",
"pandoc-secnos==2.2.2",
"pandoc-tablenos==2.3.0",
"pandoc-xnos==2.5.0",
"pandocfilters==1.5.1",
"pypandoc==1.13",
"requests==2.31.0",
"lxml==5.1.0",
"watchdog==2.1.9",
"cachelib==0.12.0",
]

[project.optional-dependencies]
dev = [
"pytest",
]

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
pythonpath = [
"src"
]

[tool.ruff]
src = ["", "tests"]
select = ["ALL"]

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
# S101: Check for assert
"S101",

# ANN001: Missing type annotation for public function
"ANN001",

# ANN201: Missing return type annotation for public function
"ANN201",

# D100: Missing docstring in public module
"D100",

# D103: Missing docstring in public function
"D103",

# PLR2004: Magic numbers
"PLR2004",
]
Loading
Loading