docstring-to-text 0.0.1__tar.gz → 0.0.2__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.
- docstring_to_text-0.0.2/.github/workflows/publish-release-to-pypi.yml +262 -0
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/PKG-INFO +2 -2
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/_build.bat +24 -23
- docstring_to_text-0.0.2/_upload-release.bat +24 -0
- docstring_to_text-0.0.2/_upload-test.bat +24 -0
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/pyproject.toml +3 -1
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/src/docstring_to_text/__package_meta.py +1 -1
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/.gitattributes +0 -0
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/.gitignore +0 -0
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/LICENSE.md +0 -0
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/README.md +0 -0
- {docstring_to_text-0.0.1 → docstring_to_text-0.0.2}/src/docstring_to_text/__init__.py +0 -0
@@ -0,0 +1,262 @@
|
|
1
|
+
# Prerequisites:
|
2
|
+
#
|
3
|
+
# - In GitHub repo - create the publishing environment (here, `pypi` / `testpypi`)
|
4
|
+
# https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments
|
5
|
+
#
|
6
|
+
# - Create a "Trusted Publisher" in the project settings on (test)PyPI
|
7
|
+
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
|
8
|
+
# https://pypi.org/manage/project/docstring-to-text/settings/publishing/
|
9
|
+
|
10
|
+
# Tutorials:
|
11
|
+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
|
12
|
+
# https://www.youtube.com/watch?v=NMQwzI9hprg
|
13
|
+
# https://github.com/ArjanCodes/moneysnake/blob/main/.github/workflows/release.yaml
|
14
|
+
|
15
|
+
name: Publish Python 🐍 distribution 📦 to PyPI
|
16
|
+
|
17
|
+
# ======= TRIGGERS =======
|
18
|
+
|
19
|
+
#on:
|
20
|
+
# push:
|
21
|
+
# tags:
|
22
|
+
# # Trigger on tags with '[v]<int>.<int>whatever' pattern: 'v1.0.0', 'v2.1.4', etc
|
23
|
+
# # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#filter-pattern-cheat-sheet
|
24
|
+
# # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onpushbranchestagsbranches-ignoretags-ignore
|
25
|
+
# - 'v[0-9]+.[0-9]**'
|
26
|
+
# - '[0-9]+.[0-9]**'
|
27
|
+
|
28
|
+
on:
|
29
|
+
workflow_dispatch:
|
30
|
+
push:
|
31
|
+
branches:
|
32
|
+
- main
|
33
|
+
paths:
|
34
|
+
- "src/docstring_to_text/__package_meta.py"
|
35
|
+
|
36
|
+
# ======= ENV VARS =======
|
37
|
+
|
38
|
+
env:
|
39
|
+
# The name on PyPI:
|
40
|
+
PACKAGE_NAME: 'docstring-to-text'
|
41
|
+
VERSION_MODULE: 'src.docstring_to_text.__package_meta'
|
42
|
+
VERSION_VARIABLE: 'VERSION'
|
43
|
+
|
44
|
+
|
45
|
+
# ========= JOBS =========
|
46
|
+
|
47
|
+
jobs:
|
48
|
+
|
49
|
+
detect-version:
|
50
|
+
# https://emojidb.org/query-emojis
|
51
|
+
name: Parse version 🔢 + add Tag 🏷️
|
52
|
+
if: ${{ github.repository_owner == 'Lex-DRL' }}
|
53
|
+
runs-on: ubuntu-latest
|
54
|
+
permissions:
|
55
|
+
contents: write # Needed for tag creation
|
56
|
+
outputs:
|
57
|
+
tag_name: ${{ steps.parse.outputs.tag_name }}
|
58
|
+
version_full: ${{ steps.parse.outputs.version_full }}
|
59
|
+
version_num: ${{ steps.parse.outputs.version_num }}
|
60
|
+
suffix: ${{ steps.parse.outputs.suffix }}
|
61
|
+
steps:
|
62
|
+
- name: Checkout Code
|
63
|
+
uses: actions/checkout@v4
|
64
|
+
with:
|
65
|
+
fetch-depth: 0 # Fetch full history to avoid issues with tags and branches
|
66
|
+
|
67
|
+
- name: Extract version from package meta 📝
|
68
|
+
id: get_version_string
|
69
|
+
run: |
|
70
|
+
# VERSION=$(grep -oP 'VERSION\s*=\s*["'\'']\K[^"'\'']+' src/docstring_to_text/__package_meta.py)
|
71
|
+
VERSION=$(python -c "from ${{ env.VERSION_MODULE }} import ${{ env.VERSION_VARIABLE }}; print(${{ env.VERSION_VARIABLE }})")
|
72
|
+
echo "Version string: $VERSION"
|
73
|
+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
74
|
+
|
75
|
+
- name: Parse Version 🧱
|
76
|
+
id: parse
|
77
|
+
# The main magic happens in regexps...
|
78
|
+
# - `grep -qP`: verify that the tag matches the given pattern
|
79
|
+
# - `sed -E 's/regex_pattern/replacement/optional_flags'`, with '\1' in replacement meaning first group
|
80
|
+
# The regexp itself:
|
81
|
+
# - '^v?([0-9]+\.[0-9]+\.[0-9]+)' - matches 'v1.2.3' / '1.2.3' from start of the string, 'v' stripped
|
82
|
+
# - '^' - start of the input string.
|
83
|
+
# - 'v?(...)' - optional 'v' prefix (might be missing), and what follows is captured as a group.
|
84
|
+
# - '[0-9]+' - a sequence of 1 or more digits.
|
85
|
+
# - '\.' - literal dot (just '.' matches any character).
|
86
|
+
# - '(-.+)?$' - suffix captured as a group:
|
87
|
+
# - '-' - just a hyphen.
|
88
|
+
# - '.+' - any non-empty string (at least one any character - including another hyphen, dot or digit).
|
89
|
+
# - '(...)?$' - a group that might be present or not.
|
90
|
+
# - '$' - the end of the input string.
|
91
|
+
run: |
|
92
|
+
VERSION_STR="${{ steps.get_version_string.outputs.version }}"
|
93
|
+
echo "Version string: $VERSION_STR"
|
94
|
+
if echo "$VERSION_STR" | grep -qP '^v?[0-9]+\.[0-9]+\.[0-9]+(-.+)?$'; then
|
95
|
+
VERSION_NUMBER=$(echo "$VERSION_STR" | sed -E 's/^v?([0-9]+\.[0-9]+\.[0-9]+)(-.+)?$/\1/')
|
96
|
+
echo "Version number: $VERSION_NUMBER"
|
97
|
+
if echo "$VERSION_STR" | grep -q '-'; then
|
98
|
+
# We can only get into this branch if the initial grep regex worked AND '-' is there
|
99
|
+
# So it's '[v]1.2.3-something'
|
100
|
+
SUFFIX=$(echo "$VERSION_STR" | sed -E 's/^v?([0-9]+\.[0-9]+\.[0-9]+)-(.+)$/\2/')
|
101
|
+
if echo "$SUFFIX" | grep -q '-'; then
|
102
|
+
echo "Invalid suffix (it contains hyphen): $SUFFIX" >&2
|
103
|
+
exit 1
|
104
|
+
fi
|
105
|
+
SUFFIX_WITH_SEP=$(echo "-$SUFFIX")
|
106
|
+
else
|
107
|
+
SUFFIX=""
|
108
|
+
SUFFIX_WITH_SEP=""
|
109
|
+
fi
|
110
|
+
echo "Suffix: $SUFFIX"
|
111
|
+
else
|
112
|
+
echo "Version string doesn't match the '[v]1.2.3[-suffix]' pattern: $VERSION_STR" >&2
|
113
|
+
exit 1
|
114
|
+
fi
|
115
|
+
VERSION_FULL=$(echo "${VERSION_NUMBER}${SUFFIX_WITH_SEP}")
|
116
|
+
echo "Full parsed Version: $VERSION_FULL"
|
117
|
+
TAG_NAME=$(echo "v${VERSION_FULL}")
|
118
|
+
echo "Tag name: $TAG_NAME"
|
119
|
+
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
120
|
+
echo "version_full=$VERSION_FULL" >> "$GITHUB_OUTPUT"
|
121
|
+
echo "version_num=$VERSION_NUMBER" >> "$GITHUB_OUTPUT"
|
122
|
+
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
|
123
|
+
|
124
|
+
- name: Create tag 🏷️ from version
|
125
|
+
uses: actions/github-script@v7
|
126
|
+
with:
|
127
|
+
script: |
|
128
|
+
github.rest.git.createRef({
|
129
|
+
owner: context.repo.owner,
|
130
|
+
repo: context.repo.repo,
|
131
|
+
ref: `refs/tags/${process.env.TAG}`,
|
132
|
+
sha: context.sha
|
133
|
+
})
|
134
|
+
env:
|
135
|
+
TAG: ${{ steps.parse.outputs.tag_name }}
|
136
|
+
|
137
|
+
# --------------------------------------------------------
|
138
|
+
|
139
|
+
build:
|
140
|
+
name: Build distribution 📦
|
141
|
+
needs: [detect-version] # No need to even try, if we failed tag parsing
|
142
|
+
# Just to be nice - let's check the GitHub user and prevent unwanted auto-runs on forks made solely for a PR.
|
143
|
+
if: >-
|
144
|
+
github.repository_owner == 'Lex-DRL'
|
145
|
+
# Second condition: only run on tag pushes...
|
146
|
+
# It was in the template from official tutorial, but it got redundant, since the only trigger is `on.push.tags`
|
147
|
+
# && startsWith(github.ref, 'refs/tags/v')
|
148
|
+
runs-on: ubuntu-latest
|
149
|
+
|
150
|
+
steps:
|
151
|
+
- name: Checkout Code
|
152
|
+
uses: actions/checkout@v4
|
153
|
+
with:
|
154
|
+
persist-credentials: false
|
155
|
+
|
156
|
+
- name: Set up Python
|
157
|
+
uses: actions/setup-python@v5
|
158
|
+
with:
|
159
|
+
python-version: "3.x"
|
160
|
+
|
161
|
+
- name: Install pypa/build
|
162
|
+
run: >-
|
163
|
+
python3 -m
|
164
|
+
pip install
|
165
|
+
build
|
166
|
+
--user
|
167
|
+
|
168
|
+
- name: Build a binary wheel and a source tarball
|
169
|
+
run: python3 -m build
|
170
|
+
|
171
|
+
- name: Store the distribution packages
|
172
|
+
uses: actions/upload-artifact@v4
|
173
|
+
with:
|
174
|
+
name: python-package-distributions
|
175
|
+
path: dist/
|
176
|
+
|
177
|
+
# --------------------------------------------------------
|
178
|
+
|
179
|
+
publish-to-pypi:
|
180
|
+
name: >-
|
181
|
+
Publish Python 🐍 distribution 📦 to PyPI ⬆️
|
182
|
+
if: ${{ github.repository_owner == 'Lex-DRL' }}
|
183
|
+
needs:
|
184
|
+
- build # Requires the previous 'build' job to succeed
|
185
|
+
runs-on: ubuntu-latest
|
186
|
+
|
187
|
+
environment:
|
188
|
+
name: pypi
|
189
|
+
url: https://pypi.org/p/${{ env.PACKAGE_NAME }}
|
190
|
+
permissions:
|
191
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
192
|
+
|
193
|
+
steps:
|
194
|
+
- name: Download all the dists
|
195
|
+
uses: actions/download-artifact@v4
|
196
|
+
with:
|
197
|
+
name: python-package-distributions
|
198
|
+
path: dist/
|
199
|
+
|
200
|
+
- name: Publish distribution 📦 to PyPI
|
201
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
202
|
+
|
203
|
+
# --------------------------------------------------------
|
204
|
+
|
205
|
+
# publish-to-testpypi:
|
206
|
+
# name: Publish Python 🐍 distribution 📦 to TestPyPI ❗
|
207
|
+
# if: ${{ github.repository_owner == 'Lex-DRL' }}
|
208
|
+
# needs:
|
209
|
+
# - build # Requires the previous 'build' job to succeed
|
210
|
+
# runs-on: ubuntu-latest
|
211
|
+
#
|
212
|
+
# environment:
|
213
|
+
# #name: testpypi
|
214
|
+
# # Yes, it's "not cool" to use the same environment for testing and publishing,
|
215
|
+
# # but in this particular repo I only use the TestPyPI for initial debugging of the workflow
|
216
|
+
# name: pypi
|
217
|
+
# url: https://test.pypi.org/p/${{ env.PACKAGE_NAME }}
|
218
|
+
# permissions:
|
219
|
+
# id-token: write # IMPORTANT: mandatory for trusted publishing
|
220
|
+
#
|
221
|
+
# steps:
|
222
|
+
# - name: Download all the dists
|
223
|
+
# uses: actions/download-artifact@v4
|
224
|
+
# with:
|
225
|
+
# name: python-package-distributions
|
226
|
+
# path: dist/
|
227
|
+
#
|
228
|
+
# - name: Publish distribution 📦 to TestPyPI
|
229
|
+
# uses: pypa/gh-action-pypi-publish@release/v1
|
230
|
+
# with:
|
231
|
+
# repository-url: https://test.pypi.org/legacy/
|
232
|
+
|
233
|
+
# --------------------------------------------------------
|
234
|
+
|
235
|
+
github_release:
|
236
|
+
name: Create GitHub Release 🔄
|
237
|
+
needs: [build, detect-version]
|
238
|
+
runs-on: ubuntu-latest
|
239
|
+
permissions:
|
240
|
+
contents: write
|
241
|
+
steps:
|
242
|
+
- name: Checkout Code
|
243
|
+
uses: actions/checkout@v4
|
244
|
+
with:
|
245
|
+
fetch-depth: 0 # Fetch full history to avoid issues with tags and branches
|
246
|
+
|
247
|
+
- name: Download artifacts
|
248
|
+
uses: actions/download-artifact@v4
|
249
|
+
with:
|
250
|
+
name: python-package-distributions
|
251
|
+
path: dist/
|
252
|
+
|
253
|
+
- name: Create GitHub Release
|
254
|
+
id: create_release
|
255
|
+
env:
|
256
|
+
GH_TOKEN: ${{ github.token }}
|
257
|
+
run: >-
|
258
|
+
gh release create
|
259
|
+
${{ needs.detect-version.outputs.tag_name }}
|
260
|
+
dist/*
|
261
|
+
--title ${{ needs.detect-version.outputs.tag_name }}
|
262
|
+
--generate-notes
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: docstring-to-text
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.2
|
4
4
|
Summary: A simple pip package converting docstrings into clean text (proper paragraphs and indents)
|
5
|
-
Project-URL:
|
5
|
+
Project-URL: Source Code, https://github.com/Lex-DRL/Py-docstring-to-text
|
6
6
|
Project-URL: Issues, https://github.com/Lex-DRL/Py-docstring-to-text/issues
|
7
7
|
Author: Lex Darlog (Lex-DRL)
|
8
8
|
License-Expression: MPL-2.0
|
@@ -1,23 +1,24 @@
|
|
1
|
-
@echo off
|
2
|
-
|
3
|
-
call .\venv\Scripts\activate.bat
|
4
|
-
|
5
|
-
echo Where python:
|
6
|
-
echo.
|
7
|
-
where python
|
8
|
-
echo.
|
9
|
-
echo
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
.\venv\Scripts\python.exe -m pip install -U
|
15
|
-
|
16
|
-
|
17
|
-
echo.
|
18
|
-
echo
|
19
|
-
echo
|
20
|
-
echo.
|
21
|
-
|
22
|
-
|
23
|
-
|
1
|
+
@echo off
|
2
|
+
|
3
|
+
call .\venv\Scripts\activate.bat
|
4
|
+
|
5
|
+
echo Where python:
|
6
|
+
echo.
|
7
|
+
where python
|
8
|
+
echo.
|
9
|
+
echo BUILD?
|
10
|
+
echo.
|
11
|
+
|
12
|
+
pause
|
13
|
+
|
14
|
+
.\venv\Scripts\python.exe -m pip install -U pip
|
15
|
+
.\venv\Scripts\python.exe -m pip install -U build
|
16
|
+
|
17
|
+
echo.
|
18
|
+
echo.
|
19
|
+
echo ============================================================
|
20
|
+
echo.
|
21
|
+
echo.
|
22
|
+
|
23
|
+
.\venv\Scripts\python.exe -m build
|
24
|
+
pause
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@echo off
|
2
|
+
|
3
|
+
call .\venv\Scripts\activate.bat
|
4
|
+
|
5
|
+
echo Where python:
|
6
|
+
echo.
|
7
|
+
where python
|
8
|
+
echo.
|
9
|
+
echo RELEASE?
|
10
|
+
echo.
|
11
|
+
|
12
|
+
pause
|
13
|
+
|
14
|
+
.\venv\Scripts\python.exe -m pip install -U pip
|
15
|
+
.\venv\Scripts\python.exe -m pip install -U twine
|
16
|
+
|
17
|
+
echo.
|
18
|
+
echo.
|
19
|
+
echo ============================================================
|
20
|
+
echo.
|
21
|
+
echo.
|
22
|
+
|
23
|
+
.\venv\Scripts\python.exe -m twine upload dist/*
|
24
|
+
pause
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@echo off
|
2
|
+
|
3
|
+
call .\venv\Scripts\activate.bat
|
4
|
+
|
5
|
+
echo Where python:
|
6
|
+
echo.
|
7
|
+
where python
|
8
|
+
echo.
|
9
|
+
echo Upload to TEST PyPI?
|
10
|
+
echo.
|
11
|
+
|
12
|
+
pause
|
13
|
+
|
14
|
+
.\venv\Scripts\python.exe -m pip install -U pip
|
15
|
+
.\venv\Scripts\python.exe -m pip install -U twine
|
16
|
+
|
17
|
+
echo.
|
18
|
+
echo.
|
19
|
+
echo ============================================================
|
20
|
+
echo.
|
21
|
+
echo.
|
22
|
+
|
23
|
+
.\venv\Scripts\python.exe -m twine upload --repository testpypi dist/*
|
24
|
+
pause
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# https://packaging.python.org/en/latest/tutorials/packaging-projects/
|
2
|
+
|
1
3
|
[build-system]
|
2
4
|
requires = ["hatchling >= 1.26"]
|
3
5
|
build-backend = "hatchling.build"
|
@@ -23,7 +25,7 @@ classifiers = [
|
|
23
25
|
]
|
24
26
|
|
25
27
|
[project.urls]
|
26
|
-
|
28
|
+
"Source Code" = "https://github.com/Lex-DRL/Py-docstring-to-text"
|
27
29
|
Issues = "https://github.com/Lex-DRL/Py-docstring-to-text/issues"
|
28
30
|
|
29
31
|
[tool.hatch.version]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|