Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Joaopeuko committed Apr 27, 2024
1 parent b6ea2b7 commit ec89d58
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 22 deletions.
9 changes: 6 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--end-of-line', 'lf', '--mixed-line-ending']

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.7
hooks:
- id: ruff
args: ['--check-all', '--verbose']
args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
args: ['--ignore-missing-imports', '--strict']

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args: ['--single-quote', '--trailing-comma', 'all']

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ['--ignore-words-list', '--check-hidden', '--quiet']
language: python
15 changes: 13 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
pyyaml = "^6.0.1"


[tool.poetry.group.dev.dependencies]
pre-commit = "^3.7.0"
python-dotenv = "^1.0.1"
tomlkit = "^0.12.4"

[build-system]
requires = ["poetry-core"]
Expand Down
2 changes: 1 addition & 1 deletion secured/attribute.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, TypeVar, Union
from typing import Any, TypeVar
from .secure import Secure

# A type variable that can be any type.
Expand Down
34 changes: 19 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
import tomlkit
from setuptools import setup, find_packages
import toml

# Load and parse the pyproject.toml file
with open("pyproject.toml", "r") as f:
pyproject = toml.load(f)
# Read and parse the pyproject.toml file
with open("pyproject.toml", "r") as toml_file:
pyproject = tomlkit.parse(toml_file.read())

# Extract dependencies
dependencies = pyproject['tool']['poetry']['dependencies']
dev_dependencies = pyproject['tool']['poetry']['group']['dev']['dependencies']
def convert_version(poetry_version):
""" Convert Poetry version specifier to setuptools specifier. """
if poetry_version.startswith('^'):
version = poetry_version[1:]
major_version = version.split('.')[0]
next_major_version = str(int(major_version) + 1)
return f">={version},<{next_major_version}.0.0"
return poetry_version

# Extract dependencies and convert versions
dependencies = [
f"{pkg}{convert_version(ver)}" for pkg, ver in pyproject['tool']['poetry']['dependencies'].items()
if pkg != "python"
]

# Read README.md for the long description
with open("README.md", "r") as file:
long_description = file.read()

# Convert dependencies to the required format for setuptools
install_requires = [f"{dep}{version}" for dep, version in dependencies.items() if dep != "python"]
extras_require = {
"dev": [f"{dep}{version}" for dep, version in dev_dependencies.items()]
}

setup(
name="secured",
version=pyproject['tool']['poetry']['version'],
Expand All @@ -34,6 +39,5 @@
"Operating System :: OS Independent",
],
python_requires=">=3.8",
install_requires=install_requires,
extras_require=extras_require
install_requires=dependencies
)

0 comments on commit ec89d58

Please sign in to comment.