1
Fork 0
mirror of https://github.com/Steffo99/emblematic.git synced 2024-11-24 15:54:17 +00:00

First commit

This commit is contained in:
Steffo 2023-03-07 23:54:05 +01:00
commit 4026a694b5
Signed by: steffo
GPG key ID: 2A24051445686895
23 changed files with 978 additions and 0 deletions

16
.editorconfig Normal file
View file

@ -0,0 +1,16 @@
# https://editorconfig.org
root = true
[*]
# Enforce lf line endings
end_of_line = lf
# Enforce newline at end of files
insert_final_newline = true
# Python (sadly) strongly recommends the usage of 4 spaces as indentation.
indent_style = space
indent_size = 4

78
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,78 @@
# Dependabot configuration file
# See: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#allow
version: 2
updates:
# We're using Poetry
- package-ecosystem: pip
# The root directory of the project
directory: "/"
# Check every day for updates at 08:00 UTC
schedule:
interval: "daily"
time: "08:00"
timezone: "UTC"
# Do not alert for indirect dependencies, as there may be too many
allow:
- dependency-type: direct
# Set the pull request label
labels:
- "dependencies"
# Stay updated to the main branch
rebase-strategy: auto
# Pip does not support any other versioning strategy
versioning-strategy: lockfile-only
# Additionally, keep GitHub Actions updated
- package-ecosystem: github-actions
# The root directory of the actions
directory: "/"
# Check every day for updates at 08:00 UTC
schedule:
interval: "daily"
time: "08:00"
timezone: "UTC"
# GitHub Actions only has direct dependencies
allow:
- dependency-type: direct
# Set the pull request label
labels:
- "automation"
# Stay updated to the main branch
rebase-strategy: auto
# Finally, keep Git submodules updated
- package-ecosystem: gitsubmodule
# The root directory of the repository
directory: "/"
# Check every day for updates at 08:00 UTC
schedule:
interval: "daily"
time: "08:00"
timezone: "UTC"
# GitHub Actions only has direct dependencies
allow:
- dependency-type: direct
# Set the pull request label
labels:
- "dependencies"
# Stay updated to the main branch
rebase-strategy: auto

11
.github/workflows/quality.yml vendored Normal file
View file

@ -0,0 +1,11 @@
name: "Periodic quality and security analysis"
on:
# Every monday at 09:48 UTC
schedule:
- cron: "48 9 * * 1"
workflow_dispatch:
jobs:
codeql:
uses: Steffo99/.github/.github/workflows/quality-python-codeql.yml@main

35
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: "Release new version"
on:
# Creation of a new tag starting with v
push:
tags:
- "v*"
jobs:
test:
uses: ./.github/workflows/test.yml
build:
uses: Steffo99/.github/.github/workflows/build-poetry.yml@main
github:
uses: Steffo99/.github/.github/workflows/release-poetry-github.yml@main
needs:
- test
- build
pypi:
uses: Steffo99/.github/.github/workflows/release-poetry-pypi.yml@main
needs:
- test
- build
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
portainer:
uses: Steffo99/.github/.github/workflows/deploy-portainer.yml@main
needs:
- ghcrio
secrets:
PORTAINER_HOOK_URL: ${{ secrets.PORTAINER_HOOK_URL }}

25
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: "Test suite"
on:
# Modification of a project file in the main branch
push:
branches:
- main
paths:
- "emblematic/**"
- "pyproject.toml"
- "poetry.lock"
# Pull request to the main branch modifying a project file
pull_request:
branches:
- main
paths:
- "emblematic/**"
- "pyproject.toml"
- "poetry.lock"
# Triggered by a new release
workflow_call:
jobs:
test:
uses: Steffo99/.github/.github/workflows/test-poetry-compileall.yml@main

169
.gitignore vendored Normal file
View file

@ -0,0 +1,169 @@
# Gitignore file
# See https://git-scm.com/docs/gitignore for more details
###################
# Project ignores #
###################
# Add your own ignores here!
##################
# Python ignores #
##################
# From https://github.com/github/gitignore/blob/main/Python.gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-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/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# 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/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

10
.readthedocs.yml Normal file
View file

@ -0,0 +1,10 @@
version: 2
python:
install:
- path: "."
build:
os: "ubuntu-20.04"
tools:
python: "3.10"

6
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"recommendations": [
"ms-python.python",
"bungcip.better-toml",
]
}

