gitlab-activity 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.
- gitlab_activity-0.1.0/.gitignore +112 -0
- gitlab_activity-0.1.0/.gitlab-ci.yml +267 -0
- gitlab_activity-0.1.0/.pre-commit-config.yaml +62 -0
- gitlab_activity-0.1.0/CHANGELOG.md +56 -0
- gitlab_activity-0.1.0/CONTRIBUTING.md +159 -0
- gitlab_activity-0.1.0/LICENSE +28 -0
- gitlab_activity-0.1.0/PKG-INFO +167 -0
- gitlab_activity-0.1.0/README.md +97 -0
- gitlab_activity-0.1.0/codecov.yaml +45 -0
- gitlab_activity-0.1.0/docs/scripts/include_md.py +37 -0
- gitlab_activity-0.1.0/docs/sphinx/Makefile +252 -0
- gitlab_activity-0.1.0/docs/sphinx/README.md +12 -0
- gitlab_activity-0.1.0/docs/sphinx/source/cache.rst +8 -0
- gitlab_activity-0.1.0/docs/sphinx/source/cli.rst +8 -0
- gitlab_activity-0.1.0/docs/sphinx/source/conf.py +241 -0
- gitlab_activity-0.1.0/docs/sphinx/source/git.rst +8 -0
- gitlab_activity-0.1.0/docs/sphinx/source/graphql.rst +8 -0
- gitlab_activity-0.1.0/docs/sphinx/source/index.rst +25 -0
- gitlab_activity-0.1.0/docs/sphinx/source/lib.rst +8 -0
- gitlab_activity-0.1.0/docs/sphinx/source/utils.rst +8 -0
- gitlab_activity-0.1.0/docs/website/.gitignore +27 -0
- gitlab_activity-0.1.0/docs/website/.prettierignore +3 -0
- gitlab_activity-0.1.0/docs/website/README.md +28 -0
- gitlab_activity-0.1.0/docs/website/blog/2023-10-31-welcome.md +8 -0
- gitlab_activity-0.1.0/docs/website/blog/authors.yml +4 -0
- gitlab_activity-0.1.0/docs/website/docs/00-introduction.md +96 -0
- gitlab_activity-0.1.0/docs/website/docs/01-configuration.md +110 -0
- gitlab_activity-0.1.0/docs/website/docs/02-usage.md +144 -0
- gitlab_activity-0.1.0/docs/website/docs/03-contributing.md +166 -0
- gitlab_activity-0.1.0/docs/website/docs/04-changelog.md +6 -0
- gitlab_activity-0.1.0/docs/website/docusaurus.config.js +142 -0
- gitlab_activity-0.1.0/docs/website/package-lock.json +24258 -0
- gitlab_activity-0.1.0/docs/website/package.json +76 -0
- gitlab_activity-0.1.0/docs/website/sidebars.js +21 -0
- gitlab_activity-0.1.0/docs/website/src/components/HomepageFeatures/index.js +64 -0
- gitlab_activity-0.1.0/docs/website/src/components/HomepageFeatures/styles.module.css +11 -0
- gitlab_activity-0.1.0/docs/website/src/css/custom.css +30 -0
- gitlab_activity-0.1.0/docs/website/static/.nojekyll +0 -0
- gitlab_activity-0.1.0/docs/website/static/img/.nojekyll +0 -0
- gitlab_activity-0.1.0/docs/website/static/img/favicon.ico +0 -0
- gitlab_activity-0.1.0/docs/website/static/img/logo.svg +1 -0
- gitlab_activity-0.1.0/example-configs/.gitlab-activity.toml +184 -0
- gitlab_activity-0.1.0/example-configs/README.md +115 -0
- gitlab_activity-0.1.0/example-configs/package.json +100 -0
- gitlab_activity-0.1.0/example-configs/pyproject.toml +181 -0
- gitlab_activity-0.1.0/gitlab_activity/__init__.py +61 -0
- gitlab_activity-0.1.0/gitlab_activity/_version.py +3 -0
- gitlab_activity-0.1.0/gitlab_activity/cache.py +161 -0
- gitlab_activity-0.1.0/gitlab_activity/cli.py +394 -0
- gitlab_activity-0.1.0/gitlab_activity/git.py +49 -0
- gitlab_activity-0.1.0/gitlab_activity/graphql.py +381 -0
- gitlab_activity-0.1.0/gitlab_activity/lib.py +756 -0
- gitlab_activity-0.1.0/gitlab_activity/schema.json +113 -0
- gitlab_activity-0.1.0/gitlab_activity/utils.py +582 -0
- gitlab_activity-0.1.0/pyproject.toml +286 -0
- gitlab_activity-0.1.0/tests/__init__.py +0 -0
- gitlab_activity-0.1.0/tests/conftest.py +38 -0
- gitlab_activity-0.1.0/tests/resources/config/.gitlab-activity-no-issues.toml +21 -0
- gitlab_activity-0.1.0/tests/resources/config/.gitlab-activity-no-mrs.toml +21 -0
- gitlab_activity-0.1.0/tests/resources/config/.gitlab-activity.toml +30 -0
- gitlab_activity-0.1.0/tests/resources/config/package.json +14 -0
- gitlab_activity-0.1.0/tests/resources/config/pyproject.toml +12 -0
- gitlab_activity-0.1.0/tests/resources/data/issues.csv +7 -0
- gitlab_activity-0.1.0/tests/resources/data/merge_requests.csv +11 -0
- gitlab_activity-0.1.0/tests/resources/data/repo_data.pkl +0 -0
- gitlab_activity-0.1.0/tests/test_cache.py +106 -0
- gitlab_activity-0.1.0/tests/test_cli/cli_all_time_activity.md +51 -0
- gitlab_activity-0.1.0/tests/test_cli/cli_no_target.md +16 -0
- gitlab_activity-0.1.0/tests/test_cli/cli_since_last_tag.md +10 -0
- gitlab_activity-0.1.0/tests/test_cli/cli_timed_activity.md +29 -0
- gitlab_activity-0.1.0/tests/test_cli/cli_timed_group_activity.md +34 -0
- gitlab_activity-0.1.0/tests/test_cli/cli_timed_ns_activity.md +53 -0
- gitlab_activity-0.1.0/tests/test_cli/test_cli_include_contributors.md +3 -0
- gitlab_activity-0.1.0/tests/test_cli/test_cli_include_issues.md +24 -0
- gitlab_activity-0.1.0/tests/test_cli/test_cli_include_open.md +5 -0
- gitlab_activity-0.1.0/tests/test_cli/test_cli_local_all_activity.md +51 -0
- gitlab_activity-0.1.0/tests/test_cli/test_cli_local_all_time_activity.md +51 -0
- gitlab_activity-0.1.0/tests/test_cli/test_cli_local_latest_activity.md +10 -0
- gitlab_activity-0.1.0/tests/test_cli.py +369 -0
- gitlab_activity-0.1.0/tests/test_git.py +22 -0
- gitlab_activity-0.1.0/tests/test_utils.py +97 -0
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage*.xml
|
|
46
|
+
*.cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
.pytest_cache/
|
|
49
|
+
.ruff_cache/
|
|
50
|
+
|
|
51
|
+
# Translations
|
|
52
|
+
*.mo
|
|
53
|
+
*.pot
|
|
54
|
+
|
|
55
|
+
# Django stuff:
|
|
56
|
+
*.log
|
|
57
|
+
local_settings.py
|
|
58
|
+
db.sqlite3
|
|
59
|
+
|
|
60
|
+
# Flask stuff:
|
|
61
|
+
instance/
|
|
62
|
+
.webassets-cache
|
|
63
|
+
|
|
64
|
+
# Scrapy stuff:
|
|
65
|
+
.scrapy
|
|
66
|
+
|
|
67
|
+
# Sphinx documentation
|
|
68
|
+
docs/_build/
|
|
69
|
+
|
|
70
|
+
# PyBuilder
|
|
71
|
+
target/
|
|
72
|
+
|
|
73
|
+
# Jupyter Notebook
|
|
74
|
+
.ipynb_checkpoints
|
|
75
|
+
|
|
76
|
+
# pyenv
|
|
77
|
+
.python-version
|
|
78
|
+
|
|
79
|
+
# celery beat schedule file
|
|
80
|
+
celerybeat-schedule
|
|
81
|
+
|
|
82
|
+
# SageMath parsed files
|
|
83
|
+
*.sage.py
|
|
84
|
+
|
|
85
|
+
# Environments
|
|
86
|
+
.env
|
|
87
|
+
.venv
|
|
88
|
+
env/
|
|
89
|
+
venv/
|
|
90
|
+
ENV/
|
|
91
|
+
env.bak/
|
|
92
|
+
venv.bak/
|
|
93
|
+
|
|
94
|
+
# Spyder project settings
|
|
95
|
+
.spyderproject
|
|
96
|
+
.spyproject
|
|
97
|
+
|
|
98
|
+
# Rope project settings
|
|
99
|
+
.ropeproject
|
|
100
|
+
|
|
101
|
+
# mkdocs documentation
|
|
102
|
+
/site
|
|
103
|
+
|
|
104
|
+
# mypy
|
|
105
|
+
.mypy_cache/
|
|
106
|
+
|
|
107
|
+
# Docs tmp files
|
|
108
|
+
docs/tags_list.txt
|
|
109
|
+
|
|
110
|
+
# All node and npm related stuff
|
|
111
|
+
**/node_modules
|
|
112
|
+
**/.yarn
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
image: python:3.12-bullseye
|
|
2
|
+
|
|
3
|
+
stages:
|
|
4
|
+
- pretest
|
|
5
|
+
- build
|
|
6
|
+
- test
|
|
7
|
+
- pre-release
|
|
8
|
+
- deploy
|
|
9
|
+
- release
|
|
10
|
+
|
|
11
|
+
# Global variables for release jobs
|
|
12
|
+
variables:
|
|
13
|
+
VERSION: minor
|
|
14
|
+
BRANCH: main
|
|
15
|
+
|
|
16
|
+
# Create an anchor to setup node
|
|
17
|
+
.setup_node:
|
|
18
|
+
before_script:
|
|
19
|
+
- pip install -U pip
|
|
20
|
+
# Install nodejs
|
|
21
|
+
- wget https://nodejs.org/dist/v18.12.1/node-v18.12.1-linux-x64.tar.xz
|
|
22
|
+
- tar -xvf node-v18.12.1-linux-x64.tar.xz
|
|
23
|
+
- mv node-v18.12.1-linux-x64 /root/nodejs
|
|
24
|
+
- rm -rf node-v18.12.1-linux-x64.tar.xz
|
|
25
|
+
- export PATH=/root/nodejs/bin:$PATH
|
|
26
|
+
- npm --version
|
|
27
|
+
|
|
28
|
+
# Anchor for setting up prepare_release job
|
|
29
|
+
.setup_prepare_release:
|
|
30
|
+
before_script:
|
|
31
|
+
- echo "Preparing release..."
|
|
32
|
+
# Install hatch and install package
|
|
33
|
+
- pip install git+https://github.com/pypa/hatch
|
|
34
|
+
- pip install -e '.[dev]'
|
|
35
|
+
|
|
36
|
+
# Anchor with reference for prepare_release job.
|
|
37
|
+
# We will test it in CI as well without actually pushing
|
|
38
|
+
# the commits. So we reference the anchor to avoid duplication
|
|
39
|
+
.prepare_release: &prepare_release
|
|
40
|
+
# Check out correct branch
|
|
41
|
+
# By default a shallow clone is made in CI. So first fetch from origin
|
|
42
|
+
# and then checkout if branch is other than main
|
|
43
|
+
- |
|
|
44
|
+
if [[ ${BRANCH} != "main" ]]; then
|
|
45
|
+
git fetch origin ${BRANCH}
|
|
46
|
+
git checkout ${BRANCH}
|
|
47
|
+
fi
|
|
48
|
+
# Bump version
|
|
49
|
+
- hatch version ${VERSION}
|
|
50
|
+
# Get new version
|
|
51
|
+
- export NEXT_VERSION_SPECIFIER=$(hatch version)
|
|
52
|
+
# Generate changelog
|
|
53
|
+
- gitlab-activity --append -o CHANGELOG.md
|
|
54
|
+
- cat CHANGELOG.md
|
|
55
|
+
- git add CHANGELOG.md gitlab_activity/_version.py
|
|
56
|
+
# Run pre-commit to auto format files
|
|
57
|
+
- pre-commit install
|
|
58
|
+
- pre-commit run --all-files || true
|
|
59
|
+
# Configure mail and name of the user who should be visible in the commit history
|
|
60
|
+
- git config --global user.email 'release-bot@gitlab.com'
|
|
61
|
+
- git config --global user.name 'Release Bot'
|
|
62
|
+
# Dont run pre-commit here
|
|
63
|
+
- git commit -m "Bump version to ${NEXT_VERSION_SPECIFIER} & update CHANGELOG.md" --no-verify
|
|
64
|
+
# Create new tag
|
|
65
|
+
- git tag ${NEXT_VERSION_SPECIFIER} -m "Release ${NEXT_VERSION_SPECIFIER}"
|
|
66
|
+
|
|
67
|
+
# Pre commit tests
|
|
68
|
+
pre-commit:
|
|
69
|
+
stage: pretest
|
|
70
|
+
script:
|
|
71
|
+
- mkdir -p build/reports
|
|
72
|
+
- pip install pre-commit
|
|
73
|
+
- pre-commit install
|
|
74
|
+
- pre-commit run --all-files --show-diff-on-failure
|
|
75
|
+
artifacts:
|
|
76
|
+
paths:
|
|
77
|
+
- build/reports/
|
|
78
|
+
expire_in: 1 day
|
|
79
|
+
except:
|
|
80
|
+
- tags
|
|
81
|
+
|
|
82
|
+
# Test to build package
|
|
83
|
+
build-test:
|
|
84
|
+
stage: build
|
|
85
|
+
script:
|
|
86
|
+
- pip install .
|
|
87
|
+
artifacts:
|
|
88
|
+
paths:
|
|
89
|
+
- build/reports/
|
|
90
|
+
expire_in: 1 day
|
|
91
|
+
except:
|
|
92
|
+
- tags
|
|
93
|
+
|
|
94
|
+
# Test to build docs
|
|
95
|
+
build-doc:
|
|
96
|
+
stage: build
|
|
97
|
+
extends: .setup_node
|
|
98
|
+
script:
|
|
99
|
+
- pip install git+https://github.com/pypa/hatch
|
|
100
|
+
- hatch run docs:build
|
|
101
|
+
artifacts:
|
|
102
|
+
paths:
|
|
103
|
+
- build/reports/
|
|
104
|
+
expire_in: 1 day
|
|
105
|
+
except:
|
|
106
|
+
- tags
|
|
107
|
+
|
|
108
|
+
# Unit and functional tests
|
|
109
|
+
tests:
|
|
110
|
+
stage: test
|
|
111
|
+
parallel:
|
|
112
|
+
matrix:
|
|
113
|
+
- PYVER: ["3.8", "3.9", "3.10", "3.11"]
|
|
114
|
+
script:
|
|
115
|
+
# Install hatch first. Install it from Git until
|
|
116
|
+
# a release with [PR#1002](https://github.com/pypa/hatch/pull/1002)
|
|
117
|
+
# is made
|
|
118
|
+
- pip install git+https://github.com/pypa/hatch
|
|
119
|
+
# Checks the current python version
|
|
120
|
+
- hatch run +py=$PYVER test:check
|
|
121
|
+
# Runs tests
|
|
122
|
+
- hatch run +py=$PYVER test:test
|
|
123
|
+
# Codecov specific stuff
|
|
124
|
+
- curl -Os https://uploader.codecov.io/latest/linux/codecov
|
|
125
|
+
- chmod +x codecov
|
|
126
|
+
# Seems like we need to add HTTP Proxy explicitly
|
|
127
|
+
# Add coverage report only for one version
|
|
128
|
+
- ./codecov -t $CODECOV_TOKEN -U $HTTPS_PROXY -f coverage.xml -F py$PYVER
|
|
129
|
+
after_script:
|
|
130
|
+
- cp coverage.xml build/reports/
|
|
131
|
+
coverage: '/TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)%/'
|
|
132
|
+
artifacts:
|
|
133
|
+
paths:
|
|
134
|
+
- build/reports/
|
|
135
|
+
expire_in: 1 day
|
|
136
|
+
except:
|
|
137
|
+
- tags
|
|
138
|
+
|
|
139
|
+
# Test to check release steps
|
|
140
|
+
test-release:
|
|
141
|
+
stage: pre-release
|
|
142
|
+
extends: .setup_prepare_release
|
|
143
|
+
# We do clone for this test as cached repos might have existing
|
|
144
|
+
# tags that can fail the job.
|
|
145
|
+
variables:
|
|
146
|
+
GIT_STRATEGY: clone
|
|
147
|
+
script:
|
|
148
|
+
- *prepare_release
|
|
149
|
+
artifacts:
|
|
150
|
+
paths:
|
|
151
|
+
- build/reports/
|
|
152
|
+
expire_in: 1 day
|
|
153
|
+
except:
|
|
154
|
+
- tags
|
|
155
|
+
|
|
156
|
+
# Test to check publish steps with local PyPi server
|
|
157
|
+
test-publish:
|
|
158
|
+
stage: pre-release
|
|
159
|
+
needs:
|
|
160
|
+
- test-release
|
|
161
|
+
before_script:
|
|
162
|
+
# Install prerequisites
|
|
163
|
+
- pip install git+https://github.com/pypa/hatch
|
|
164
|
+
script:
|
|
165
|
+
# Build package
|
|
166
|
+
- hatch run publish:build-package
|
|
167
|
+
# Check dist files
|
|
168
|
+
- hatch run publish:check-package
|
|
169
|
+
# Start a test pypi server
|
|
170
|
+
- hatch run publish:start-localpypi &
|
|
171
|
+
# Sleep for a while for server to start
|
|
172
|
+
- sleep 30
|
|
173
|
+
# Upload package to test
|
|
174
|
+
- hatch run publish:upload-to-localpypi
|
|
175
|
+
artifacts:
|
|
176
|
+
paths:
|
|
177
|
+
- build/reports/
|
|
178
|
+
expire_in: 1 day
|
|
179
|
+
except:
|
|
180
|
+
- tags
|
|
181
|
+
|
|
182
|
+
# Generate and deploy docs
|
|
183
|
+
pages:
|
|
184
|
+
stage: deploy
|
|
185
|
+
extends: .setup_node
|
|
186
|
+
script:
|
|
187
|
+
- pip install git+https://github.com/pypa/hatch
|
|
188
|
+
- hatch run docs:build
|
|
189
|
+
- mv docs/website/build/ public/
|
|
190
|
+
artifacts:
|
|
191
|
+
paths:
|
|
192
|
+
- public
|
|
193
|
+
only:
|
|
194
|
+
- main
|
|
195
|
+
except:
|
|
196
|
+
- tags
|
|
197
|
+
|
|
198
|
+
# Create a new release on GitLab UI
|
|
199
|
+
release:
|
|
200
|
+
stage: release
|
|
201
|
+
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
202
|
+
script:
|
|
203
|
+
- echo "Running release job"
|
|
204
|
+
release:
|
|
205
|
+
name: "Release File $CI_COMMIT_TAG"
|
|
206
|
+
description: "Created using the GitLab's release-cli"
|
|
207
|
+
tag_name: $CI_COMMIT_TAG
|
|
208
|
+
ref: $CI_COMMIT_TAG
|
|
209
|
+
only:
|
|
210
|
+
- tags
|
|
211
|
+
|
|
212
|
+
# Prepare release by tagging and adding entry to changelog
|
|
213
|
+
prepare_release:
|
|
214
|
+
stage: release
|
|
215
|
+
when: manual
|
|
216
|
+
# We do clone for this test as cached repos might have existing
|
|
217
|
+
# tags that can fail the job
|
|
218
|
+
variables:
|
|
219
|
+
GIT_STRATEGY: clone
|
|
220
|
+
extends: .setup_prepare_release
|
|
221
|
+
script:
|
|
222
|
+
- *prepare_release
|
|
223
|
+
# Set remote push URL and push to originating branch
|
|
224
|
+
- git remote set-url --push origin "https://${GITLAB_CI_USER}:${GITLAB_CI_TOKEN}@${CI_REPOSITORY_URL#*@}"
|
|
225
|
+
- git push origin HEAD:${CI_COMMIT_REF_NAME} -o ci.skip # Pushes to the same branch as the trigger
|
|
226
|
+
- git push origin ${NEXT_VERSION_SPECIFIER} # Pushes the tag BUT triggers the CI to run tagged jobs
|
|
227
|
+
# Only run on main branch and do not run on tags
|
|
228
|
+
# Because we create tag in this job
|
|
229
|
+
only:
|
|
230
|
+
- main
|
|
231
|
+
except:
|
|
232
|
+
- tags
|
|
233
|
+
|
|
234
|
+
# Publish the release to PyPI
|
|
235
|
+
# This job first publishes to test server and then publish to
|
|
236
|
+
# PyPI server upstream
|
|
237
|
+
# NOTE: Before we were attempting to run this on tags job. This
|
|
238
|
+
# WONT WORK as protected variables are ONLY available on
|
|
239
|
+
# PROTECTED TAGS. So we need to run this job on default protected
|
|
240
|
+
# branch
|
|
241
|
+
publish:
|
|
242
|
+
stage: release
|
|
243
|
+
needs:
|
|
244
|
+
- prepare_release
|
|
245
|
+
# Use clone strategy to be able to checkout "latest" main
|
|
246
|
+
variables:
|
|
247
|
+
GIT_STRATEGY: clone
|
|
248
|
+
before_script:
|
|
249
|
+
- echo "Preparing publish job..."
|
|
250
|
+
# This is crucial. If not the commit we made from previous job
|
|
251
|
+
# will not be available here as CI will always checkout the commit
|
|
252
|
+
# that triggered the job
|
|
253
|
+
- git fetch origin main
|
|
254
|
+
- git checkout main
|
|
255
|
+
# Install prerequisites
|
|
256
|
+
- pip install git+https://github.com/pypa/hatch
|
|
257
|
+
script:
|
|
258
|
+
# Build package
|
|
259
|
+
- hatch run publish:build-package
|
|
260
|
+
# Check dist files
|
|
261
|
+
- hatch run publish:check-package
|
|
262
|
+
# Upload package to test
|
|
263
|
+
- hatch run publish:upload-to-pypi
|
|
264
|
+
only:
|
|
265
|
+
- main
|
|
266
|
+
except:
|
|
267
|
+
- tags
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# pre-commit is a tool to perform a predefined set of tasks manually and/or
|
|
2
|
+
# automatically before git commits are made.
|
|
3
|
+
#
|
|
4
|
+
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
|
|
5
|
+
#
|
|
6
|
+
# Common tasks
|
|
7
|
+
#
|
|
8
|
+
# - Run on all files: pre-commit run --all-files
|
|
9
|
+
# - Register git hooks: pre-commit install --install-hooks
|
|
10
|
+
#
|
|
11
|
+
# Exclude CHANGELOG.md as it can "sometimes" block release process
|
|
12
|
+
# exclude: "CHANGELOG.md"
|
|
13
|
+
repos:
|
|
14
|
+
# Autoformat: Python code
|
|
15
|
+
- repo: https://github.com/ambv/black
|
|
16
|
+
rev: 23.1.0
|
|
17
|
+
hooks:
|
|
18
|
+
- id: black
|
|
19
|
+
|
|
20
|
+
# Autoformat: markdown, yaml
|
|
21
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
22
|
+
rev: v3.0.3
|
|
23
|
+
hooks:
|
|
24
|
+
- id: prettier
|
|
25
|
+
exclude: tests/.*
|
|
26
|
+
|
|
27
|
+
# Autoformat: https://github.com/asottile/reorder_python_imports
|
|
28
|
+
- repo: https://github.com/asottile/reorder_python_imports
|
|
29
|
+
rev: v3.9.0
|
|
30
|
+
hooks:
|
|
31
|
+
- id: reorder-python-imports
|
|
32
|
+
|
|
33
|
+
# Misc...
|
|
34
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
35
|
+
rev: v4.4.0
|
|
36
|
+
hooks:
|
|
37
|
+
# Autoformat: Makes sure files end in a newline and only a newline.
|
|
38
|
+
- id: end-of-file-fixer
|
|
39
|
+
exclude: tests/.*
|
|
40
|
+
|
|
41
|
+
# Autoformat: Sorts entries in requirements.txt.
|
|
42
|
+
- id: requirements-txt-fixer
|
|
43
|
+
|
|
44
|
+
# Lint: Check for files with names that would conflict on a
|
|
45
|
+
# case-insensitive filesystem like MacOS HFS+ or Windows FAT.
|
|
46
|
+
- id: check-case-conflict
|
|
47
|
+
|
|
48
|
+
# Lint: Checks that non-binary executables have a proper shebang.
|
|
49
|
+
- id: check-executables-have-shebangs
|
|
50
|
+
|
|
51
|
+
# Lint: JSON files
|
|
52
|
+
- id: check-json
|
|
53
|
+
|
|
54
|
+
# Lint: YAML files
|
|
55
|
+
- id: check-yaml
|
|
56
|
+
|
|
57
|
+
# Lint: Python code
|
|
58
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
59
|
+
rev: v0.1.0
|
|
60
|
+
hooks:
|
|
61
|
+
- id: ruff
|
|
62
|
+
args: ["--fix", "--show-fixes"]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
<!-- <START NEW CHANGELOG ENTRY> -->
|
|
4
|
+
|
|
5
|
+
## 0.1.0 (2023-11-02)
|
|
6
|
+
|
|
7
|
+
([Full Changelog](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/compare/6c710c92265819a8a2d1a59317b9c7e9d0d47fe7...fcc20006f29d94bbe20cbb139a07ff117c9fa566?from_project_id=51534402&straight=false))
|
|
8
|
+
|
|
9
|
+
### New features added
|
|
10
|
+
|
|
11
|
+
- Add release workflows in CI and get first and last commits when no tags found [!12](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/12) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
12
|
+
- Add source code [!1](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/1) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
13
|
+
|
|
14
|
+
### Enhancements made
|
|
15
|
+
|
|
16
|
+
- Add example configs [!8](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/8) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
17
|
+
- Change vars & opts names for consistency [!7](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/7) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
18
|
+
- Improve getting latest tags of local repos [!5](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/5) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
19
|
+
- Look for auth token from CI vars [!4](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/4) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
20
|
+
- Get created and also merged/closed activity [!3](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/3) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
21
|
+
- Improve API and grouping logic [!2](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/2) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
22
|
+
|
|
23
|
+
### Build changes
|
|
24
|
+
|
|
25
|
+
- Drop support for Python 3.12 [!16](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/16) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
26
|
+
|
|
27
|
+
### CI changes
|
|
28
|
+
|
|
29
|
+
- Fixes in CI and docs [!13](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/13) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
30
|
+
- Add release workflows in CI and get first and last commits when no tags found [!12](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/12) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
31
|
+
- Add CI YAML file for testing [!10](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/10) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
32
|
+
|
|
33
|
+
### Maintenance and upkeep improvements
|
|
34
|
+
|
|
35
|
+
- Change vars & opts names for consistency [!7](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/7) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
36
|
+
- Improve getting latest tags of local repos [!5](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/5) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
37
|
+
- Improve API and grouping logic [!2](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/2) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
38
|
+
|
|
39
|
+
### Documentation improvements
|
|
40
|
+
|
|
41
|
+
- Add sphinx API docs [!14](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/14) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
42
|
+
- Fixes in CI and docs [!13](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/13) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
43
|
+
- Add docs [!11](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/11) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
44
|
+
- Add example configs [!8](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/8) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
45
|
+
|
|
46
|
+
### Unlabelled Merged MRs
|
|
47
|
+
|
|
48
|
+
- Add new cli tests [!15](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/15) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
49
|
+
- Add more tests [!9](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/9) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
50
|
+
- Add tests [!6](https://gitlab.com/mahendrapaipuri/gitlab-activity/-/merge_requests/6) ([@mahendrapaipuri](https://gitlab.com/mahendrapaipuri))
|
|
51
|
+
|
|
52
|
+
### [Contributors to this release](https://mahendrapaipuri.gitlab.io/gitlab-activity/usage#contributors-list)
|
|
53
|
+
|
|
54
|
+
[@mahendrapaipuri](https://gitlab.com/mahendrapaipuri)
|
|
55
|
+
|
|
56
|
+
<!-- <END NEW CHANGELOG ENTRY> -->
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Contributing to GitLab Activity
|
|
2
|
+
|
|
3
|
+
If you're reading this section, you're probably interested in contributing to
|
|
4
|
+
`gitlab-activity`. Welcome and thanks for your interest in contributing. There are many
|
|
5
|
+
ways to contribute to the project.
|
|
6
|
+
|
|
7
|
+
## Contribution types
|
|
8
|
+
|
|
9
|
+
### Bug reports
|
|
10
|
+
|
|
11
|
+
Bug reports are an important type of contribution - it's important to get feedback
|
|
12
|
+
about how the tool is failing, and there's no better way to do that than to hear
|
|
13
|
+
about real-life failure cases. A good bug report will include:
|
|
14
|
+
|
|
15
|
+
- A minimal, reproducible example - a small, self-contained script that can reproduce
|
|
16
|
+
the behavior is the best way to get your bug fixed. For more information and tips on
|
|
17
|
+
how to structure these, read
|
|
18
|
+
[Stack Overflow's guide to creating a minimal, complete, verified example](https://stackoverflow.com/help/mcve).
|
|
19
|
+
|
|
20
|
+
- The platform and versions of everything involved, at a minimum please include
|
|
21
|
+
operating system, python version and `gitlab-activity` version.
|
|
22
|
+
Instructions on getting your versions:
|
|
23
|
+
|
|
24
|
+
- `gitlab-activity`: `python -c "import gitlab-activity; print(gitlab-activity.__version__)"`
|
|
25
|
+
- Python: `python --version`
|
|
26
|
+
|
|
27
|
+
- A description of the problem - what is happening and what should happen.
|
|
28
|
+
|
|
29
|
+
While pull requests fixing bugs are accepted, they are not required - the bug report
|
|
30
|
+
in itself is a great contribution.
|
|
31
|
+
|
|
32
|
+
### Feature requests
|
|
33
|
+
|
|
34
|
+
If you would like to see a new feature in `gitlab-activity`, it is probably best to
|
|
35
|
+
start an issue for discussion rather than taking the time to implement a feature
|
|
36
|
+
which may or may not be appropriate for `gitlab-activity`. For minor features
|
|
37
|
+
(ones where you don't have to put a lot of effort into the MR), a pull request
|
|
38
|
+
is fine but still not necessary.
|
|
39
|
+
|
|
40
|
+
### Merge requests
|
|
41
|
+
|
|
42
|
+
If you would like to fix something in `gitlab-activity` - improvements to documentation,
|
|
43
|
+
bug fixes, feature implementations, fixes to the build system, etc - merge requests
|
|
44
|
+
are welcome! Where possible, try to keep your coding to PEP 8 style. `pre-commit` can
|
|
45
|
+
be used to stay within styling guides.
|
|
46
|
+
|
|
47
|
+
The most important thing to include in your merge request are tests - please write
|
|
48
|
+
one or more tests to cover the behavior you intend your patch to improve.
|
|
49
|
+
|
|
50
|
+
## Development Setup
|
|
51
|
+
|
|
52
|
+
### Using a virtual environment
|
|
53
|
+
|
|
54
|
+
It is advisable to work in a virtual environment for development of `gitlab-activity`.
|
|
55
|
+
This can be done using [virtualenv](https://virtualenv.pypa.io/):
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
python -m virtualenv .venv # Create virtual environment in .venv directory
|
|
59
|
+
source .venv/bin/activate # Activate the virtual environment
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Alternatively you can create a
|
|
63
|
+
[conda environment](https://conda.io/docs/user-guide/tasks/manage-environments.html):
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
conda create -n gitlab-activity # Create a conda environment
|
|
67
|
+
# conda create -n gitlab-activity python=3.8 # Or specify a version
|
|
68
|
+
conda activate gitlab-activity # Activate the conda environment
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Once your virtual environment is created, install the library in development mode:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
pip install -e '.[dev]'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This will install all the package dependencies including the ones required for
|
|
78
|
+
development.
|
|
79
|
+
|
|
80
|
+
### pre-commit
|
|
81
|
+
|
|
82
|
+
The package uses [pre-commit](https://pre-commit.com/) to run styling packages like
|
|
83
|
+
`black`, `ruff`, _etc._. First install `pre-commit` components to setup the development
|
|
84
|
+
environment
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
pre-commit install
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
After this step, `pre-commit` will run at every git commit and reformats the files
|
|
91
|
+
according to styling config provided in the `pyproject.toml`. If user wishes to run
|
|
92
|
+
`pre-commit` manually, it can be done using
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
pre-commit run --all-files
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Tests
|
|
99
|
+
|
|
100
|
+
Tests can be run in the current environment using `pytest` command
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
pytest
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
In order to test multiple Python versions, we can use
|
|
107
|
+
[hatch environments](https://hatch.pypa.io/latest/environment/) which are analogous
|
|
108
|
+
to tools `tox` and `nox`. Unlike the stated tools, `hatch` can create a Python
|
|
109
|
+
installation without having to dependent on existing Python versions on the
|
|
110
|
+
local machine.
|
|
111
|
+
|
|
112
|
+
In order to use `hatch` environments, first the user need to install `hatch` in
|
|
113
|
+
the current environment
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
pip install 'hatch>1.7.0'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
:::note
|
|
120
|
+
|
|
121
|
+
It is important to install `hatch>1.7.0` as the feature that creates the different
|
|
122
|
+
versions of Python environments has been added after `1.7.0`. See related
|
|
123
|
+
[PR](https://github.com/pypa/hatch/pull/1002).
|
|
124
|
+
|
|
125
|
+
:::
|
|
126
|
+
|
|
127
|
+
Once `hatch` is installed, users can run test in a given Python environment using
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
hatch run +py=3.11 test:test
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
This command will do following:
|
|
134
|
+
|
|
135
|
+
- Create a Python environment with Python 3.11
|
|
136
|
+
- Install project and its dependencies in development mode
|
|
137
|
+
- Invoke `pytest` command and executes all the tests
|
|
138
|
+
|
|
139
|
+
If user wishes to test all Python versions that the package supports, they can do
|
|
140
|
+
it with single command
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
hatch run test:test
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
If users want to run the tests with all the supported Python versions _modulo_
|
|
147
|
+
Python 3.8, it can be done using
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
hatch run -py=3.8 test:test
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
To list all the supported environments of current package, we can use
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
hatch env show --ascii
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
which will list the names of supported environments and their variants.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, Mahendra Paipuri
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|