Skip to content

Commit

Permalink
🐛 dependency_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
juftin committed Dec 20, 2023
1 parent 0f2bdac commit 1f97aea
Show file tree
Hide file tree
Showing 16 changed files with 497 additions and 156 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: 0 12 1 * *
jobs:
test-suite:
python-version-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand All @@ -31,7 +31,7 @@ jobs:
- { name: Python 3.9, python: "3.9" }
- { name: Python 3.8, python: "3.8" }
concurrency:
group: ${{ github.workflow }}-${{ matrix.python }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ matrix.python }}-${{ github.ref }}-${{ github.job }}
cancel-in-progress: true
steps:
- name: Set up Github Workspace
Expand All @@ -58,3 +58,23 @@ jobs:
echo "::add-matcher::.github/workflows/matchers/python.json"
hatch run +py=${{ matrix.python }} matrix:cov
echo "::remove-matcher owner=python::"
hatch-version-tests:
runs-on: ubuntu-latest
steps:
- name: Set up Github Workspace
uses: actions/checkout@v4
- name: Set up Python Environment 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Hatch
run: |
python -m pip install --upgrade pip wheel
python -m pip install -q hatch pre-commit
python -m pip install -q "${{ github.workspace }}"
hatch --version
- name: Test Suite
run: |
echo "::add-matcher::.github/workflows/matchers/python.json"
hatch run versions:cov
echo "::remove-matcher owner=python::"
8 changes: 8 additions & 0 deletions hatch_pip_compile/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ def get_option_types() -> Dict[str, Any]:
"pip-compile-install-args": List[str],
}

def dependency_hash(self) -> str:
"""
Get the dependency hash
"""
if not self.lockfile_up_to_date:
self.sync_dependencies()
return super().dependency_hash()