13
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,13 @@
{
"files.exclude": {
".idea/": true,
"**/*.iml": true,
"**/.pytest_cache/": true,
"**/__pycache__/": true,
".venv/": true,
"dist/": true,
"out/": true,
"poetry.lock": true,
},
"python.analysis.extraPaths": ["./emblematic"],
}

37
Dockerfile Normal file
View file

@ -0,0 +1,37 @@
# TODO: If you're building a library, remove this file!
FROM python:3-alpine AS system
# TODO: Add whatever dependency your image may require
RUN apk add --update build-base python3-dev py-pip musl-dev
RUN pip install "poetry"
FROM system AS workdir
# TODO: Use the name of your project
WORKDIR /usr/src/emblematic
FROM workdir AS dependencies
COPY pyproject.toml ./pyproject.toml
COPY poetry.lock ./poetry.lock
RUN poetry install --no-root --no-dev
FROM dependencies AS package
COPY . .
RUN poetry install
FROM package AS entrypoint
ENV PYTHONUNBUFFERED=1
ENTRYPOINT ["poetry", "run", "python", "-m"]
# TODO: Set the name of your Python module
CMD ["emblematic"]
FROM entrypoint AS labels
# TODO: Set a Docker image title
LABEL org.opencontainers.image.title="emblematic"
# TODO: Set a Docker image decription
LABEL org.opencontainers.image.description="Simple icon generator"
# TODO: Set a Docker image license
LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later"
# TODO: Set a Docker image URL
LABEL org.opencontainers.image.url="https://github.com/Steffo99/emblematic/"
# TODO: Set the Docker image authors
LABEL org.opencontainers.image.authors="Stefano Pigozzi <me@steffo.eu>"

12
README.md Normal file
View file

@ -0,0 +1,12 @@
# `emblematic` [![Available on PyPI](https://img.shields.io/pypi/v/emblematic)](https://pypi.org/project/emblematic/)
Simple icon generator
\[ **[Documentation]** | **[Available on PyPI]** | [Repository] \]
<!-- Add an image or some examples here, if available! -->
[Documentation]: https://emblematic.readthedocs.io/latest/
[Available on PyPI]: https://pypi.org/project/emblematic
[Repository]: https://github.com/Steffo99/emblematic/

8
docker-compose.yml Normal file
View file

@ -0,0 +1,8 @@
version: "3.9"
services:
emblematic:
image: "ghcr.io/Steffo99/emblematic:latest"
restart: unless-stopped
env_file:
- "stack.env"

22
docs/Makefile Normal file
View file

@ -0,0 +1,22 @@
# Slightly extended makefile for Sphinx documentation
# Sphinx options
export SPHINXOPTS =
export SPHINXBUILD = "sphinx-build"
export SOURCEDIR = "source"
export BUILDDIR = "build"
# LaTeX builder options
export LATEXMKOPTS =
export LATEXOPTS = "-interaction=nonstopmode"
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

36
docs/make.bat Normal file
View file

@ -0,0 +1,36 @@
@ECHO OFF
pushd %~dp0
REM Slightly extended command file for Sphinx documentation
set SPHINXOPTS=
set SPHINXBUILD=sphinx-build
set SOURCEDIR=source
set BUILDDIR=build
set LATEXMKOPTS=
set LATEXOPTS=-interaction=nonstopmode
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

1
docs/source/_extra/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
# Placeholder file to create the directory in Git

1
docs/source/_static/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
# Placeholder file to create the directory in Git

1
docs/source/_templates/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
# Placeholder file to create the directory in Git

154
docs/source/conf.py Normal file
View file

