diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ade813..ea7ad6b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,8 +58,7 @@ jobs: python-version: '3.12' - name: Install Dependencies run: | - python -m pip install setuptools - python setup.py develop + python -m pip install -r requirements.txt - name: Generate Distribution run: | python -m blog.generate diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bc2e44e..24f7ab6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,8 +32,7 @@ jobs: python-version: '3.12' - name: Install Dependencies run: | - python -m pip install setuptools pylint pytest requests-mock coverage - python setup.py develop + python -m pip install -r requirements.txt - name: Test run: | coverage run -m pytest --verbose --junit-xml tests.xml diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 013461a..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -graft app/assets -graft app/static -graft app/templates -global-exclude *.pyc \ No newline at end of file diff --git a/README.md b/README.md index b49c894..f23d72b 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ static site. You will require Python 3. Run the following to install required modules: ```bash +python3 -m pip installl -r requirements.txt python3 setup.py develop ``` @@ -20,14 +21,25 @@ python3 -m blog.generate To run a local Docker instance of Nginx to serve a generated set of files, run: ```bash -docker run --rm --name blog -v $(pwd)/docker/nginx.conf:/etc/nginx/nginx.conf:ro -v $(pwd)/dist:/usr/share/nginx/html -p 8080:80 nginx +docker run --rm -d --name blog -v $(pwd)/docker/nginx.conf:/etc/nginx/nginx.conf:ro -v $(pwd)/dist:/usr/share/nginx/html -p 8080:80 nginx ``` +You can then run the when-changed package to automatically generate the blog files anytime a change is made: + +```bash +when-changed -r -1 articles blog -c python3 -m blog.generate +``` + +*(You must be using a virtual environment or your +Python bin files must be on your path for this to work.)* + Then head to http://localhost:8080 to view the results. +You can stop the docker container with `docker stop blog`. + ## Testing -Testing uses Pytest - run it as follows: +Testing uses Pytest - run it as follows (installing the required modules too): ```bash pytest --verbose diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bba486e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,23 @@ +astroid==3.2.4 +certifi==2024.7.4 +charset-normalizer==3.3.2 +coverage==7.6.1 +dill==0.3.8 +idna==3.7 +iniconfig==2.0.0 +isort==5.13.2 +Jinja2==3.1.4 +Markdown==3.6 +MarkupSafe==2.1.5 +mccabe==0.7.0 +packaging==24.1 +platformdirs==4.2.2 +pluggy==1.5.0 +pylint==3.2.6 +pytest==8.3.2 +requests==2.32.3 +requests-mock==1.12.1 +tomlkit==0.13.0 +urllib3==2.2.2 +watchdog==4.0.2 +when-changed==0.3.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b11f66a..0000000 --- a/setup.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[metadata] -name = blog -maintainer = Jamie Hurst -maintainer_email = jamie@jamiehurst.co.uk -description = Basic blog application using Markdown articles. -long_description = file: README.md -long_description_content_type = text/markdown - -[tool:pytest] -testpaths = tests - -[coverage:run] -branch = True -source = - blog diff --git a/setup.py b/setup.py deleted file mode 100644 index 8a3269e..0000000 --- a/setup.py +++ /dev/null @@ -1,12 +0,0 @@ -from setuptools import find_packages, setup - -setup( - name='blog', - packages=find_packages(), - include_package_data=True, - zip_safe=False, - install_requires=[ - 'jinja2', - 'markdown', - ], -)