This commit is contained in:
Midgard 2023-05-15 19:00:03 +02:00
parent d2b634d87d
commit fd2c2c3b12
Signed by: midgard
GPG Key ID: 511C112F1331BBB4
12 changed files with 252 additions and 4 deletions

105
.gitignore vendored
View File

@ -1,3 +1,104 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.pyc
*.pyo
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
.static_storage/
.media/
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/

8
CHANGELOG.md Normal file
View File

@ -0,0 +1,8 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
Initial release

17
README.md Normal file
View File

@ -0,0 +1,17 @@
# mmcli
## Development
To create a virtualenv and install the dependencies in it:
```
tools/create_venv.sh
```
Activate the virtualenv with `source venv/bin/activate`. To make this easier, you could create
an [alias][] `alias venv='source venv/bin/activate'` in your shell.
[alias]: https://www.computerworld.com/article/2598087/how-to-use-aliases-in-linux-shell-commands.html
If you introduce dependencies, list them in `pyproject.toml` under `dependencies`, and run
`tools/update_requirements.sh`.

0
mmcli/__init__.py Normal file
View File

View File

@ -9,9 +9,9 @@ import re
from time import sleep
import threading
import mattermost
from parsedt import parse_datetime_to_utc
from .parsedt import parse_datetime_to_utc
from mmws import MMws
from .mmws import MMws
class NotFound(Exception):

51
pyproject.toml Normal file
View File

@ -0,0 +1,51 @@
[project]
name = "mmcli"
version = "0.0.1"
authors = [
{ name="Midgard", email="midgard@zeus.ugent.be" },
]
description = "Mattermost command-line interface"
readme = "README.md"
# Choose from the list at https://pypi.org/classifiers/
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Natural Language :: English",
"Environment :: Console",
#"Development Status :: 1 - Planning",
#"Development Status :: 2 - Pre-Alpha",
"Development Status :: 3 - Alpha",
#"Development Status :: 4 - Beta",
#"Development Status :: 5 - Production/Stable",
#"Development Status :: 6 - Mature",
#"Development Status :: 7 - Inactive",
"Intended Audience :: End Users/Desktop",
"Topic :: Utilities",
]
requires-python = ">=3.7"
dependencies = [
"python-dateutil >= 2.8.2, < 3.0.0",
"mattermost >= 5.33.0",
]
[project.urls]
#"Homepage" = ""
"Source" = "https://git.zeus.gent/midgard/mmcli"
"Change log" = "https://git.zeus.gent/midgard/mmcli/-/blob/master/CHANGELOG.md"
"Bug tracker" = "https://git.zeus.gent/midgard/mmcli/-/issues"
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project.scripts]
# executable-name = "package.subpackage.module:function"
mmcli = "mmcli.mmcli:main"
[tool.setuptools.packages]
find = {}

4
tools/clean.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cd "`dirname "$0"`"/..
rm -rf ./build/ ./*.egg-info/ ./dist/ ./__pycache__/ ./*/__pycache__/

8
tools/create_venv.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "`dirname "$0"`"/..
# Create virtualenv
python3 -m virtualenv venv/
# Install dependencies
venv/bin/pip install -e .

43
tools/release.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
set -e
cd $(dirname "$0")/..
tools/test.sh
if [ ! -t 0 ] ; then
echo "release.sh should be run with a terminal attached to stdin" >&2
exit 1
fi
git status
echo -n "Previous version: v"
prev_version="$(python -c 'print(__import__("tomllib").load(open("pyproject.toml", "rb"))["project"]["version"])')"
echo "$prev_version"
read -p "Enter new version: v" version
tagid=v"$version"
if [ "$version" != "$prev_version" ]; then
sed -i 's/version = ".*"/version = "'"$version"'"/q' pyproject.toml
sed -i 's/## \[Unreleased\]/&\n### Added\n### Changed\n### Deprecated\n### Removed\n### Fixed\n### Security\n\n## ['"$version"'] - '"$(date --utc +%Y-%m-%d)"'/' CHANGELOG.md
echo; echo "Inspect CHANGELOG..."
${EDITOR:-nano} CHANGELOG.md
git add pyproject.toml CHANGELOG.md
git commit -m "Bump version to $version"
echo "Creating git tag $tagid"
git tag -s -m "Version $version" "$tagid"
else
echo "Version already created; building wheel and uploading"
fi
venv/bin/pip install --upgrade build
venv/bin/python -m build
read -p "Upload to Git and PyPI? (y/N) " confirm
if [ ! "$confirm" = y ]; then "Abort"; exit 1; fi
python3 -m twine upload dist/*-${version}*
git push origin "$tagid" master

16
tools/update_requirements.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
cd "`dirname "$0"`"/..
if [ ! -f venv/bin/pip-compile ]; then
venv/bin/pip install pip-tools
fi
cat <<EOF > requirements.txt
#
# This file is autogenerated. To update, run:
# tools/update_requirements.sh
#
EOF
venv/bin/pip-compile --quiet --generate-hashes --annotate --no-header --output-file="-" >> requirements.txt
echo "Updated requirements.txt"