Skip to content

Commit

Permalink
Copy dependencies to requirements.txt in pre commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-astus committed Mar 13, 2024
1 parent 3908897 commit cebc419
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ repos:
pass_filenames: true
files: ^src/.*\.py$
exclude: ^src/snowflake/cli/app/telemetry.py$
- id: dependencies-sync
name: "Copy dependencies from pyproject.toml to requirements.txt"
language: system
entry: python .snyk/dependency-sync.py
files: ^pyproject.toml$
19 changes: 19 additions & 0 deletions .snyk/dependency-sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from pathlib import Path

import tomllib


def sync():
pyproject = tomllib.loads(Path("pyproject.toml").read_text())
dependencies = pyproject["project"]["dependencies"]
dev_dependencies = pyproject["project"]["optional-dependencies"]["development"]
with open(".snyk/req-auto-generated.txt", "w") as req:
req.write("# Auto generated\n")
for dep in dependencies:
req.write(f"{dep}\n")
for dep in dev_dependencies:
req.write(f"{dep}\n")


if __name__ == "__main__":
sync()
20 changes: 20 additions & 0 deletions .snyk/req-auto-generated.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Auto generated
jinja2==3.1.3
pluggy==1.4.0
PyYAML==6.0.1
rich==13.7.1
requests==2.31.0
requirements-parser==0.5.0
setuptools==69.1.1
snowflake-connector-python[secure-local-storage]==3.7.1
strictyaml==1.7.3
tomlkit==0.12.3
typer==0.9.0
urllib3>=1.21.1,<2.3
GitPython==3.1.42
pydantic==2.6.3
coverage==7.4.3
pre-commit>=3.5.0
pytest==8.1.1
pytest-randomly==3.15.0
syrupy==4.6.1
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ requires-python = ">=3.8"
description = "Snowflake CLI"
readme = "README.md"
dependencies = [
"coverage==7.4.3",
"jinja2==3.1.3",
"pluggy==1.4.0",
"PyYAML==6.0.1",
Expand Down

0 comments on commit cebc419

Please sign in to comment.