@ -0,0 +1,154 @@
# Extended Sphinx configuration
# https://www.sphinx-doc.org/en/master/usage/configuration.html
###########
# Imports #
###########
import datetime
###########################
# Developer configuration #
###########################
# Alter these to reflect the nature of your project!
# Project name
project = 'emblematic'
# Project author
author = 'Stefano Pigozzi'
# Project copyright
project_copyright = f'{datetime.date.today().year}, {author}'
# Sphinx language
language = "en"
# Configuration for the theme
html_theme_options = {
# Set this to the main color of your project
"style_nav_header_background": "#175d36",
}
html_context = {
"display_github": True,
# Set this to the name of the organization this GitHub repository is in
"github_user": "Steffo99",
# Set this to the name of this repository
"github_repo": "emblematic",
# Set this to the name of the main branch slash docs slash
"github_version": "main/docs/",
}
##########################
# Advanced configuration #
##########################
# Change these options only if you need further customization
# Sphinx extensions
extensions = [
"sphinx.ext.intersphinx",
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.todo",
]
# Source files encoding
source_encoding = "UTF-8"
# Source file extensions
source_suffix = {
".rst": "restructuredtext",
}
# Source files parsers
source_parsers = {}
# The doc from which to start rendering
root_doc = "index"
# Files to ignore when rendering
exclude_patterns = [
"build",
"_build",
"Thumbs.db",
".DS_Store",
]
# Sphinx template files
templates_path = [
'_templates',
]
# Prologue of all rst files
rst_prolog = """
.. |this| replace:: :mod:`emblematic`
"""
# Epilogue of all rst files
rst_epilog = """"""
# Default domain
primary_domain = "py"
# Default role
default_role = "any"
# Print warnings on the page
keep_warnings = False
# Display more warnings than usual
nitpicky = False
# Intersphinx URLs
intersphinx_mapping = {
"python": ("https://docs.python.org/3.10", None),
"poetry":
}
# Manpages URL
manpages_url = "https://man.archlinux.org/"
# HTML builder theme
html_theme = 'sphinx_rtd_theme'
# Title of the HTML page
html_title = f"{project}"
# Short title of the HTML page
html_short_title = f"{project}"
# Path of the documentation static files
html_static_path = [
"_static",
]
# Path of extra files to add to the build
html_extra_path = [
"_extra",
]
# Disable additional indexes
html_domain_indices = False
# LaTeX rendering engine to use
latex_engine = "lualatex"
# LaTeX top level title type
latex_toplevel_sectioning = "chapter"
# LaTeX URLs rendering
latex_show_urls = "footnote"
# LaTeX theme
latex_theme = "manual"
# TODOs
todo_include_todos = True
todo_emit_warnings = True
todo_link_only = False
# Smartquotes
smartquotes_excludes = {
"languages": [
# Smartquotes is completely broken in italian!
"it",
# Keep the default, just in case
"ja",
],
"builders": [
"man",
"text",
]
}
# Autodoc
autodoc_member_order = "bysource"
autodoc_default_options = {
"members": True,
"undoc-members": True,
}

29
docs/source/index.rst Normal file
View file

@ -0,0 +1,29 @@
###############################################################################
emblematic
###############################################################################
Simple icon generator
=================
Table of contents
=================
..
If you create more pages, add them in the toctree!
.. toctree::
installation
============
Useful links
============
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
* `emblematic on PyPI <https://pypi.org/project/emblematic>`_
* `emblematic on GitHub <https://github.com/Steffo99/emblematic/>`_

View file

@ -0,0 +1,140 @@
*******************************************************************************
Installation
*******************************************************************************
|this| can be installed in multiple ways: choose the one that better suits your needs!
=========
From PyPI
=========
|this| is distributed through the `Python Package Index <https://pypi.org/>`_, so you can install it with your favourite dependency manager!
This is the recommended way to install the package, as it's the simplest to manage and will work properly for most use cases.
---------
Using pip
---------
.. warning::
Never install packages outside a :mod:`venv`, unless you know very well what you're doing!
You can create a *venv* (short for *virtual environment*) by entering:
.. code-block:: console
$ python -m venv .venv
Then, you can activate that venv by entering:
.. code-block:: console
$ # On Bash
$ source .venv/bin/activate
.. code-block:: console
$ # On Fish
$ source .venv/bin/activate.fish
.. code-block:: wincon
> ; On Windows
> .venv/Scripts/activate.ps1
Once activated, all :mod:`pip` commands you enter will affect only the virtual environment, and won't prevent the correct functioning of your operating system!
To install |this| using :mod:`pip`:
#. Add |this| to your `requirements.txt` file:
.. code-block:: text
emblematic
#. Update your dependencies:
.. code-block:: console
$ pip install --upgrade --requirement requirements.txt
----------
Using pipx
----------
To install |this| using :mod:`pipx`:
#. Run the following command:
.. code-block:: console
$ pipx install emblematic
===========
From source
===========
You can install |this| by manually retrieving its source and installing it in your environment!
This may be useful if you want to tweak its behaviour without making a full fork.
------------
Using PEP518
------------
.. warning::
Never install packages outside a :mod:`venv`, unless you know very well what you're doing!
See `Using pip` for more details on how to use *venvs*.
You can use the :mod:`pip` features introduced with :pep:`518` to automatically install |this| in your environment:
#. Access the source code directory:
.. code-block:: console
$ cd emblematic
#. Install |this| in editable mode using :mod:`pip`:
.. code-block:: console
$ pip install --editable .
.. note::
Any edit applied to the source code will be automatically reflected to the
===============
For development
===============
To contribute to |this|, you need to setup the project's environment using :mod:`poetry`:
#. Access the source code directory:
.. code-block:: console
$ cd emblematic
#. Install the project's dependencies with :mod:`poetry`:
.. code-block:: console
$ poetry install
.. hint::
Setting ``virtualenvs.in-project`` to :data:`True` is recommended!
.. code-block:: console
$ poetry config virtualenvs.in-project true

