Skip to content

Commit

Permalink
Use pyproject.toml, update gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
timvink authored Sep 8, 2024
1 parent d424ed9 commit a31b4bb
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 72 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ jobs:
run: |
git config --global user.name "Github Action"
git config --global user.email "githubaction@gmail.com"
pip install -r tests/test_requirements.txt
pip install mkdocs-material
pip install -r requirements_dev.txt
pip install .
pytest
- name: Build
run: |
python setup.py sdist bdist_wheel
Expand All @@ -46,5 +44,5 @@ jobs:

- name: Deploy mkdocs site
run: |
pip install mkdocs-git-authors-plugin
pip install -r requirements_dev.txt
mkdocs gh-deploy --force
4 changes: 2 additions & 2 deletions .github/workflows/scheduled_unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: "3.11"
python-version: "3.12"

- name: Install dependencies
run: |
pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade wheel
pip3 install -r tests/test_requirements.txt
pip3 install -r requirements_dev.txt
pip3 install .
- name: Run unit tests
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ jobs:
pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade wheel
pip3 install pyflakes
pip3 install -r tests/test_requirements.txt
pip3 install -r requirements_dev.txt
pip3 install .
- name: Static code checking with pyflakes
run: |
pyflakes mkdocs_git_revision_date_localized_plugin
- name: Run unit tests
run: |
git config --global user.name "Github Action"
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/unittests_codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ jobs:
pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade wheel
pip3 install pyflakes
pip3 install -r tests/test_requirements.txt
pip install -r requirements_dev.txt
pip3 install .
- name: Static code checking with pyflakes
run: |
pyflakes mkdocs_git_revision_date_localized_plugin
- name: Generate coverage report
run: |
git config --global user.name "Github Action"
Expand All @@ -47,9 +42,10 @@ jobs:
- name: Upload coverage to Codecov
if: "contains(env.USING_COVERAGE, matrix.python-version)"
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
files: ./coverage.xml
flags: unittests
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
9 changes: 1 addition & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,13 @@ Thanks for considering to contribute to this project! Some guidelines:
Make sure to install an editable version before running the tests:

```python
pip install -r tests/test_requirements.txt
pip install -r requirement_dev.txt
pip install -e .
pytest --cov=mkdocs_git_revision_date_localized_plugin --cov-report term-missing tests/
```

If it makes sense, writing tests for your PRs is always appreciated and will help get them merged.

In addition, this project uses [flake8](https://github.com/PyCQA/flake8) for static code checking:

```python
pip install pyflakes
pyflakes tests/ mkdocs_git_revision_date_localized_plugin/
```

## Manual testing

To quickly serve a test website with your latest changes to the plugin use the sites in our tests suite.
Expand Down
Empty file.
116 changes: 116 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
[build-system]
requires = ["setuptools>=70.0", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"

[project.entry-points."mkdocs.plugins"]
"git-revision-date-localized" = "mkdocs_git_revision_date_localized_plugin.plugin:GitRevisionDateLocalizedPlugin"

[project]
name="mkdocs-git-revision-date-localized-plugin"
keywords = ["mkdocs", "plugin"]
authors = [
{ name = "Tim Vink", email = "vinktim@gmail.com" }
]
license = { text = "MIT" }

description="Mkdocs plugin that enables displaying the localized date of the last git modification of a markdown file."
readme = { file = "README.md", content-type = "text/markdown" }

requires-python=">=3.8"

classifiers=[
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
]

dynamic = ["version","dependencies","optional-dependencies"]

[project.urls]
"Homepage" = "https://github.com/timvink/mkdocs-git-revision-date-localized-plugin"

[tool.setuptools.dynamic]
version = {attr = "mkdocs_git_revision_date_localized_plugin.__version__"}

dependencies={file = ["requirements.txt"]}

optional-dependencies.dev={file = ["requirements_dev.txt"]}
optional-dependencies.base={file = ["requirements.txt"]}
optional-dependencies.all={file = ["requirements.txt", "requirements_dev.txt"]}

[tool.pytest.ini_options]
markers = [
"serial",
"no_temp_caching",
]

# https://github.com/charliermarsh/ruff
[tool.ruff]

# Rules to apply
lint.select= ["E", "F", "I", "UP"]

# Exclude rules
lint.ignore = ['D104'
,'D212'
,'D200'
,'D412'
,'E731'
,'E501'
,'E722'
,'D104'
,'E402'
,"UP038" # UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)`
]

# Exclude files in tests dir
lint.exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]

# Set line length, keep same as black
line-length = 120

extend-exclude = [
"*.yml",
"*.toml",
"*.md",
".json",
"Makefile",
"*.txt",
]

#supported for python 3.10
target-version = "py310"

# Always autofix
fix = true

[tool.uv]
dev-dependencies = [
"ruff",
]
3 changes: 2 additions & 1 deletion tests/test_requirements.txt → requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ codecov
click
mkdocs-material
mkdocs-static-i18n
mkdocs-gen-files
mkdocs-gen-files
mkdocs-git-authors-plugin
42 changes: 0 additions & 42 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions src/mkdocs_git_revision_date_localized_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.2.8"

0 comments on commit a31b4bb

Please sign in to comment.