coauthor 0.0.5__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.
Potentially problematic release.
This version of coauthor might be problematic. Click here for more details.
- coauthor-0.0.5/.bumpversion.toml +29 -0
- coauthor-0.0.5/.coauthor/templates/coauthor/ai-file-update/system.md +83 -0
- coauthor-0.0.5/.coauthor.yml +25 -0
- coauthor-0.0.5/.github/dependabot.yml +22 -0
- coauthor-0.0.5/.github/template-sync.yml +21 -0
- coauthor-0.0.5/.github/workflows/CI.yml +21 -0
- coauthor-0.0.5/.github/workflows/publish.yml +10 -0
- coauthor-0.0.5/.github/workflows/schedule-update-actions.yml +25 -0
- coauthor-0.0.5/.github/workflows/semantic-pr-check.yml +17 -0
- coauthor-0.0.5/.github/workflows/sphinx.yml +18 -0
- coauthor-0.0.5/.github/workflows/template-sync.yml +12 -0
- coauthor-0.0.5/.gitignore +130 -0
- coauthor-0.0.5/.gitlab-ci.yml +175 -0
- coauthor-0.0.5/.pre-commit-config.yaml +60 -0
- coauthor-0.0.5/.pypirc +10 -0
- coauthor-0.0.5/.readthedocs.yaml +14 -0
- coauthor-0.0.5/.vscode/launch.json +19 -0
- coauthor-0.0.5/.vscode/settings.json +32 -0
- coauthor-0.0.5/CHANGELOG.md +13 -0
- coauthor-0.0.5/CODE_OF_CONDUCT.md +9 -0
- coauthor-0.0.5/LICENSE +21 -0
- coauthor-0.0.5/PKG-INFO +219 -0
- coauthor-0.0.5/README.md +175 -0
- coauthor-0.0.5/SECURITY.md +41 -0
- coauthor-0.0.5/SUPPORT.md +25 -0
- coauthor-0.0.5/docs/_static/logo.png +0 -0
- coauthor-0.0.5/docs/conf.py +77 -0
- coauthor-0.0.5/docs/index.md +35 -0
- coauthor-0.0.5/docs/requirements.txt +6 -0
- coauthor-0.0.5/docs/users/changelog.md +6 -0
- coauthor-0.0.5/docs/users/configuration_file.md +52 -0
- coauthor-0.0.5/docs/users/installation_and_usage.md +11 -0
- coauthor-0.0.5/pyproject.toml +283 -0
- coauthor-0.0.5/src/README.md +1 -0
- coauthor-0.0.5/src/coauthor/__init__.py +5 -0
- coauthor-0.0.5/src/coauthor/main.py +81 -0
- coauthor-0.0.5/src/coauthor/modules/__init__.py +3 -0
- coauthor-0.0.5/src/coauthor/modules/ai.py +177 -0
- coauthor-0.0.5/src/coauthor/modules/file_processor.py +64 -0
- coauthor-0.0.5/src/coauthor/modules/file_scanner.py +45 -0
- coauthor-0.0.5/src/coauthor/modules/file_watcher.py +173 -0
- coauthor-0.0.5/src/coauthor/modules/workflow.py +32 -0
- coauthor-0.0.5/src/coauthor/modules/workflow_tasks.py +32 -0
- coauthor-0.0.5/src/coauthor/utils/config.py +73 -0
- coauthor-0.0.5/src/coauthor/utils/git.py +47 -0
- coauthor-0.0.5/src/coauthor/utils/jinja.py +101 -0
- coauthor-0.0.5/src/coauthor/utils/jinja_filters.py +53 -0
- coauthor-0.0.5/src/coauthor/utils/logger.py +43 -0
- coauthor-0.0.5/src/coauthor/utils/match_utils.py +127 -0
- coauthor-0.0.5/src/coauthor/utils/workflow_utils.py +35 -0
- coauthor-0.0.5/tests/conftest.py +65 -0
- coauthor-0.0.5/tests/data/coauthor-markdown-no-regex.yml +2 -0
- coauthor-0.0.5/tests/data/coauthor-markdown.yml +8 -0
- coauthor-0.0.5/tests/data/coauthor-markdown2.yml +13 -0
- coauthor-0.0.5/tests/data/coauthor-regex-replace.yml +18 -0
- coauthor-0.0.5/tests/data/coauthor-workflows.yml +38 -0
- coauthor-0.0.5/tests/data/coauthor.yml +2 -0
- coauthor-0.0.5/tests/data/coauthor_task_pong.yml +20 -0
- coauthor-0.0.5/tests/data/coauthor_test_match_utils.yml +11 -0
- coauthor-0.0.5/tests/data/coauthor_translation.yml +24 -0
- coauthor-0.0.5/tests/data/coauthor_translation2.yml +19 -0
- coauthor-0.0.5/tests/data/whatever.md +10 -0
- coauthor-0.0.5/tests/data/whatever_without_instruction.md +5 -0
- coauthor-0.0.5/tests/modules/test_file_scanner.py +72 -0
- coauthor-0.0.5/tests/modules/test_workflow.py +46 -0
- coauthor-0.0.5/tests/requirements.txt +5 -0
- coauthor-0.0.5/tests/test_ai.py +162 -0
- coauthor-0.0.5/tests/test_ai_live.py +97 -0
- coauthor-0.0.5/tests/test_ai_translation.py +73 -0
- coauthor-0.0.5/tests/test_config_utils.py +117 -0
- coauthor-0.0.5/tests/test_file_processor.py +133 -0
- coauthor-0.0.5/tests/test_git.py +41 -0
- coauthor-0.0.5/tests/test_jinja.py +149 -0
- coauthor-0.0.5/tests/test_jinja_filters.py +242 -0
- coauthor-0.0.5/tests/test_logger_utils.py +66 -0
- coauthor-0.0.5/tests/test_main.py +56 -0
- coauthor-0.0.5/tests/test_match_utils.py +166 -0
- coauthor-0.0.5/tests/test_watch_utils.py +156 -0
- coauthor-0.0.5/tests/test_workflow_utils.py +30 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[tool.bumpversion]
|
|
2
|
+
current_version = "0.0.5"
|
|
3
|
+
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
|
4
|
+
serialize = ["{major}.{minor}.{patch}"]
|
|
5
|
+
search = "{current_version}"
|
|
6
|
+
replace = "{new_version}"
|
|
7
|
+
regex = false
|
|
8
|
+
ignore_missing_version = false
|
|
9
|
+
ignore_missing_files = false
|
|
10
|
+
tag = false
|
|
11
|
+
sign_tags = false
|
|
12
|
+
tag_name = "v{new_version}"
|
|
13
|
+
tag_message = "Bump version: {current_version} → {new_version}"
|
|
14
|
+
allow_dirty = false
|
|
15
|
+
commit = false
|
|
16
|
+
message = "Bump version: {current_version} → {new_version}"
|
|
17
|
+
commit_args = ""
|
|
18
|
+
setup_hooks = []
|
|
19
|
+
pre_commit_hooks = []
|
|
20
|
+
post_commit_hooks = []
|
|
21
|
+
|
|
22
|
+
[[tool.bumpversion.files]]
|
|
23
|
+
filename = "pyproject.toml"
|
|
24
|
+
|
|
25
|
+
[[tool.bumpversion.files]]
|
|
26
|
+
filename = "src/coauthor/__init__.py"
|
|
27
|
+
|
|
28
|
+
[[tool.bumpversion.files]]
|
|
29
|
+
filename = "docs/conf.py"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Python Co-Author
|
|
2
|
+
|
|
3
|
+
## IDENTITY AND PURPOSE
|
|
4
|
+
|
|
5
|
+
You are a co-author of Python files tasked with enhancing, completing and
|
|
6
|
+
refining them based on specific embedded instructions.
|
|
7
|
+
|
|
8
|
+
## GOAL
|
|
9
|
+
|
|
10
|
+
Effectively process the Python file by understanding and implementing
|
|
11
|
+
the instructions provided. Achieve this by following these guidelines:
|
|
12
|
+
|
|
13
|
+
## STEPS
|
|
14
|
+
|
|
15
|
+
1. **Evaluation**:
|
|
16
|
+
- Thoroughly read the Python file received as input for comprehensive
|
|
17
|
+
understanding.
|
|
18
|
+
|
|
19
|
+
2. **Instruction Identification**:
|
|
20
|
+
- Locate all co-author instructions contained between parentheses,
|
|
21
|
+
prefixed
|
|
22
|
+
with `ai:` (e.g., `(ai: modify this sentence...)`) or `@ai:`.
|
|
23
|
+
|
|
24
|
+
3. **Instruction Interpretation**:
|
|
25
|
+
- Comprehend each instruction in the context of the given Python file
|
|
26
|
+
content.
|
|
27
|
+
Differentiate between localized instructions and those applicable to the
|
|
28
|
+
entire document.
|
|
29
|
+
4. **Python Guidelines**:
|
|
30
|
+
- **Pytest**: The Python project used Pytest so if asked for a test, you should
|
|
31
|
+
assume a Pytest test. An example test is:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
def test_ping():
|
|
35
|
+
test_content = "ping"
|
|
36
|
+
mocked_open = mock_open(read_data=test_content)
|
|
37
|
+
|
|
38
|
+
# Create a mock logger
|
|
39
|
+
mock_logger = mock.Mock()
|
|
40
|
+
|
|
41
|
+
with mock.patch("builtins.open", mocked_open):
|
|
42
|
+
# Call the pong function with a mock path and mock logger
|
|
43
|
+
pong("mock_path", config=None, logger=mock_logger)
|
|
44
|
+
|
|
45
|
+
# Check if the file content was updated to 'pong'
|
|
46
|
+
# Reconfigure the mocked_open to check the write call
|
|
47
|
+
mocked_open().write.assert_called_once_with("pong")
|
|
48
|
+
|
|
49
|
+
# Ensure logger was called with appropriate messages
|
|
50
|
+
mock_logger.info.assert_any_call("Running the pong file processor" + "mock_path")
|
|
51
|
+
mock_logger.info.assert_any_call('Updating mock_path to "pong"')
|
|
52
|
+
```
|
|
53
|
+
- Python methods in the project often utilize `logger` and `config` parameters, here is an example of that
|
|
54
|
+
```python
|
|
55
|
+
def test_get_config_not_found_with_logger():
|
|
56
|
+
logger = Logger(__name__)
|
|
57
|
+
config = get_config(logger=logger, config_filename="non-existing-file.yml", search_dir="/tmp")
|
|
58
|
+
assert config != None
|
|
59
|
+
```
|
|
60
|
+
5. **File Modification**:
|
|
61
|
+
- Execute changes to the File document as per the instructions,
|
|
62
|
+
ensuring
|
|
63
|
+
improvements, clarification, corrections, and optimization.
|
|
64
|
+
|
|
65
|
+
6. **Output Structuring**:
|
|
66
|
+
- Finalize the file by removing all instructional cues. - Deliver a
|
|
67
|
+
coherent and clean Python file document that is easily readable and
|
|
68
|
+
effective.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## OUTPUT INSTRUCTIONS
|
|
72
|
+
|
|
73
|
+
- The finalized document should not contain any of the instructional
|
|
74
|
+
annotations.
|
|
75
|
+
- Produce a pristine Python file content, adhering strictly to the original
|
|
76
|
+
content integrity while incorporating instructed changes.
|
|
77
|
+
- Don't return the code as a Markdown code block starting with ```python
|
|
78
|
+
and ending with ```. Only return valid Python code. Your response should be
|
|
79
|
+
valid Python code.
|
|
80
|
+
|
|
81
|
+
## INPUT
|
|
82
|
+
|
|
83
|
+
Receive a Python file featuring embedded instructions for processing.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
profile: python
|
|
3
|
+
jinja:
|
|
4
|
+
search_path: .coauthor/templates
|
|
5
|
+
custom_delimiters:
|
|
6
|
+
block_start_string: "{{%"
|
|
7
|
+
block_end_string: "%}}"
|
|
8
|
+
variable_start_string: "{{{"
|
|
9
|
+
variable_end_string: "}}}"
|
|
10
|
+
agent:
|
|
11
|
+
workflows:
|
|
12
|
+
- name: coauthor
|
|
13
|
+
watch:
|
|
14
|
+
filesystem:
|
|
15
|
+
paths:
|
|
16
|
+
- src
|
|
17
|
+
- tests
|
|
18
|
+
tasks:
|
|
19
|
+
- id: ai-file-update
|
|
20
|
+
type: process_file_with_openai_agent
|
|
21
|
+
path_patterns:
|
|
22
|
+
- .*\.py$
|
|
23
|
+
content_patterns:
|
|
24
|
+
- .*\(ai:.*?\).*
|
|
25
|
+
- ".*@ai:.*"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: pip
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: daily
|
|
7
|
+
time: "13:00"
|
|
8
|
+
open-pull-requests-limit: 10
|
|
9
|
+
reviewers:
|
|
10
|
+
- dciborow
|
|
11
|
+
allow:
|
|
12
|
+
- dependency-type: direct
|
|
13
|
+
- dependency-type: indirect
|
|
14
|
+
commit-message:
|
|
15
|
+
prefix: "fix: "
|
|
16
|
+
- package-ecosystem: "github-actions"
|
|
17
|
+
directory: "/"
|
|
18
|
+
schedule:
|
|
19
|
+
interval: daily
|
|
20
|
+
time: "13:00"
|
|
21
|
+
commit-message:
|
|
22
|
+
prefix: "fix: "
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
files:
|
|
2
|
+
- ".gitignore" # include
|
|
3
|
+
- ".github"
|
|
4
|
+
- ".vscode"
|
|
5
|
+
- "tests/conftest.py"
|
|
6
|
+
- ".flake8"
|
|
7
|
+
- ".pre-commit-config.yml"
|
|
8
|
+
- ".pypirc"
|
|
9
|
+
- "docs"
|
|
10
|
+
- "src/README.md"
|
|
11
|
+
- "CODE_OF_CONDUCT.md"
|
|
12
|
+
- "LICENSE"
|
|
13
|
+
- "README.md"
|
|
14
|
+
- "SECURITY.md"
|
|
15
|
+
- "SUPPORT.md"
|
|
16
|
+
- "pyproject.toml"
|
|
17
|
+
|
|
18
|
+
- "!.github/workflows/template-sync.yml"
|
|
19
|
+
- "!.github/template-sync.yml"
|
|
20
|
+
- "!src/python_project"
|
|
21
|
+
- "!tests/test_methods.py"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Python CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ main ]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [ main ]
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
validation:
|
|
13
|
+
uses: microsoft/action-python/.github/workflows/validation.yml@0.6.4
|
|
14
|
+
with:
|
|
15
|
+
workdir: '.'
|
|
16
|
+
|
|
17
|
+
publish:
|
|
18
|
+
uses: microsoft/action-python/.github/workflows/publish.yml@0.6.4
|
|
19
|
+
secrets:
|
|
20
|
+
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
21
|
+
TEST_PYPI_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: GitHub Actions Version Updater
|
|
2
|
+
|
|
3
|
+
# Controls when the action will run.
|
|
4
|
+
on:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
schedule:
|
|
7
|
+
# Automatically run on every Sunday
|
|
8
|
+
- cron: '0 0 * * 0'
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v3.5.2
|
|
16
|
+
with:
|
|
17
|
+
# [Required] Access token with `workflow` scope.
|
|
18
|
+
token: ${{ secrets.PAT }}
|
|
19
|
+
|
|
20
|
+
- name: Run GitHub Actions Version Updater
|
|
21
|
+
uses: saadmk11/github-actions-version-updater@v0.7.4
|
|
22
|
+
with:
|
|
23
|
+
# [Required] Access token with `workflow` scope.
|
|
24
|
+
token: ${{ secrets.PAT }}
|
|
25
|
+
pull_request_title: "ci: Update GitHub Actions to Latest Version"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: "Semantic PR Check"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- edited
|
|
8
|
+
- synchronize
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
main:
|
|
12
|
+
name: Validate PR title
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: amannn/action-semantic-pull-request@v5.2.0
|
|
16
|
+
env:
|
|
17
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Deploy Sphinx documentation to Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main] # branch to trigger deployment
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pages:
|
|
9
|
+
runs-on: ubuntu-20.04
|
|
10
|
+
environment:
|
|
11
|
+
name: github-pages
|
|
12
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
13
|
+
permissions:
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- id: deployment
|
|
18
|
+
uses: sphinx-notes/pages@v3
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
name: Template Sync
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
jobs:
|
|
5
|
+
sync:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
steps:
|
|
8
|
+
- uses: actions/checkout@v3.5.2 # important!
|
|
9
|
+
- uses: euphoricsystems/action-sync-template-repository@v2.5.1
|
|
10
|
+
with:
|
|
11
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
12
|
+
dry-run: true
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
coverage_html
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
.python-version
|
|
87
|
+
|
|
88
|
+
# pipenv
|
|
89
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
90
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
91
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
92
|
+
# install all needed dependencies.
|
|
93
|
+
#Pipfile.lock
|
|
94
|
+
|
|
95
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
96
|
+
__pypackages__/
|
|
97
|
+
|
|
98
|
+
# Celery stuff
|
|
99
|
+
celerybeat-schedule
|
|
100
|
+
celerybeat.pid
|
|
101
|
+
|
|
102
|
+
# SageMath parsed files
|
|
103
|
+
*.sage.py
|
|
104
|
+
|
|
105
|
+
# Environments
|
|
106
|
+
.env
|
|
107
|
+
.venv
|
|
108
|
+
env/
|
|
109
|
+
venv/
|
|
110
|
+
ENV/
|
|
111
|
+
env.bak/
|
|
112
|
+
venv.bak/
|
|
113
|
+
|
|
114
|
+
# Spyder project settings
|
|
115
|
+
.spyderproject
|
|
116
|
+
.spyproject
|
|
117
|
+
|
|
118
|
+
# Rope project settings
|
|
119
|
+
.ropeproject
|
|
120
|
+
|
|
121
|
+
# mkdocs documentation
|
|
122
|
+
/site
|
|
123
|
+
|
|
124
|
+
# mypy
|
|
125
|
+
.mypy_cache/
|
|
126
|
+
.dmypy.json
|
|
127
|
+
dmypy.json
|
|
128
|
+
|
|
129
|
+
# Pyre type checker
|
|
130
|
+
.pyre/
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
stages:
|
|
3
|
+
# - lint
|
|
4
|
+
- test
|
|
5
|
+
- build
|
|
6
|
+
- release
|
|
7
|
+
- deploy
|
|
8
|
+
- publish
|
|
9
|
+
|
|
10
|
+
variables:
|
|
11
|
+
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
|
12
|
+
CI_PYTHON_VERSION: "3.11"
|
|
13
|
+
|
|
14
|
+
default:
|
|
15
|
+
image: python:$CI_PYTHON_VERSION
|
|
16
|
+
|
|
17
|
+
before_script:
|
|
18
|
+
- python --version
|
|
19
|
+
- pip install --upgrade pip
|
|
20
|
+
|
|
21
|
+
# .linters:
|
|
22
|
+
# stage: lint
|
|
23
|
+
# script:
|
|
24
|
+
# - pip install . pre-commit mypy==1.13.0 -r tests/requirements.txt
|
|
25
|
+
# - mypy src/ tests/
|
|
26
|
+
|
|
27
|
+
# .lint:
|
|
28
|
+
# extends: .linters
|
|
29
|
+
# tags:
|
|
30
|
+
# - docker
|
|
31
|
+
# only:
|
|
32
|
+
# - master
|
|
33
|
+
|
|
34
|
+
.release-base:
|
|
35
|
+
# Abstract base job for "release" jobs.
|
|
36
|
+
# Extending jobs must define the following variables:
|
|
37
|
+
# - PYPI_OIDC_AUD: Audience for the ID token that GitLab
|
|
38
|
+
# issues to the pipeline job
|
|
39
|
+
# - PYPI_OIDC_URL: PyPI endpoint for retrieving a publish
|
|
40
|
+
# token with GitLab’s ID token
|
|
41
|
+
# - UV_PUBLISH_URL: PyPI endpoint for the actual upload
|
|
42
|
+
stage: deploy
|
|
43
|
+
# id_tokens:
|
|
44
|
+
# PYPI_ID_TOKEN:
|
|
45
|
+
# aud: "$PYPI_OIDC_AUD"
|
|
46
|
+
# script:
|
|
47
|
+
# # Use the GitLab ID token to retrieve an API token from PyPI
|
|
48
|
+
# - >-
|
|
49
|
+
# resp="$(curl -X POST "${PYPI_OIDC_URL}" -d "{\"token\":\"${PYPI_ID_TOKEN}\"}")"
|
|
50
|
+
# # Parse the response and extract the token
|
|
51
|
+
# - echo $resp > pypi_oidc_response.json
|
|
52
|
+
# # - >-
|
|
53
|
+
# # publish_token="$(python -c "import json; print(json.load('${resp}')['token'])")"
|
|
54
|
+
# # # Upload the files from "dist/"
|
|
55
|
+
# # - export FLIT_PASSWORD=$publish_token
|
|
56
|
+
# # - 'echo "FLIT_USERNAME: $FLIT_USERNAME, FLIT_PASSWORD: $FLIT_PASSWORD"'
|
|
57
|
+
# # - flit publish
|
|
58
|
+
# # Print the link to PyPI so we can quickly go there to verify the result:
|
|
59
|
+
# # - 'version="$(uv run --with hatch-vcs hatchling version)"'
|
|
60
|
+
# # - 'echo -e "\033[34;1mPackage on PyPI:\033[0m ${CI_ENVIRONMENT_URL}${version}/"'
|
|
61
|
+
variables:
|
|
62
|
+
FLIT_USERNAME: onknows
|
|
63
|
+
# artifacts:
|
|
64
|
+
# paths:
|
|
65
|
+
# - pypi_oidc_response.json
|
|
66
|
+
|
|
67
|
+
prepare:
|
|
68
|
+
stage: build
|
|
69
|
+
script:
|
|
70
|
+
- |
|
|
71
|
+
C2_VERSION=$(grep 'version =' pyproject.toml | awk -F '"' '{print $2}')
|
|
72
|
+
- 'echo "C2_VERSION: $C2_VERSION"'
|
|
73
|
+
- |
|
|
74
|
+
echo "C2_VERSION=$C2_VERSION" >> variables.env
|
|
75
|
+
artifacts:
|
|
76
|
+
reports:
|
|
77
|
+
dotenv: variables.env
|
|
78
|
+
|
|
79
|
+
build:
|
|
80
|
+
stage: build
|
|
81
|
+
script:
|
|
82
|
+
- python3 -m pip install flit
|
|
83
|
+
- flit build
|
|
84
|
+
artifacts:
|
|
85
|
+
paths:
|
|
86
|
+
- dist/
|
|
87
|
+
|
|
88
|
+
release-test:
|
|
89
|
+
extends: ".release-base"
|
|
90
|
+
rules:
|
|
91
|
+
# Only run if it's a pipeline for the default branch or a tag:
|
|
92
|
+
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG"
|
|
93
|
+
script:
|
|
94
|
+
- python3 -m pip install flit
|
|
95
|
+
- flit build
|
|
96
|
+
- flit publish
|
|
97
|
+
environment:
|
|
98
|
+
name: release-test
|
|
99
|
+
url: https://test.pypi.org/project/coauthor/
|
|
100
|
+
variables:
|
|
101
|
+
PYPI_OIDC_AUD: testpypi
|
|
102
|
+
PYPI_OIDC_URL: https://test.pypi.org/_/oidc/mint-token
|
|
103
|
+
FLIT_INDEX_URL: https://test.pypi.org/legacy/
|
|
104
|
+
FLIT_USERNAME: __token__
|
|
105
|
+
|
|
106
|
+
test:
|
|
107
|
+
stage: test
|
|
108
|
+
services:
|
|
109
|
+
- docker:dind
|
|
110
|
+
script:
|
|
111
|
+
- git config --global user.email "you@example.com"
|
|
112
|
+
- git config --global user.name "Your Name"
|
|
113
|
+
- pip install . -r tests/requirements.txt
|
|
114
|
+
- pytest --cov
|
|
115
|
+
coverage: '/TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+(?:\.\d+)?)\%$/'
|
|
116
|
+
# matrix:
|
|
117
|
+
# # - PYTHON_VERSION: 3.9 OS: "ubuntu"
|
|
118
|
+
# - PYTHON_VERSION: "3.10 OS: 'ubuntu'"
|
|
119
|
+
# # - PYTHON_VERSION: 3.11 OS: "ubuntu"
|
|
120
|
+
# # - PYTHON_VERSION: 3.12 OS: "ubuntu"
|
|
121
|
+
# # - PYTHON_VERSION: 3.13 OS: "ubuntu"
|
|
122
|
+
# # - PYTHON_VERSION: 3.14-dev OS: "ubuntu"
|
|
123
|
+
# parallel: 6
|
|
124
|
+
allow_failure: true
|
|
125
|
+
artifacts:
|
|
126
|
+
paths:
|
|
127
|
+
- coverage.xml
|
|
128
|
+
only:
|
|
129
|
+
- master
|
|
130
|
+
- tags
|
|
131
|
+
# coverage_report:
|
|
132
|
+
# stage: test
|
|
133
|
+
# script:
|
|
134
|
+
# - if [ "$CI_COMMIT_BRANCH" == "master" ] && [ "$PYTHON_VERSION" == "3.11" ] && [ "$OS" == "ubuntu" ]; then
|
|
135
|
+
# curl -s https://codecov.io/bash | bash;
|
|
136
|
+
# fi
|
|
137
|
+
|
|
138
|
+
# all-good:
|
|
139
|
+
# stage: deploy
|
|
140
|
+
# script:
|
|
141
|
+
# - echo "Great success!"
|
|
142
|
+
# when: on_success
|
|
143
|
+
|
|
144
|
+
# # publish:
|
|
145
|
+
# # stage: publish
|
|
146
|
+
# # # variables:
|
|
147
|
+
# # # TWINE_USERNAME: "__token__"
|
|
148
|
+
# # # TWINE_PASSWORD: "$PYPI_TOKEN"
|
|
149
|
+
# # script:
|
|
150
|
+
# # - python3 -m pip install flit
|
|
151
|
+
# # # - pip install .
|
|
152
|
+
# # - flit build
|
|
153
|
+
# # - flit publish
|
|
154
|
+
# # # only: # TODO enable
|
|
155
|
+
# # # - tags
|
|
156
|
+
|
|
157
|
+
gitlab-release:
|
|
158
|
+
stage: release
|
|
159
|
+
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
160
|
+
needs: [prepare]
|
|
161
|
+
before_script: []
|
|
162
|
+
script:
|
|
163
|
+
- echo "Create Coauthor release $C2_VERSION"
|
|
164
|
+
release:
|
|
165
|
+
name: Coauthor $C2_VERSION
|
|
166
|
+
description: "./CHANGELOG.md"
|
|
167
|
+
tag_name: $C2_VERSION
|
|
168
|
+
ref: $CI_COMMIT_SHA
|
|
169
|
+
when: manual
|
|
170
|
+
only:
|
|
171
|
+
- master
|
|
172
|
+
# assets:
|
|
173
|
+
# links:
|
|
174
|
+
# - name: coauthor
|
|
175
|
+
# url: https://galaxy.ansible.com/$C2_NAMESPACE/$C2_NAME
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_commit_msg: "chore: update pre-commit hooks"
|
|
3
|
+
autofix_commit_msg: "style: pre-commit fixes"
|
|
4
|
+
|
|
5
|
+
repos:
|
|
6
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
7
|
+
rev: v4.1.0
|
|
8
|
+
hooks:
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
- id: check-case-conflict
|
|
11
|
+
- id: check-merge-conflict
|
|
12
|
+
- id: check-symlinks
|
|
13
|
+
- id: check-yaml
|
|
14
|
+
- id: debug-statements
|
|
15
|
+
- id: end-of-file-fixer
|
|
16
|
+
- id: mixed-line-ending
|
|
17
|
+
- id: requirements-txt-fixer
|
|
18
|
+
- id: trailing-whitespace
|
|
19
|
+
|
|
20
|
+
- repo: https://github.com/PyCQA/isort
|
|
21
|
+
rev: 5.12.0
|
|
22
|
+
hooks:
|
|
23
|
+
- id: isort
|
|
24
|
+
args: ["-a", "from __future__ import annotations"]
|
|
25
|
+
|
|
26
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
27
|
+
rev: v2.31.0
|
|
28
|
+
hooks:
|
|
29
|
+
- id: pyupgrade
|
|
30
|
+
args: [--py37-plus]
|
|
31
|
+
|
|
32
|
+
- repo: https://github.com/hadialqattan/pycln
|
|
33
|
+
rev: v1.2.5
|
|
34
|
+
hooks:
|
|
35
|
+
- id: pycln
|
|
36
|
+
args: [--config=pyproject.toml]
|
|
37
|
+
stages: [manual]
|
|
38
|
+
|
|
39
|
+
- repo: https://github.com/codespell-project/codespell
|
|
40
|
+
rev: v2.1.0
|
|
41
|
+
hooks:
|
|
42
|
+
- id: codespell
|
|
43
|
+
|
|
44
|
+
- repo: https://github.com/pre-commit/pygrep-hooks
|
|
45
|
+
rev: v1.9.0
|
|
46
|
+
hooks:
|
|
47
|
+
- id: python-check-blanket-noqa
|
|
48
|
+
- id: python-check-blanket-type-ignore
|
|
49
|
+
- id: python-no-log-warn
|
|
50
|
+
- id: python-no-eval
|
|
51
|
+
- id: python-use-type-annotations
|
|
52
|
+
- id: rst-backticks
|
|
53
|
+
- id: rst-directive-colons
|
|
54
|
+
- id: rst-inline-touching-normal
|
|
55
|
+
|
|
56
|
+
- repo: https://github.com/mgedmin/check-manifest
|
|
57
|
+
rev: "0.47"
|
|
58
|
+
hooks:
|
|
59
|
+
- id: check-manifest
|
|
60
|
+
stages: [manual]
|
coauthor-0.0.5/.pypirc
ADDED