def install_pip_tools(self) -> None:
"""
Install pip-tools (if not already installed)
Expand Down
27 changes: 25 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy"
]
dependencies = [
"hatch"
"hatch>=1.7.0"
]
description = "hatch plugin to use pip-compile to manage project dependencies"
dynamic = ["version"]
Expand Down Expand Up @@ -127,7 +127,30 @@ dependencies = [

[tool.hatch.envs.test.scripts]
cov = [
"pytest --cov-config=pyproject.toml --cov {args:tests}"
"pytest --cov-config=pyproject.toml --cov {args: tests/ -v}"
]

[tool.hatch.envs.versions]
dependencies = []
pip-compile-constraint = ""
template = "test"
type = "pip-compile"

[[tool.hatch.envs.versions.matrix]]
version = [
"1.7.x",
"1.8.x",
"1.9.x"
]

[tool.hatch.envs.versions.overrides]
matrix.version.dependencies = [
"pytest",
"pytest-cov",
"tomlkit",
{value = "hatch~=1.7.0", if = ["1.7.x"]},
{value = "hatch~=1.8.0", if = ["1.8.x"]},
{value = "hatch~=1.9.0", if = ["1.9.x"]}
]

[tool.hatch.version]
Expand Down
28 changes: 8 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
#
# This file is autogenerated by hatch-pip-compile with Python 3.11
#
# - hatch
# - hatch>=1.7.0
#

anyio==4.1.0
anyio==4.2.0
# via httpx
certifi==2023.11.17
# via
# httpcore
# httpx
cffi==1.16.0
# via cryptography
click==8.1.7
# via
# hatch
# userpath
cryptography==41.0.7
# via secretstorage
distlib==0.3.7
distlib==0.3.8
# via virtualenv
editables==0.5
# via hatchling
filelock==3.13.1
# via virtualenv
h11==0.14.0
# via httpcore
hatch==1.7.0
hatch==1.9.0
# via hatch.envs.default
hatchling==1.18.0
hatchling==1.21.0
# via hatch
httpcore==1.0.2
# via httpx
Expand All @@ -45,10 +41,6 @@ importlib-metadata==7.0.0
# via keyring
jaraco-classes==3.3.0
# via keyring
jeepney==0.8.0
# via
# keyring
# secretstorage
keyring==24.3.0
# via hatch
markdown-it-py==3.0.0
Expand All @@ -61,7 +53,7 @@ packaging==23.2
# via
# hatch
# hatchling
pathspec==0.11.2
pathspec==0.12.1
# via hatchling
pexpect==4.9.0
# via hatch
Expand All @@ -73,16 +65,10 @@ pluggy==1.3.0
# via hatchling
ptyprocess==0.7.0
# via pexpect
pycparser==2.21
# via cffi
pygments==2.17.2
# via rich
pyperclip==1.8.2
# via hatch
rich==13.7.0
# via hatch
secretstorage==3.3.3
# via keyring
shellingham==1.5.4
# via hatch
sniffio==1.3.0
Expand All @@ -101,3 +87,5 @@ virtualenv==20.25.0
# via hatch
zipp==3.17.0
# via importlib-metadata
zstandard==0.22.0
# via hatch
49 changes: 14 additions & 35 deletions requirements/requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# This file is autogenerated by hatch-pip-compile with Python 3.11
#
# [constraints] requirements.txt (SHA256: 9dc610f2c50b92a04dc522873ebc8dd69d35bf8ce9feeef14c5341e8e4ef3019)
# [constraints] requirements.txt (SHA256: 7b84213e35a035caf05934f59f047bf3d12cf93d8623fa26893a37d9c4a2a552)
#
# - markdown-callouts
# - markdown-exec
Expand All @@ -13,25 +13,21 @@
# - mkdocstrings
# - mkdocstrings-python
# - pymdown-extensions
# - hatch
# - hatch>=1.7.0
#

anyio==4.1.0
anyio==4.2.0
# via
# -c requirements.txt
# httpx
babel==2.13.1
babel==2.14.0
# via mkdocs-material
certifi==2023.11.17
# via
# -c requirements.txt
# httpcore
# httpx
# requests
cffi==1.16.0
# via
# -c requirements.txt
# cryptography
charset-normalizer==3.3.2
# via requests
click==8.1.7
Expand All @@ -45,11 +41,7 @@ colorama==0.4.6
# via
# griffe
# mkdocs-material
cryptography==41.0.7
# via
# -c requirements.txt
# secretstorage
distlib==0.3.7
distlib==0.3.8
# via
# -c requirements.txt
# virtualenv
Expand All @@ -63,17 +55,17 @@ filelock==3.13.1
# virtualenv
ghp-import==2.1.0
# via mkdocs
griffe==0.38.0
griffe==0.38.1
# via mkdocstrings-python
h11==0.14.0
# via
# -c requirements.txt
# httpcore
hatch==1.7.0
hatch==1.9.0
# via
# -c requirements.txt
# hatch.envs.docs
hatchling==1.18.0
hatchling==1.21.0
# via
# -c requirements.txt
# hatch
Expand Down Expand Up @@ -104,11 +96,6 @@ jaraco-classes==3.3.0
# via
# -c requirements.txt
# keyring
jeepney==0.8.0
# via
# -c requirements.txt
# keyring
# secretstorage
jinja2==3.1.2
# via
# mkdocs
Expand Down Expand Up @@ -160,7 +147,7 @@ mkdocs-gen-files==0.5.0
# via hatch.envs.docs
mkdocs-literate-nav==0.6.1
# via hatch.envs.docs
mkdocs-material==9.4.14
mkdocs-material==9.5.2
# via hatch.envs.docs
mkdocs-material-extensions==1.3.1
# via mkdocs-material
Expand All @@ -184,7 +171,7 @@ packaging==23.2
# mkdocs
paginate==0.5.6
# via mkdocs-material
pathspec==0.11.2
pathspec==0.12.1
# via
# -c requirements.txt
# hatchling
Expand All @@ -208,10 +195,6 @@ ptyprocess==0.7.0
# via
# -c requirements.txt
# pexpect
pycparser==2.21
# via
# -c requirements.txt
# cffi
pygments==2.17.2
# via
# -c requirements.txt
Expand All @@ -223,10 +206,6 @@ pymdown-extensions==10.5
# markdown-exec
# mkdocs-material
# mkdocstrings
pyperclip==1.8.2
# via
# -c requirements.txt
# hatch
python-dateutil==2.8.2
# via ghp-import
pyyaml==6.0.1
Expand All @@ -244,10 +223,6 @@ rich==13.7.0
# via
# -c requirements.txt
# hatch
secretstorage==3.3.3
# via
# -c requirements.txt
# keyring
shellingham==1.5.4
# via
# -c requirements.txt
Expand Down Expand Up @@ -287,3 +262,7 @@ zipp==3.17.0
# via
# -c requirements.txt
# importlib-metadata
zstandard==0.22.0
# via
# -c requirements.txt
# hatch
4 changes: 2 additions & 2 deletions requirements/requirements-lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mypy==1.7.1
# via hatch.envs.lint
mypy-extensions==1.0.0
# via mypy
ruff==0.1.6
ruff==0.1.8
# via hatch.envs.lint
typing-extensions==4.8.0
typing-extensions==4.9.0
# via mypy
Loading

0 comments on commit 1f97aea

Please sign in to comment.