-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add packaging config, freeze deps in requirements.
- This makes installation with pip possible. - Docker builds do use the requirements.txt file to make the builds reproducible. - freeze.py is used update the requirements.txt when the unpinned dependencies in the pyproject.toml change.
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
Pin the dependencies given in pyproject.toml. | ||
""" | ||
|
||
from venv import EnvBuilder | ||
from shutil import rmtree | ||
from subprocess import check_call | ||
from tomllib import load | ||
from os import mkdir, path, remove | ||
|
||
BUILD = "build" | ||
REQUIREMENTS = "build/requirements.txt" | ||
VENV = "build/.venv" | ||
|
||
try: | ||
try: | ||
mkdir(BUILD, mode=0o750) | ||
except FileExistsError: | ||
pass | ||
try: | ||
mkdir(VENV, mode=0o750) | ||
except FileExistsError: | ||
pass | ||
|
||
EnvBuilder().create(VENV) | ||
with open("pyproject.toml", "rb") as project: | ||
pyproject = load(project) | ||
with open(REQUIREMENTS, "w") as requirements: | ||
requirements.write("\n".join(pyproject["project"]["dependencies"])) | ||
check_call([VENV + "/bin/python", "-m", "ensurepip"]) | ||
check_call([VENV + "/bin/pip3", "install", "-r", REQUIREMENTS]) | ||
with open("requirements.txt", "w") as requirements: | ||
check_call([VENV + "/bin/pip3", "freeze", "-r", REQUIREMENTS], | ||
stdout=requirements) | ||
finally: | ||
if path.isdir(VENV): | ||
rmtree(VENV) | ||
if path.exists(REQUIREMENTS): | ||
remove(REQUIREMENTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[build-system] | ||
requires = ["setuptools >= 61.0", "setuptools-scm"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "devicepasswords" | ||
authors = [ | ||
{name = "Varbin the Fox"} | ||
] | ||
description = "Simple device password management to replace regular password for systems not capable of single sign-on. " | ||
readme = "README.md" | ||
requires-python = ">=3.11" | ||
keywords = ["python", "docker", "flask", "oidc", "single-sign-on", "devicepassword"] | ||
license = {text = "MPL-2.0"} | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Framework :: Flask", | ||
"Framework :: aiohttp", | ||
"Intended Audience :: System Administrators", | ||
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application", | ||
"Topic :: Security", | ||
"Topic :: System :: Systems Administration :: Authentication/Directory", | ||
] | ||
dependencies = [ | ||
"flask >= 3.0.0", | ||
"flask-sqlalchemy", | ||
"flask-alembic", | ||
"python-jose[cryptography]", | ||
"requests", | ||
"gevent>1.4", | ||
"flask-session", | ||
# Password hashing | ||
"passlib", | ||
"argon2-cffi", | ||
# Database drivers | ||
"psycopg2-binary", | ||
"pymysql", | ||
"pymssql", | ||
# Server for production | ||
"gunicorn", | ||
] | ||
dynamic = ["version"] | ||
|
||
[tool.setuptools] | ||
packages = ["devicepasswords"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
""" | ||
Setup script for the devicepasswords application. | ||
With modern packaging tools, | ||
this file is not really required anymore. | ||
""" | ||
|
||
from setuptools import setup | ||
|
||
setup() |