Skip to content

Commit

Permalink
Refinements
Browse files Browse the repository at this point in the history
- Automatic dependency detection
- Better readme
  • Loading branch information
rsyring committed Jun 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent b4f9bbd commit 9fdd228
Showing 38 changed files with 789 additions and 560 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -61,4 +61,3 @@ jobs:
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
*.coverage
/.tox
/.nonx
/coverage.xml
/coverage*.xml
/.pytests.xml
/htmlcov
.pytest_cache
@@ -19,3 +19,5 @@

# Project builds
dist

src/reqs/tests/pkg*/requirements/*.txt
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ repos:
- id: check-added-large-files
- id: check-yaml
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.4
rev: v0.4.8
hooks:
# i.e. `ruff check`
- id: ruff
@@ -25,6 +25,6 @@ repos:
# the linting check above would always catch a problem created by the formatter.
args: [ --check ]
- repo: https://github.com/level12/pre-commit-hooks
rev: v0.20240516.2
rev: v0.20240606.1
hooks:
- id: check-ruff-versions
12 changes: 0 additions & 12 deletions ci/pytest.ini

This file was deleted.

4 changes: 4 additions & 0 deletions env-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
profile:
pypi:
HATCH_INDEX_USER: '__TOKEN__'
HATCH_INDEX_AUTH: 'op://private/pypi.python.org/api-token'
9 changes: 3 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -11,13 +11,11 @@


@nox.session
def tests(session: nox.Session):
session.install('-r', 'requirements/base.txt')
session.install('e', '.')
def pytest(session: nox.Session):
session.install('-r', 'requirements/testing.txt')
session.install('-e', '.')
session.run(
'pytest',
# use our pytest.ini for warning management
'-c=ci/pytest.ini',
'-ra',
'--tb=native',
'--strict-markers',
@@ -37,6 +35,5 @@ def standards(session: nox.Session):
session.run(
'pre-commit',
'run',
'--show-diff-on-failure',
'--all-files',
)
32 changes: 16 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
reqs
====

Bootstrap, compile, and sync Python requirements files
Helps with Python requirements (reqs) files:

# Install

Intended to be used with pipx
- `reqs bootstrap`:
- Install uv (default) or upgrade pip & install pip-tools to active venv
- Ensures reqs will compile lock files using the version of Python the project is using
- `reqs compile`:
- Compile .in reqs files into .txt "lock" files
- Considers file modification times and file dependencies (when -r or -c used)
- `reqs sync`:
- Compile (default, optional)
- Sync active virtualenv with lock files
- When "sync_pipx" is true: will make the project's scripts available on the local system by
installing/upgrading as an editable package with pipx.

- manually & first install: `pipx install -e .../apps/reqs-pkg`; or
- when developing: `cd .../apps/reqs-pkg;` [`reqs`](../reqs-pkg/) `sync`

# Install

## Usage
Intended to be installed at the user level, not per app.

- `reqs bootstrap`: Upgrade pip & install pip-tools
- `reqs compile`: Compile .in to .txt when needed (based on file modification times)
- `reqs sync`: Compile and then update active venv and maybe pipx to match spec
- `pipx install reqs-cli` (recommended)
- `[uv] pip install --user reqs-cli`


# Configuration
@@ -35,10 +41,4 @@ dpath = 'requirements'
# that a developer would want available for different projects. False for most client projects
# deployed on servers.
sync_pipx = false

[tool.reqs.depends]
# Define dependencies between files so `reqs compile` knows when a .in needs to be compiled and
# what order to use when compiling multiple files.
'base.in' = ''
'dev.in' = 'base.txt'
```
8 changes: 2 additions & 6 deletions requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# From copier-py-package (keep comment for easier copier upgrades)
pytest
pytest-cov

# App specific (ditto)
# App specific
click
pip-tools
pip-requirements-parser
112 changes: 9 additions & 103 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,110 +1,16 @@
build==1.2.1 \
--hash=sha256:526263f4870c26f26c433545579475377b2b7588b6f1eac76a001e873ae3e19d \
--hash=sha256:75e10f767a433d9a86e50d83f418e83efc18ede923ee5ff7df93b6cb0306c5d4
# via pip-tools
click==8.1.7 \
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
# via
# -r requirements/base.in
# pip-tools
coverage==7.5.1 \
--hash=sha256:0646599e9b139988b63704d704af8e8df7fa4cbc4a1f33df69d97f36cb0a38de \
--hash=sha256:0cdcbc320b14c3e5877ee79e649677cb7d89ef588852e9583e6b24c2e5072661 \
--hash=sha256:0d0a0f5e06881ecedfe6f3dd2f56dcb057b6dbeb3327fd32d4b12854df36bf26 \
--hash=sha256:1434e088b41594baa71188a17533083eabf5609e8e72f16ce8c186001e6b8c41 \
--hash=sha256:16db7f26000a07efcf6aea00316f6ac57e7d9a96501e990a36f40c965ec7a95d \
--hash=sha256:1cc0fe9b0b3a8364093c53b0b4c0c2dd4bb23acbec4c9240b5f284095ccf7981 \
--hash=sha256:1fc81d5878cd6274ce971e0a3a18a8803c3fe25457165314271cf78e3aae3aa2 \
--hash=sha256:2ec92012fefebee89a6b9c79bc39051a6cb3891d562b9270ab10ecfdadbc0c34 \
--hash=sha256:39afcd3d4339329c5f58de48a52f6e4e50f6578dd6099961cf22228feb25f38f \
--hash=sha256:4a7b0ceee8147444347da6a66be737c9d78f3353b0681715b668b72e79203e4a \
--hash=sha256:4a9ca3f2fae0088c3c71d743d85404cec8df9be818a005ea065495bedc33da35 \
--hash=sha256:4bf0655ab60d754491004a5efd7f9cccefcc1081a74c9ef2da4735d6ee4a6223 \
--hash=sha256:4cc37def103a2725bc672f84bd939a6fe4522310503207aae4d56351644682f1 \
--hash=sha256:4fc84a37bfd98db31beae3c2748811a3fa72bf2007ff7902f68746d9757f3746 \
--hash=sha256:5037f8fcc2a95b1f0e80585bd9d1ec31068a9bcb157d9750a172836e98bc7a90 \
--hash=sha256:54de9ef3a9da981f7af93eafde4ede199e0846cd819eb27c88e2b712aae9708c \
--hash=sha256:556cf1a7cbc8028cb60e1ff0be806be2eded2daf8129b8811c63e2b9a6c43bca \
--hash=sha256:57e0204b5b745594e5bc14b9b50006da722827f0b8c776949f1135677e88d0b8 \
--hash=sha256:5a5740d1fb60ddf268a3811bcd353de34eb56dc24e8f52a7f05ee513b2d4f596 \
--hash=sha256:5c3721c2c9e4c4953a41a26c14f4cef64330392a6d2d675c8b1db3b645e31f0e \
--hash=sha256:5fa567e99765fe98f4e7d7394ce623e794d7cabb170f2ca2ac5a4174437e90dd \
--hash=sha256:5fd215c0c7d7aab005221608a3c2b46f58c0285a819565887ee0b718c052aa4e \
--hash=sha256:6175d1a0559986c6ee3f7fccfc4a90ecd12ba0a383dcc2da30c2b9918d67d8a3 \
--hash=sha256:61c4bf1ba021817de12b813338c9be9f0ad5b1e781b9b340a6d29fc13e7c1b5e \
--hash=sha256:6537e7c10cc47c595828b8a8be04c72144725c383c4702703ff4e42e44577312 \
--hash=sha256:68f962d9b72ce69ea8621f57551b2fa9c70509af757ee3b8105d4f51b92b41a7 \
--hash=sha256:7352b9161b33fd0b643ccd1f21f3a3908daaddf414f1c6cb9d3a2fd618bf2572 \
--hash=sha256:796a79f63eca8814ca3317a1ea443645c9ff0d18b188de470ed7ccd45ae79428 \
--hash=sha256:79afb6197e2f7f60c4824dd4b2d4c2ec5801ceb6ba9ce5d2c3080e5660d51a4f \
--hash=sha256:7a588d39e0925f6a2bff87154752481273cdb1736270642aeb3635cb9b4cad07 \
--hash=sha256:8748731ad392d736cc9ccac03c9845b13bb07d020a33423fa5b3a36521ac6e4e \
--hash=sha256:8fe7502616b67b234482c3ce276ff26f39ffe88adca2acf0261df4b8454668b4 \
--hash=sha256:9314d5678dcc665330df5b69c1e726a0e49b27df0461c08ca12674bcc19ef136 \
--hash=sha256:9735317685ba6ec7e3754798c8871c2f49aa5e687cc794a0b1d284b2389d1bd5 \
--hash=sha256:9981706d300c18d8b220995ad22627647be11a4276721c10911e0e9fa44c83e8 \
--hash=sha256:9e78295f4144f9dacfed4f92935fbe1780021247c2fabf73a819b17f0ccfff8d \
--hash=sha256:b016ea6b959d3b9556cb401c55a37547135a587db0115635a443b2ce8f1c7228 \
--hash=sha256:b6cf3764c030e5338e7f61f95bd21147963cf6aa16e09d2f74f1fa52013c1206 \
--hash=sha256:beccf7b8a10b09c4ae543582c1319c6df47d78fd732f854ac68d518ee1fb97fa \
--hash=sha256:c0884920835a033b78d1c73b6d3bbcda8161a900f38a488829a83982925f6c2e \
--hash=sha256:c3e757949f268364b96ca894b4c342b41dc6f8f8b66c37878aacef5930db61be \
--hash=sha256:ca498687ca46a62ae590253fba634a1fe9836bc56f626852fb2720f334c9e4e5 \
--hash=sha256:d1d0d98d95dd18fe29dc66808e1accf59f037d5716f86a501fc0256455219668 \
--hash=sha256:d21918e9ef11edf36764b93101e2ae8cc82aa5efdc7c5a4e9c6c35a48496d601 \
--hash=sha256:d7fed867ee50edf1a0b4a11e8e5d0895150e572af1cd6d315d557758bfa9c057 \
--hash=sha256:db66fc317a046556a96b453a58eced5024af4582a8dbdc0c23ca4dbc0d5b3146 \
--hash=sha256:dde0070c40ea8bb3641e811c1cfbf18e265d024deff6de52c5950677a8fb1e0f \
--hash=sha256:df4e745a81c110e7446b1cc8131bf986157770fa405fe90e15e850aaf7619bc8 \
--hash=sha256:e2213def81a50519d7cc56ed643c9e93e0247f5bbe0d1247d15fa520814a7cd7 \
--hash=sha256:ef48e2707fb320c8f139424a596f5b69955a85b178f15af261bab871873bb987 \
--hash=sha256:f152cbf5b88aaeb836127d920dd0f5e7edff5a66f10c079157306c4343d86c19 \
--hash=sha256:fc0b4d8bfeabd25ea75e94632f5b6e047eef8adaed0c2161ada1e922e7f7cece
# via pytest-cov
iniconfig==2.0.0 \
--hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \
--hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374
# via pytest
# via -r requirements/base.in
packaging==24.0 \
--hash=sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5 \
--hash=sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9
# via
# build
# pytest
pip==24.0 \
--hash=sha256:ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc \
--hash=sha256:ea9bd1a847e8c5774a5777bb398c19e80bcd4e2aa16a4b301b718fe6f593aba2
# via pip-tools
pip-tools==7.4.1 \
--hash=sha256:4c690e5fbae2f21e87843e89c26191f0d9454f362d8acdbd695716493ec8b3a9 \
--hash=sha256:864826f5073864450e24dbeeb85ce3920cdfb09848a3d69ebf537b521f14bcc9
# via -r requirements/base.in
pluggy==1.5.0 \
--hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \
--hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669
# via pytest
pyproject-hooks==1.1.0 \
--hash=sha256:4b37730834edbd6bd37f26ece6b44802fb1c1ee2ece0e54ddff8bfc06db86965 \
--hash=sha256:7ceeefe9aec63a1064c18d939bdc3adf2d8aa1988a510afec15151578b232aa2
# via
# build
# pip-tools
pytest==8.2.0 \
--hash=sha256:1733f0620f6cda4095bbf0d9ff8022486e91892245bb9e7d5542c018f612f233 \
--hash=sha256:d507d4482197eac0ba2bae2e9babf0672eb333017bcedaa5fb1a3d42c1174b3f
# via
# -r requirements/base.in
# pytest-cov
pytest-cov==5.0.0 \
--hash=sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652 \
--hash=sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857
# via pip-requirements-parser
pip-requirements-parser==32.0.1 \
--hash=sha256:4659bc2a667783e7a15d190f6fccf8b2486685b6dba4c19c3876314769c57526 \
--hash=sha256:b4fa3a7a0be38243123cf9d1f3518da10c51bdb165a2b2985566247f9155a7d3
# via -r requirements/base.in
setuptools==69.5.1 \
--hash=sha256:6c1fccdac05a97e598fb0ae3bbed5904ccb317337a51139dcd51453611bbb987 \
--hash=sha256:c636ac361bc47580504644275c9ad802c50415c7522212252c033bd15f301f32
# via pip-tools
wheel==0.43.0 \
--hash=sha256:465ef92c69fa5c5da2d1cf8ac40559a8c940886afcef87dcf14b9470862f1d85 \
--hash=sha256:55c570405f142630c6b9f72fe09d9b67cf1477fcf543ae5b8dcb1f5b7377da81
# via pip-tools
pyparsing==3.1.2 \
--hash=sha256:a1bac0ce561155ecc3ed78ca94d3c9378656ad4c94c1270de543f621420f94ad \
--hash=sha256:f9db75911801ed778fe61bb643079ff86601aca99fcae6345aa67292038fb742
# via pip-requirements-parser
36 changes: 18 additions & 18 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -40,24 +40,24 @@ platformdirs==4.2.2 \
# via
# -c requirements/dev.txt
# virtualenv
uv==0.1.44 \
--hash=sha256:012fcfc3789f303ee3ff9f2a6e09bc589710fed7c2dcbad4379832072bad7a95 \
--hash=sha256:05774eb086b18aad488c3140daa62a235e3f270f62bd3cc4aaaa54eed927cc5b \
--hash=sha256:26d07edb37e7bfddc3b4e1faa13420e6048ddd974b34fbc1c19fcf9bacef9e5b \
--hash=sha256:2e5a60af214f42b621aa37ad320253c64f77dbfacafa710dc42d34965c2cd27f \
--hash=sha256:2f95acffcdac507de9c8f8ed037e529df3ccea274b4453df05df3f331543f5fc \
--hash=sha256:3eeac3d8be69831430743f3d00f84ddccfbd56b6835bb52d17f97914c9adfdff \
--hash=sha256:567486ce0ad2f9778782ba6ee19d2b65516c4f4bf2b7b4fc66fc2712cd46c6d0 \
--hash=sha256:768369a0bbdea8c3a670388ec1b4a11fe5871ef40d84a43844e9b8d97a1c2ca5 \
--hash=sha256:7983b00d95290dcdea8488fa8ecdfdef5c8e7d3c92c90b8dcf405cc26b707add \
--hash=sha256:8f90e80e11da409ce88424381f5c91e7f908d6a7eec53ed4ae60c5d76698d126 \
--hash=sha256:9ef3448111b47ab95874fbf2c5ca8efd52f54de14086079e52b588d037d243f1 \
--hash=sha256:b04eb0c8dedadfe434f9756bdc1c8a09a75df83884ba4cc7d97985ee819e4f32 \
--hash=sha256:b076828cef1f1ae1c3b54fa97b9e16b32816acc521ca6ff4a54fd8b16df67eef \
--hash=sha256:d60e5b77b958c559324882da13ffa642dcd511e6a7eb9b07e7308a6d71e248de \
--hash=sha256:d82c7338f8bcb0551672e759e4115c035246321059692416ee03ebe08629b913 \
--hash=sha256:e247dca0d8d42d71032ac99ef3d72a4fcbad4ae3114ef5979878a81a40fed274 \
--hash=sha256:e8cb1047b8f81ef09e15ec8d1b8dfc371594232e2e4f3ef3acf8991fcda20a57
uv==0.2.9 \
--hash=sha256:1942808d1df3fab9482c5ab47484a7a5eb75aacea9b27c2cbbfb60cb826f4c56 \
--hash=sha256:22deea3d7f83845a54503d1c2d5ff49d28cff109123df415be4496cf1c851b2e \
--hash=sha256:23cf2e847a0e02e2ddc938c164dbec4878583c61fabb0a1134d00fc9ebf92076 \
--hash=sha256:290c23ed4d2a16500c685e347326c2137931350f7148e41bb04941a9d90e2d45 \
--hash=sha256:326d88b12745558eb2b49968c03e088ccab3a8860a7962ee3a0fcfc1289fdb41 \
--hash=sha256:361368cd38c0d5595374bc22c4733d8c2252c00649158f2168f894a098823c5e \
--hash=sha256:3a9914fab493978eed5781b3fc13126836472f1a91f1092c07d825150405a42a \
--hash=sha256:5b0c27f12ec91e8ee6066fd8ee0b3405a791350e8898cdfa99177048c3b364a6 \
--hash=sha256:6251f4d7d77d29aab625b02a93160ede1ba9edd766918da5064552219561e245 \
--hash=sha256:692fed655d5cbb457fa2762085bb49f9a74a13ad1608ebfa9b1bd81ed09bdaee \
--hash=sha256:6b5f4f612c3f2008314fcd2415a1d0c22050d87324476aa8907695723c72483b \
--hash=sha256:718d3e5e46084c7c6305a20789e27eeea2171a85ef3af37b33324a30b04dedc8 \
--hash=sha256:8a345a0e4d5b4a31297bb5aea9ef5dd84d91faff1dcb7939e263d4e7b344ae15 \
--hash=sha256:8ccb4e20606a1cd710573c63b0d79c9ae7d3fbb97d7962efb05344d9b9c83f6b \
--hash=sha256:92e0af80ab5c40bed88064ff1adc95f587c501ed8371077330703edfafe78661 \
--hash=sha256:c4d6914fd31213512e75d57ece4efed443aec669fd23ed83c098530a3bf7f39f \
--hash=sha256:e63daf67b3e6922a58b571a5cf63605e737cb2f34b48973014cc0fd4e8528ecd
# via
# -c requirements/dev.txt
# nox
3 changes: 1 addition & 2 deletions requirements/dev.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
-r base.txt
-r testing.txt

# From copier-py-package (keep comment for easier copier upgrades)
click
hatch
nox[uv]
pre-commit
Loading

0 comments on commit 9fdd228

Please sign in to comment.