5
emblematic/__init__.py Normal file
View file

@ -0,0 +1,5 @@
# If you are building a **library**, use this file to export objects!
__all__ = (
# "",
)

8
emblematic/__main__.py Normal file
View file

@ -0,0 +1,8 @@
# If you are building an **application**, use this file to run code!
def main():
pass
if __name__ == "__main__":
main()

161
pyproject.toml Normal file
View file

@ -0,0 +1,161 @@
[build-system]
#######################
# Python build system #
#######################
# The build system to use when installing this package.
# Used when installing the package with `pip install .`.
# See also: https://www.python.org/dev/peps/pep-0517/
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
###################
# Poetry settings #
###################
# See https://python-poetry.org/docs/pyproject/ for more details!
# The name of your project.
# Ensure that it is available on PyPI: https://pypi.org/
name = "emblematic"
# The version of the package.
version = "0.1.0"
# A brief, one-sentence description about your project.
description = "Simple icon generator"
# A list of the authors of the project.
authors = [
"Stefano Pigozzi <me@steffo.eu>",
]
# A list of maintainers of the project.
# Often, it is the same as the authors list.
maintainers = [
"Stefano Pigozzi <me@steffo.eu>",
]
# The license of the package.
# Uses SPDX format: https://spdx.org/licenses/
license = "AGPL-3.0-or-later"
# The README file.
readme = "README.md"
# The URL of the project website.
# Not the GitHub repository!
#homepage = "https://example.org/"
# The URL of the project repository.
repository = "https://github.com/Steffo99/emblematic/"
# The URL of the project documentation location.
documentation = "https://emblematic.readthedocs.io/latest/"
# Up to five keywords related to your project.
# See also: https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#keywords
#keywords = [
# "",
# "",
# "",
# "",
# "",
#]
# Any number of trove classifiers that apply to your project.
# See the list at: https://pypi.org/classifiers/
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
]
# ADVANCED: specify the packages exported by your project
# See also: https://python-poetry.org/docs/pyproject/#packages
# packages = [
# # Regular packages
# { include = "OTHER_PACKAGE_NAME" },
# # Namespace packages
# { include = "EXTEND/OTHER/NAMESPACE/**/*.py" }
# ]
# ADVANCED: include additional files in the build
# include = [
# "FILENAME.txt"
# ]
# ADVANCED: exclude files from the build
# exclude = [
# "PACKAGE_NAME/test.py"
# ]
[tool.poetry.urls]
##################
# URLs #
##################
# Additional project URLs in a name → link mapping.
[tool.poetry.scripts]
#####################
# Scripts #
#####################
# Poetry can create "binaries" to add to the PATH when the project is installed.
# They are specified in the form of a mapping with the command name as key and the function to execute as value.
emblematic = "emblematic.__main__:main"
[tool.poetry.dependencies]
##########################
# Dependencies #
##########################
# A mapping of dependencies of the project
# It should be maintained by `poetry add` / `poetry remove`, but it currently adds things after all comments...
# You can manually specify allowed version numbers:
# * means "any release"
# * → any
# ^X.X.X means "newer releases with this major version"
# ^3.10.1 → == 3 && >= 3.10.1
# ~X.X.X means "newer releases with this minor version"
# ~3.10.1 → == 3.10 && >= 3.10.1
# nothing means "this specific release"
# 3.10.1 → == 3.10.1
python = "^3.10"
[tool.poetry.group.dev.dependencies]
##############################
# Development dependencies #
##############################
# Same as above, but these dependencies are installed only if the project is being installed in development mode.
# They are excluded from the final build.Sphinx = "^4.3.2"
sphinx-rtd-theme = "^1.0.0"[tool.poetry.extras]
####################
# Package extras #
####################
# ADVANCED: specify optional dependency groups.
# See: https://python-poetry.org/docs/pyproject/#extras
[tool.poetry.plugins]
#####################
# Poetry plugins #
#####################
# ADVANCED: extend Poetry's functionality.
# See: https://python-poetry.org/docs/pyproject/#plugins
[tool.pytest.ini_options]
#########################
# Pytest configuration #
#########################