Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-20.04

services:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v2
- name: Set variables
run: |
version=$(cat silence/__init__.py | perl -0 -ne 'print $1 if s|.*__version__ = ["'"'"'](.*?)['"'"'"]||')
version=$(cat silence/__version__.py | perl -0 -ne 'print $1 if s|.*__version__ = ["'"'"'](.*?)['"'"'"]||')
prerelease=$(if [[ "$version" == 0.* ]] ; then printf "true"; else printf "false"; fi)
echo "release_name=$version" >> $GITHUB_ENV
version=${version//./\\.}
Expand Down
26 changes: 10 additions & 16 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
Expand All @@ -15,18 +12,15 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: "Set up Python"
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build
run: uv build
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish --token
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

**/.venv
**/uv.lock

# Just In Case™
Silence-CI-Project/

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.2.1
- Added `pyproject.toml` according to PEP 518.
- Updated dependencies.
- Fixed removed 'Flask's' `JSONEncoder`.
- Removed unused dependency `cryptography`.

# 2.2.0
- Autogenerated views do not allow users to view them by a specific primary key argument, as the view might not have access to said arguments, now only GetAll is implemented.
- request body parameters now show up on silence console if the corresponding flag is true in settings.py
Expand Down
76 changes: 0 additions & 76 deletions CODE_OF_CONDUCT.md

This file was deleted.

10 changes: 0 additions & 10 deletions TO-DO.md

This file was deleted.

2 changes: 1 addition & 1 deletion bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
version = sys.argv[1]

# Write the version to __init__.py and to the top of the changelog
open("silence/__init__.py", "w").write(f'__version__ = "{version}"\n')
open("silence/__version__.py", "w").write(f'__version__ = "{version}"\n')

changelog_lines = open("CHANGELOG.md", "r").readlines()
changelog_lines[0] = f"# {version}\n"
Expand Down
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[project]
name = "Silence"
dynamic = ["version"]
description = "An educational API+Web framework."
authors = [{ name = "Agustín Borrego", email = "borrego@us.es" }]
maintainers = [{ name = "Miguel Bermudo", email = "mbermudo@us.es" }]
license = "MIT"
dependencies = [
"colorama == 0.4.6",
"Flask-Cors == 6.0.2",
"Flask == 3.1.2",
"itsdangerous == 2.2.0",
"PyMySQL ~= 1.1.2",
"pypika == 0.50.0",
"requests ~= 2.32.5",
"Werkzeug ~= 3.1.5",
]
requires-python = ">=3.9"

[project.urls]
Repository = "http://github.com/DEAL-US/Silence"

[build-system]
requires = ["hatchling>=1.18.0"]
build-backend = "hatchling.build"

[project.scripts]
silence = "silence.cli.manager:run_from_command_line"

[tool.hatch.build.targets.wheel]
packages = ["src/silence"]

[tool.hatch.version]
path = "src/silence/__version__.py"

[tool.hatch.build.targets.sdist]
exclude = ["/.github"]

[tool.hatch.envs.default]
dependencies = ["black"]

[tool.hatch.envs.default.scripts]
lint = "ruff check ."
format = "black ."

[tool.hatch.envs.lint]
detached = true
dependencies = ["black>=23.0.0", "ruff>=0.1.0"]

[tool.hatch.envs.lint.scripts]
check = "ruff check ."
format = ["black .", "ruff check --fix ."]

[tool.hatch.metadata]
allow-direct-references = true

[tool.ruff.lint.isort]
lines-after-imports = 1
47 changes: 0 additions & 47 deletions setup.py

This file was deleted.

1 change: 0 additions & 1 deletion silence/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions src/silence/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "2.2.1-dev"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 10 additions & 5 deletions silence/cli/commands/run.py → src/silence/cli/commands/run.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
from silence.logging.default_logger import logger
from silence.settings import settings
from silence.utils.check_update import check_for_new_version
from silence import __version__
from silence.__version__ import __version__


def handle(args):
from silence.server import manager as server_manager

logger.info("Silence v%s", __version__)
logger.debug("Current settings:\n%s", str(settings))

new_ver = check_for_new_version()
if new_ver:
logger.warning("A new Silence version (v%s) is available. Run 'pip install --upgrade Silence' to upgrade.", new_ver)
logger.warning("To see what's new, visit: https://github.com/DEAL-US/Silence/blob/master/CHANGELOG.md")
logger.warning(
"A new Silence version (v%s) is available. Run 'pip install --upgrade Silence' to upgrade.",
new_ver,
)
logger.warning(
"To see what's new, visit: https://github.com/DEAL-US/Silence/blob/master/CHANGELOG.md"
)

server_manager.setup()
server_manager.run()
server_manager.run()
Loading