datefind 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datefind-0.1.0/.cursor/rules/all_python_rules.mdc +10 -0
- datefind-0.1.0/.cursor/rules/cursor-rule-location.mdc +13 -0
- datefind-0.1.0/.cursor/rules/inline-comment-usage.mdc +44 -0
- datefind-0.1.0/.cursor/rules/pytest-test-rules.mdc +36 -0
- datefind-0.1.0/.cursor/rules/python-docstring-rules.mdc +39 -0
- datefind-0.1.0/.cursor/rules/python-naming-conventions.mdc +12 -0
- datefind-0.1.0/.cursor/rules/use-pathlib.mdc +9 -0
- datefind-0.1.0/.github/actions/setup_python_env/action.yml +36 -0
- datefind-0.1.0/.github/dependabot.yml +23 -0
- datefind-0.1.0/.github/workflows/commit-linter.yml +35 -0
- datefind-0.1.0/.github/workflows/create-release.yml +118 -0
- datefind-0.1.0/.github/workflows/manual_pypy_publish.yml +36 -0
- datefind-0.1.0/.github/workflows/pr-linter.yml +50 -0
- datefind-0.1.0/.github/workflows/test.yml +73 -0
- datefind-0.1.0/.gitignore +56 -0
- datefind-0.1.0/.pre-commit-config.yaml +110 -0
- datefind-0.1.0/.python-version +1 -0
- datefind-0.1.0/.typos.toml +17 -0
- datefind-0.1.0/.vscode/settings.json +3 -0
- datefind-0.1.0/.yamllint.yml +32 -0
- datefind-0.1.0/CHANGELOG.md +6 -0
- datefind-0.1.0/CONTRIBUTING.md +52 -0
- datefind-0.1.0/LICENSE +9 -0
- datefind-0.1.0/PKG-INFO +85 -0
- datefind-0.1.0/README.md +67 -0
- datefind-0.1.0/codecov.yml +17 -0
- datefind-0.1.0/committed.toml +18 -0
- datefind-0.1.0/duties.py +139 -0
- datefind-0.1.0/pyproject.toml +204 -0
- datefind-0.1.0/src/datefind/__init__.py +44 -0
- datefind-0.1.0/src/datefind/constants.py +82 -0
- datefind-0.1.0/src/datefind/datefind.py +192 -0
- datefind-0.1.0/src/datefind/py.typed +0 -0
- datefind-0.1.0/src/datefind/utils/__init__.py +5 -0
- datefind-0.1.0/src/datefind/utils/date_factory.py +163 -0
- datefind-0.1.0/tests/__init__.py +1 -0
- datefind-0.1.0/tests/conftest.py +62 -0
- datefind-0.1.0/tests/test_datefind.py +175 -0
- datefind-0.1.0/uv.lock +919 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Include all python rules
|
|
3
|
+
globs: **/*.py
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
[inline-comment-usage.mdc](mdc:.cursor/rules/inline-comment-usage.mdc)
|
|
7
|
+
[pytest-test-rules.mdc](mdc:.cursor/rules/pytest-test-rules.mdc)
|
|
8
|
+
[python-docstring-rules.mdc](mdc:.cursor/rules/python-docstring-rules.mdc)
|
|
9
|
+
[python-naming-conventions.mdc](mdc:.cursor/rules/python-naming-conventions.mdc)
|
|
10
|
+
[use-pathlib.mdc](mdc:.cursor/rules/use-pathlib.mdc)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Cursor Rules Location, creating cursor rules files
|
|
3
|
+
globs: *.mdc
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Cursor Rules Location
|
|
7
|
+
|
|
8
|
+
Always follow these rules when creating cursor rule files
|
|
9
|
+
|
|
10
|
+
1. Only use `.mdc` for the file extension
|
|
11
|
+
2. Always place rule files in `PROJECT_ROOT/.cursor/rules/`
|
|
12
|
+
3. Use kebab case for filenames
|
|
13
|
+
4. Make filenames descriptive of the rule's purpose
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: writing inline comments in code, editing inline comments in code
|
|
3
|
+
globs: **/*.py
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Writing inline comments
|
|
7
|
+
|
|
8
|
+
Always follow these standards for writing inline comments within the codebase to enhance understanding and avoid clutter.
|
|
9
|
+
|
|
10
|
+
1. Use comments sparingly, and when you do write comments, make them meaningful.
|
|
11
|
+
2. Don't comment on obvious things. Excessive or unclear comments can clutter the codebase and become outdated.
|
|
12
|
+
3. Only use comments to convey the "why" behind specific actions or to explain unusual behavior and potential pitfalls.
|
|
13
|
+
4. In python use `#` for single-line comments and `"""` for multi-line comments.
|
|
14
|
+
5. Never change or remove 'noqa' or 'type: ignore' comments
|
|
15
|
+
6. Never describe the code. Assume the person reading the code knows Python (though not what you're trying to do) better than you do.
|
|
16
|
+
|
|
17
|
+
## Examples of good inline comment usage:
|
|
18
|
+
|
|
19
|
+
These comments are good because they explain WHY certain steps are made
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
# Process items in reverse to ensure the most recent data is prioritized over older data to match user expectations
|
|
23
|
+
for items in reversed(items):
|
|
24
|
+
item.price = 20 # Set the price to 20 to match the competitor's pricing strategy
|
|
25
|
+
...
|
|
26
|
+
|
|
27
|
+
This comment is good because it clarifies complex logic
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
# This loop uses the Fisher-Yates algorithm to shuffle the array
|
|
31
|
+
|
|
32
|
+
for i in range(len(arr) - 1, 0, -1):
|
|
33
|
+
j = random.randint(0, i)
|
|
34
|
+
arr[i], arr[j] = arr[j], arr[i]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
# We use a weighted dictionary search to find out where i is in
|
|
39
|
+
# the array. We extrapolate position based on the largest num
|
|
40
|
+
# in the array and the array size and then do binary search to
|
|
41
|
+
# get the exact number.
|
|
42
|
+
|
|
43
|
+
if i & (i-1) == 0: # True if i is 0 or a power of 2.
|
|
44
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Writing pytest tests, editing pytest tests
|
|
3
|
+
globs: tests/**/*.py
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Standards for writing pytest tests
|
|
7
|
+
|
|
8
|
+
Always follow these rules and standards for writing Python tests.
|
|
9
|
+
|
|
10
|
+
1. Write single sentence docstrings in imperative voice
|
|
11
|
+
2. Docstrings should always start with the word "Verify"
|
|
12
|
+
3. Structure test body with given/when/then comments
|
|
13
|
+
4. Use pytest-mock plugin. Do not use unittest.
|
|
14
|
+
5. Include unit and integration tests.
|
|
15
|
+
|
|
16
|
+
## Examples of good tests
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
def test_backup_file_creates_backup(tmp_path: Path, mocker) -> None:
|
|
20
|
+
"""Verify creating backups file with .bak extension."""
|
|
21
|
+
# Given a constant return from module.function
|
|
22
|
+
mock_function = mocker.patch('module.function')
|
|
23
|
+
mock_function.return_value = 'mocked'
|
|
24
|
+
|
|
25
|
+
# Given: A test file exists
|
|
26
|
+
file = tmp_path / "test.txt"
|
|
27
|
+
file.write_text("test")
|
|
28
|
+
|
|
29
|
+
# When: Creating a backup
|
|
30
|
+
backup_file(file)
|
|
31
|
+
|
|
32
|
+
# Then: Backup file exists and original is moved
|
|
33
|
+
expected_backup = file.parent / (file.name + ".bak")
|
|
34
|
+
assert expected_backup.exists()
|
|
35
|
+
assert not file.exists()
|
|
36
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Writing python docstrings, Editing python docstrings
|
|
3
|
+
globs: *.py
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Writing python docstrings
|
|
7
|
+
|
|
8
|
+
Always follow these rules when writing Python docstrings
|
|
9
|
+
|
|
10
|
+
1. Read and understand the entire function or class before writing the docstring
|
|
11
|
+
2. Always use Google format docstrings
|
|
12
|
+
3. Always include Types with arguments
|
|
13
|
+
4. Do not document return when nothing is returned
|
|
14
|
+
5. Only write in imperative voice. No Exceptions!
|
|
15
|
+
6. Never say "This function ..." Only use imperative voice.
|
|
16
|
+
7. Docstrings should always be descriptive and explain why a developer would use the function, not just what it does
|
|
17
|
+
8, Do not use line wraps and newlines within paragraphs.
|
|
18
|
+
9. Do not included raised exceptions unless they are explicitly raised in the code
|
|
19
|
+
|
|
20
|
+
## Examples of good python docstrings
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
def read_config(path: Path = "config.toml", globs:list[str] | None = None) -> list[Path]:
|
|
24
|
+
"""Read and validate the TOML configuration file that maps repository names to paths.
|
|
25
|
+
|
|
26
|
+
Search the given `path` for files matching any of the glob patterns provided in `globs`. If no globs are provided, returns all files in the directory.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
path (Path): The root directory where the search will be conducted.
|
|
30
|
+
globs (list[str] | None, optional): A list of glob patterns to match files (e.g., "*.txt", "*.py"). If None, returns all files. Defaults to None.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
list[Path]: A list of Path objects representing the files that match the glob patterns.
|
|
34
|
+
|
|
35
|
+
Raises:
|
|
36
|
+
cappa.Exit: If the config file doesn't exist, contains invalid TOML, or has invalid repository paths
|
|
37
|
+
"""
|
|
38
|
+
...
|
|
39
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: naming conventions for python
|
|
3
|
+
globs: **/*.py
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
Always follow these standards for Python naming convention.
|
|
7
|
+
|
|
8
|
+
- Use snake_case for variables.
|
|
9
|
+
- Use snake_case for functions.
|
|
10
|
+
- Use PascalCase for classes.
|
|
11
|
+
- Use PascalCase for interfaces.
|
|
12
|
+
- Use snake_case for files.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Install uv, Python, and project dependencies
|
|
3
|
+
description: Install uv, Python, and project dependencies using cached uv and Python installations
|
|
4
|
+
|
|
5
|
+
inputs:
|
|
6
|
+
python-version:
|
|
7
|
+
description: >
|
|
8
|
+
Version range or exact version of a Python version to use, using SemVer's version range syntax.
|
|
9
|
+
required: false
|
|
10
|
+
default: "3.12"
|
|
11
|
+
|
|
12
|
+
outputs:
|
|
13
|
+
python-version:
|
|
14
|
+
description: The installed python version. Useful when given a version range as input.
|
|
15
|
+
value: ${{ steps.setup-python.outputs.python-version }}
|
|
16
|
+
|
|
17
|
+
runs:
|
|
18
|
+
using: composite
|
|
19
|
+
steps:
|
|
20
|
+
- name: Setup uv with cache
|
|
21
|
+
uses: astral-sh/setup-uv@v6
|
|
22
|
+
with:
|
|
23
|
+
version: "latest"
|
|
24
|
+
enable-cache: true
|
|
25
|
+
|
|
26
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
27
|
+
shell: bash
|
|
28
|
+
run: uv python install ${{ matrix.python-version }}
|
|
29
|
+
|
|
30
|
+
- name: Install the project
|
|
31
|
+
shell: bash
|
|
32
|
+
run: uv sync --all-extras --dev
|
|
33
|
+
|
|
34
|
+
- name: Minimize uv cache
|
|
35
|
+
shell: bash
|
|
36
|
+
run: uv cache prune --ci
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: 2
|
|
3
|
+
|
|
4
|
+
updates:
|
|
5
|
+
- package-ecosystem: github-actions
|
|
6
|
+
directory: /
|
|
7
|
+
schedule:
|
|
8
|
+
interval: monthly
|
|
9
|
+
commit-message:
|
|
10
|
+
prefix: "ci"
|
|
11
|
+
prefix-development: "ci"
|
|
12
|
+
include: "scope"
|
|
13
|
+
# - package-ecosystem: pip
|
|
14
|
+
# directory: /
|
|
15
|
+
# schedule:
|
|
16
|
+
# interval: monthly
|
|
17
|
+
# commit-message:
|
|
18
|
+
# prefix: "build"
|
|
19
|
+
# prefix-development: "build"
|
|
20
|
+
# include: "scope"
|
|
21
|
+
# versioning-strategy: lockfile-only
|
|
22
|
+
# allow:
|
|
23
|
+
# - dependency-type: "all"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Commit Linter
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
pull_request:
|
|
9
|
+
types:
|
|
10
|
+
- opened
|
|
11
|
+
- reopened
|
|
12
|
+
- synchronize
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
permissions: # added using https://github.com/step-security/secure-workflows
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
lint-commits:
|
|
23
|
+
if: "!contains(github.event.head_commit.message, 'bump(release)')"
|
|
24
|
+
permissions:
|
|
25
|
+
contents: read # for actions/checkout to fetch code
|
|
26
|
+
pull-requests: read # for wagoid/commitlint-github-action to get commits in PR
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout repository
|
|
30
|
+
uses: actions/checkout@v4
|
|
31
|
+
with:
|
|
32
|
+
fetch-depth: 0
|
|
33
|
+
|
|
34
|
+
- name: Lint commits
|
|
35
|
+
uses: wagoid/commitlint-github-action@v6
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Create Release"
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
auto-release:
|
|
19
|
+
name: Create Release
|
|
20
|
+
runs-on: "ubuntu-latest"
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: true
|
|
23
|
+
matrix:
|
|
24
|
+
python-version: ["3.11"]
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout repository
|
|
27
|
+
uses: actions/checkout@v4
|
|
28
|
+
with:
|
|
29
|
+
fetch-depth: 0
|
|
30
|
+
|
|
31
|
+
- name: Setup Python, uv, and the package
|
|
32
|
+
uses: ./.github/actions/setup_python_env
|
|
33
|
+
|
|
34
|
+
# ----------------------------------------------
|
|
35
|
+
# Grab version number
|
|
36
|
+
# ----------------------------------------------
|
|
37
|
+
|
|
38
|
+
- name: Add version to environment vars
|
|
39
|
+
run: |
|
|
40
|
+
PROJECT_VERSION=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
|
|
41
|
+
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
|
|
42
|
+
|
|
43
|
+
# ----------------------------------------------
|
|
44
|
+
# Confirm we did, in fact, update the version
|
|
45
|
+
# ----------------------------------------------
|
|
46
|
+
|
|
47
|
+
- name: Check if tag version matches project version
|
|
48
|
+
run: |
|
|
49
|
+
TAG=$(git describe HEAD --tags --abbrev=0)
|
|
50
|
+
echo $TAG
|
|
51
|
+
echo $PROJECT_VERSION
|
|
52
|
+
if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi
|
|
53
|
+
echo "CURRENT_TAG=refs/tags/${TAG}" >> $GITHUB_ENV
|
|
54
|
+
|
|
55
|
+
# ----------------------------------------------
|
|
56
|
+
# Test and then build the package
|
|
57
|
+
# ----------------------------------------------
|
|
58
|
+
|
|
59
|
+
- name: Run tests
|
|
60
|
+
shell: bash
|
|
61
|
+
run: uv run duty test
|
|
62
|
+
|
|
63
|
+
- name: Build the package
|
|
64
|
+
shell: bash
|
|
65
|
+
run: uv build
|
|
66
|
+
|
|
67
|
+
# ----------------------------------------------
|
|
68
|
+
# Generate release notes
|
|
69
|
+
# ----------------------------------------------
|
|
70
|
+
|
|
71
|
+
# - name: Release Notes
|
|
72
|
+
# run: git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s' --no-merges >> ".github/RELEASE-TEMPLATE.md"
|
|
73
|
+
|
|
74
|
+
- name: Get notes
|
|
75
|
+
id: generate_notes
|
|
76
|
+
uses: anmarkoulis/commitizen-changelog-reader@master
|
|
77
|
+
with:
|
|
78
|
+
tag_name: ${{ env.CURRENT_TAG }}
|
|
79
|
+
changelog: CHANGELOG.md
|
|
80
|
+
|
|
81
|
+
# ----------------------------------------------
|
|
82
|
+
# Build draft release (Note: Will need to manually publish)
|
|
83
|
+
# ----------------------------------------------
|
|
84
|
+
|
|
85
|
+
- name: Create Github Release
|
|
86
|
+
uses: softprops/action-gh-release@v2
|
|
87
|
+
with:
|
|
88
|
+
body: ${{join(fromJson(steps.generate_notes.outputs.notes).notes, '')}}
|
|
89
|
+
draft: false
|
|
90
|
+
files: |
|
|
91
|
+
dist/*-${{env.PROJECT_VERSION}}-py3-none-any.whl
|
|
92
|
+
dist/*-${{env.PROJECT_VERSION}}.tar.gz
|
|
93
|
+
env:
|
|
94
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
95
|
+
|
|
96
|
+
publish-to-pypi:
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
needs: auto-release
|
|
99
|
+
env:
|
|
100
|
+
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
|
|
101
|
+
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
|
102
|
+
strategy:
|
|
103
|
+
matrix:
|
|
104
|
+
python-version: ["3.11"]
|
|
105
|
+
steps:
|
|
106
|
+
- name: Checkout repository
|
|
107
|
+
uses: actions/checkout@v4
|
|
108
|
+
|
|
109
|
+
- name: Setup Python, uv, and the package
|
|
110
|
+
uses: ./.github/actions/setup_python_env
|
|
111
|
+
|
|
112
|
+
- name: Build the package
|
|
113
|
+
shell: bash
|
|
114
|
+
run: uv build
|
|
115
|
+
|
|
116
|
+
- name: Upload to PyPi
|
|
117
|
+
shell: bash
|
|
118
|
+
run: uvx twine upload dist/*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Manual PyPy Publish"
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
concurrency:
|
|
8
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
+
cancel-in-progress: true
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
publish-to-pypi:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
env:
|
|
18
|
+
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
|
|
19
|
+
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
|
20
|
+
strategy:
|
|
21
|
+
matrix:
|
|
22
|
+
python-version: ["3.11"]
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout repository
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- name: Setup Python, uv, and the package
|
|
28
|
+
uses: ./.github/actions/setup_python_env
|
|
29
|
+
|
|
30
|
+
- name: Build the package
|
|
31
|
+
shell: bash
|
|
32
|
+
run: uv build
|
|
33
|
+
|
|
34
|
+
- name: Upload to PyPi
|
|
35
|
+
shell: bash
|
|
36
|
+
run: uvx twine upload dist/*
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Pull Request Linter
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request_target:
|
|
6
|
+
types:
|
|
7
|
+
- opened
|
|
8
|
+
- edited
|
|
9
|
+
- synchronize
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
permissions: # added using https://github.com/step-security/secure-workflows
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
lint:
|
|
22
|
+
permissions:
|
|
23
|
+
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
|
|
24
|
+
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- name: Lint Pull Request
|
|
29
|
+
uses: amannn/action-semantic-pull-request@v5
|
|
30
|
+
with:
|
|
31
|
+
validateSingleCommit: true
|
|
32
|
+
wip: true
|
|
33
|
+
types: |
|
|
34
|
+
fix
|
|
35
|
+
feat
|
|
36
|
+
docs
|
|
37
|
+
style
|
|
38
|
+
refactor
|
|
39
|
+
perf
|
|
40
|
+
test
|
|
41
|
+
build
|
|
42
|
+
ci
|
|
43
|
+
requireScope: false
|
|
44
|
+
subjectPattern: ^(?![A-Z]).+$
|
|
45
|
+
subjectPatternError: |
|
|
46
|
+
The subject "{subject}" found in the pull request title "{title}"
|
|
47
|
+
didn't match the configured pattern. Please ensure that the subject
|
|
48
|
+
doesn't start with an uppercase character.
|
|
49
|
+
env:
|
|
50
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Tests"
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
push:
|
|
7
|
+
paths:
|
|
8
|
+
- ".github/workflows/test.yml"
|
|
9
|
+
- ".github/actions/**"
|
|
10
|
+
- "**.py"
|
|
11
|
+
- "pyproject.toml"
|
|
12
|
+
- "uv.lock"
|
|
13
|
+
branches:
|
|
14
|
+
- main
|
|
15
|
+
pull_request:
|
|
16
|
+
types:
|
|
17
|
+
- opened
|
|
18
|
+
- reopened
|
|
19
|
+
- synchronize
|
|
20
|
+
paths:
|
|
21
|
+
- ".github/workflows/test.yml"
|
|
22
|
+
- ".github/actions/**"
|
|
23
|
+
- "**.py"
|
|
24
|
+
- "pyproject.toml"
|
|
25
|
+
- "uv.lock"
|
|
26
|
+
|
|
27
|
+
concurrency:
|
|
28
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
29
|
+
cancel-in-progress: true
|
|
30
|
+
|
|
31
|
+
jobs:
|
|
32
|
+
test-python-code:
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
strategy:
|
|
35
|
+
fail-fast: true
|
|
36
|
+
matrix:
|
|
37
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
38
|
+
steps:
|
|
39
|
+
- name: Checkout repository
|
|
40
|
+
uses: actions/checkout@v4
|
|
41
|
+
|
|
42
|
+
- name: Setup Python, uv, and the package
|
|
43
|
+
uses: ./.github/actions/setup_python_env
|
|
44
|
+
|
|
45
|
+
- name: Run tests
|
|
46
|
+
shell: bash
|
|
47
|
+
run: uv run duty test
|
|
48
|
+
|
|
49
|
+
- name: Upload coverage to Codecov
|
|
50
|
+
if: ${{ matrix.python-version == '3.12' }}
|
|
51
|
+
uses: codecov/codecov-action@v5
|
|
52
|
+
with:
|
|
53
|
+
files: .cache/coverage.xml
|
|
54
|
+
env:
|
|
55
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
56
|
+
|
|
57
|
+
lint-project:
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
steps:
|
|
60
|
+
- name: Checkout repository
|
|
61
|
+
uses: actions/checkout@v4
|
|
62
|
+
|
|
63
|
+
- uses: actions/cache@v4
|
|
64
|
+
with:
|
|
65
|
+
path: ~/.cache/pre-commit
|
|
66
|
+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
67
|
+
|
|
68
|
+
- name: Setup Python, uv, and the package
|
|
69
|
+
uses: ./.github/actions/setup_python_env
|
|
70
|
+
|
|
71
|
+
- name: run all linters
|
|
72
|
+
shell: bash
|
|
73
|
+
run: uv run duty lint
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Scratch folder for temporary files
|
|
2
|
+
scratch/
|
|
3
|
+
tmp/
|
|
4
|
+
development/
|
|
5
|
+
.development/
|
|
6
|
+
dev-config.toml
|
|
7
|
+
|
|
8
|
+
# Caches
|
|
9
|
+
*_cache/
|
|
10
|
+
__pycache__/
|
|
11
|
+
.cache/
|
|
12
|
+
|
|
13
|
+
# Coverage.py
|
|
14
|
+
htmlcov/
|
|
15
|
+
reports/
|
|
16
|
+
.reports/
|
|
17
|
+
|
|
18
|
+
# cruft
|
|
19
|
+
*.rej
|
|
20
|
+
|
|
21
|
+
# Data
|
|
22
|
+
*.csv*
|
|
23
|
+
*.dat*
|
|
24
|
+
*.pickle*
|
|
25
|
+
*.xls*
|
|
26
|
+
*.zip*
|
|
27
|
+
|
|
28
|
+
.envrc
|
|
29
|
+
.env
|
|
30
|
+
|
|
31
|
+
# Jupyter
|
|
32
|
+
*.ipynb
|
|
33
|
+
.ipynb_checkpoints/
|
|
34
|
+
notebooks/
|
|
35
|
+
|
|
36
|
+
# macOS
|
|
37
|
+
.DS_Store
|
|
38
|
+
|
|
39
|
+
# mypy
|
|
40
|
+
.dmypy.json
|
|
41
|
+
|
|
42
|
+
# Node.js
|
|
43
|
+
node_modules/
|
|
44
|
+
|
|
45
|
+
# Poetry
|
|
46
|
+
.venv/
|
|
47
|
+
dist/
|
|
48
|
+
|
|
49
|
+
# PyCharm
|
|
50
|
+
.idea/
|
|
51
|
+
|
|
52
|
+
# Python
|
|
53
|
+
*.py[cdo]
|
|
54
|
+
|
|
55
|
+
# act run workflows locally
|
|
56
|
+
bin/act
|