1
0

🤖 Repository layout updated to latest version
Some checks are pending
Python Ruff Code Quality / ruff (push) Waiting to run
Run Python tests (through Pytest) / Test (push) Waiting to run
Verify Python project can be installed, loaded and have version checked / Test (push) Waiting to run

This commit was automatically generated by [a script](https://gitfub.space/Jmaa/repo-manager)
This commit is contained in:
Takunomi Automaticus, The 2nd 2025-07-07 00:41:06 +02:00
parent 6b784794d5
commit ea8b09c839
9 changed files with 207 additions and 27 deletions

View File

@ -1,16 +1,33 @@
# WARNING!
# THIS IS AN AUTOGENERATED FILE!
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
name: Package Python name: Package Python
on: on:
push: push:
tags: tags:
- 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+'
paths-ignore: ["README.md", ".gitignore", "LICENSE", "ruff.toml"] paths-ignore: ['README.md', '.gitignore', 'LICENSE', 'CONVENTIONS.md', 'ruff.toml']
jobs: jobs:
Package: Package-Python-And-Publish:
uses: jmaa/workflows/.gitea/workflows/python-package.yaml@v6.21 runs-on: ubuntu-latest
with: container:
REGISTRY_DOMAIN: gitfub.space image: node:21-bookworm
REGISTRY_ORGANIZATION: jmaa steps:
secrets: - name: Setting up Python ${{ env.PYTHON_VERSION }} for ${{runner.arch}} ${{runner.os}}
PIPY_REPO_USER: ${{ secrets.PIPY_REPO_USER }} run: |
PIPY_REPO_PASS: ${{ secrets.PIPY_REPO_PASS }} apt-get update
apt-get install -y python3 python3-pip
- name: Check out repository code
if: success()
uses: actions/checkout@v3
- name: Installing Python Dependencies
if: success()
run: python3 -m pip install --upgrade pip setuptools wheel build twine pytest --break-system-packages
- name: Build
if: success()
run: python3 -m build
- name: Publish
if: success()
run: python3 -m twine upload --repository-url "https://gitfub.space/api/packages/jmaa/pypi" -u ${{ secrets.PIPY_REPO_USER }} -p ${{ secrets.PIPY_REPO_PASS }} dist/*

View File

@ -1,7 +1,11 @@
# WARNING!
# THIS IS AN AUTOGENERATED FILE!
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
name: Python Ruff Code Quality name: Python Ruff Code Quality
on: on:
push: push:
paths-ignore: ["README.md", ".gitignore", "LICENSE"] paths-ignore: ['README.md', '.gitignore', 'LICENSE', 'CONVENTIONS.md', 'ruff.toml']
jobs: jobs:
ruff: ruff:

View File

@ -1,8 +1,12 @@
# WARNING!
# THIS IS AN AUTOGENERATED FILE!
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
name: Run Python tests (through Pytest) name: Run Python tests (through Pytest)
on: on:
push: push:
paths-ignore: ["README.md", ".gitignore", "LICENSE", "ruff.toml"] paths-ignore: ['README.md', '.gitignore', 'LICENSE', 'CONVENTIONS.md', 'ruff.toml']
jobs: jobs:
Test: Test:

View File

@ -1,8 +1,12 @@
# WARNING!
# THIS IS AN AUTOGENERATED FILE!
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
name: Verify Python project can be installed, loaded and have version checked name: Verify Python project can be installed, loaded and have version checked
on: on:
push: push:
paths-ignore: ["README.md", ".gitignore", "LICENSE", "ruff.toml"] paths-ignore: ['README.md', '.gitignore', 'LICENSE', 'CONVENTIONS.md', 'ruff.toml']
jobs: jobs:
Test: Test:

36
CONVENTIONS.md Normal file
View File

@ -0,0 +1,36 @@
<!-- WARNING! -->
<!-- THIS IS AN AUTOGENERATED FILE! -->
<!-- MANUAL CHANGES CAN AND WILL BE OVERWRITTEN! -->
# Conventions
When contributing code to this project, you MUST follow the requirements
specified here.
## Code Conventions
When contributing code to this project, you MUST follow these principles:
- Code should be easy to read and understand.
- Keep the code as simple as possible. Avoid unnecessary complexity.
- Use meaningful names for variables, functions, etc. Names should reveal intent.
- Functions should be small and do one thing well. They should not exceed a few lines.
- Function names should describe the action being performed.
- Only use comments when necessary, as they can become outdated. Instead, strive to make the code self-explanatory.
- When comments are used, they should add useful information that is not readily apparent from the code itself.
- Properly handle errors and exceptions to ensure the software's robustness.
- Use exceptions rather than error codes for handling errors.
- Consider security implications of the code. Implement security best practices to protect against vulnerabilities and attacks.
- Documentation should document semantics, not syntax.
- Prefer importing modules, not individual items from modules.
- Do not use f-strings in logging statements.
- Loop variables and walrus-expression-variables should be deleted when
unneeded to keep scope clean, and to avoid accidental use.
## Testing
When contributing test to this project, you MUST follow these principles:
- Do not use any testing libraries other than `pytest`.
- Mocking is the root of all evil. Writing your own stubs is much more
preferable.

View File

@ -1,3 +1,3 @@
Copyright (c) 2022-2024 Jon Michael Aanes Copyright (c) 2022-2025 Jon Michael Aanes
All rights reserved. All rights reserved.

View File

@ -1,7 +1,6 @@
<!--- WARNING ---> <!-- WARNING! -->
<!--- THIS IS AN AUTO-GENERATED FILE ---> <!-- THIS IS AN AUTOGENERATED FILE! -->
<!--- MANUAL CHANGES CAN AND WILL BE OVERWRITTEN ---> <!-- MANUAL CHANGES CAN AND WILL BE OVERWRITTEN! -->
# Socials-util # Socials-util
@ -14,7 +13,9 @@ Used by one-page-internet.
## Dependencies ## Dependencies
All requirements can be installed easily using: This project requires [Python](https://www.python.org/) 3.8 or newer.
All required libraries can be installed easily using:
```bash ```bash
pip install -r requirements.txt pip install -r requirements.txt
@ -25,10 +26,32 @@ Full list of requirements:
- [aenum](https://pypi.org/project/aenum/) - [aenum](https://pypi.org/project/aenum/)
## Contributing
Feel free to submit pull requests. Please follow the [Code Conventions](CONVENTIONS.md) when doing so.
### Testing
Testing requires the [pytest](https://docs.pytest.org/en/stable/) library.
Run tests with the following command:
```sh
pytest test
```
Test coverage can be run using the [`pytest-cov`](https://pypi.org/project/pytest-cov/) extension:
```sh
pytest --cov=socials_util test
```
## License ## License
``` ```
Copyright (c) 2022-2024 Jon Michael Aanes Copyright (c) 2022-2025 Jon Michael Aanes
All rights reserved. All rights reserved.
``` ```

View File

@ -1 +0,0 @@
/home/jmaa/.config/ruff/pyproject.toml

80
ruff.toml Normal file
View File

@ -0,0 +1,80 @@
#[tool.ruff]
lint.select = [ 'ALL' ]
lint.ignore = [
'ANN', # Type annotations (lots of work.)
'FBT', # Boolean trap is bullshit.
'C90', 'PLR0911', 'PLR0915', 'PLR0913', # Code complexity measures are bullshit.
'Q003', 'D205', # Format conflict
'TCH', # Microoptimization at the cost of readability
'TID252', # I like relative imports
'D407', 'D413', # Weird documentation stuff
'D100', 'D101', 'D102', 'D103', 'D104', 'D105', 'D106', 'D107', 'D300', 'D401', # Missing docstrings (lots of work)
'TD002', 'TD003', 'TD004', 'FIX', # Who cares about TODO standards?
"E501", 'PLR0912', 'PTH123', 'F405', 'E402', 'PLW0603',
'SIM102',
'TRY002', 'TRY003',
]
# Autofix
lint.fixable = [
'SIM', 'C', 'Q',
'UP035', 'UP004', 'UP032', 'UP006', 'UP007', 'I001',
'F401', 'COM812', 'B011', 'PLR1722', 'PLR0402', 'S101',
]
lint.unfixable = ['SIM102', 'SIM114']
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
# Same as Black.
line-length = 88
# Allow unused variables when underscore-prefixed.
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Assume Python 3.10.
target-version = "py310"
[lint.flake8-quotes]
inline-quotes = "single"
multiline-quotes = "double"
docstring-quotes = "double"
[format]
quote-style = "single"
indent-style = "space"
docstring-code-format = true
[lint.per-file-ignores]
"test/*" = [
"S101", # Test Asserts
"T201", # Debug prints
"PLR2004", # magic-value-comparison
'SLF001', # Allow access to private members
]

View File

@ -1,10 +1,9 @@
# WARNING # WARNING!
# # THIS IS AN AUTOGENERATED FILE!
# THIS IS AN AUTOGENERATED FILE. # MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
#
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN.
import re import re
from pathlib import Path
from setuptools import setup from setuptools import setup
@ -23,13 +22,27 @@ Python library for parsing and processing URLs of Social Media Sites.""".strip()
def parse_version_file(text: str) -> str: def parse_version_file(text: str) -> str:
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text) text = re.sub('^#.*', '', text, flags=re.MULTILINE)
match = re.match(r'^\s*__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
if match is None: if match is None:
msg = 'Malformed _version.py file!' msg = 'Malformed _version.py file!'
raise Exception(msg) raise Exception(msg)
return match.group(2) return match.group(2)
def find_python_packages() -> list[str]:
"""
Find all python packages. (Directories containing __init__.py files.)
"""
root_path = Path(PACKAGE_NAME)
packages: set[str] = set([PACKAGE_NAME])
# Search recursively
for init_file in root_path.rglob('__init__.py'):
packages.add(str(init_file.parent).replace('/', '.'))
return sorted(packages)
with open(PACKAGE_NAME + '/_version.py') as f: with open(PACKAGE_NAME + '/_version.py') as f:
version = parse_version_file(f.read()) version = parse_version_file(f.read())
@ -53,7 +66,7 @@ setup(
author='Jon Michael Aanes', author='Jon Michael Aanes',
author_email='jonjmaa@gmail.com', author_email='jonjmaa@gmail.com',
url='https://gitfub.space/Jmaa/' + PACKAGE_NAME, url='https://gitfub.space/Jmaa/' + PACKAGE_NAME,
packages=[PACKAGE_NAME], packages=find_python_packages(),
install_requires=REQUIREMENTS_MAIN, install_requires=REQUIREMENTS_MAIN,
extras_require={ extras_require={
'test': REQUIREMENTS_TEST, 'test': REQUIREMENTS_TEST,