From c2889fdd061cb77812892fda07b72d0b03850632 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 13:36:28 +1200 Subject: [PATCH 01/18] Init package, add pytest, GitHub actions config Some documation about the need for introspection when working on this. --- .github/workflows/ci.yml | 34 ++++++++++++++++++ .python-version | 1 + README.md | 7 +++- doc/philosophy/introspection.md | 53 ++++++++++++++++++++++++++++ pyproject.toml | 13 +++++++ src/usethis/__init__.py | 2 ++ tests/test_nothing.py | 2 ++ uv.lock | 61 +++++++++++++++++++++++++++++++++ 8 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .python-version create mode 100644 doc/philosophy/introspection.md create mode 100644 pyproject.toml create mode 100644 src/usethis/__init__.py create mode 100644 tests/test_nothing.py create mode 100644 uv.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..d102fe84 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI +on: + workflow_dispatch: + push: + branches: ['main', 'develop'] + pull_request: +jobs: + tests: + runs-on: ${{ matrix.os }} + steps: + - name: Setup uv and Handle Its Cache + uses: hynek/setup-cached-uv@v2.0.0 + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Create Python virtualenv + run: uv venv + + - name: Activate Python virtualenv + uses: knicknic/os-specific-run@v1 + with: + linux: source venv/bin/activate + macos: source venv/bin/activate + windows: .\venv\Scripts\active + + - name: Install dependencies + run: uv sync + + - name: Run pytest + uses: pavelzw/pytest-action@v2.2.0 + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] diff --git a/.python-version b/.python-version new file mode 100644 index 00000000..d9506ceb --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12.5 diff --git a/README.md b/README.md index 49182922..f6115b54 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ -# usethis-python +# usethis + Automate Python package and project setup tasks that are otherwise performed manually. + +## Development + +[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv) diff --git a/doc/philosophy/introspection.md b/doc/philosophy/introspection.md new file mode 100644 index 00000000..c1a5655c --- /dev/null +++ b/doc/philosophy/introspection.md @@ -0,0 +1,53 @@ +# Introspection when developing + +Nathan McDougall, August 2024. + +When developing, so many of our actions are reflexive. If you are interesting in +developing usethis, then it is very valuable to slow down, and consider thoroughly +which actions you are undertaking. Some of them might be running off-the-shelf automated +tools. Sometimes you might be setting up bespoke configuration for those tools. +Other times, you might have to do something manually. + +These are all useful points to note down and can provide a lot of insight into potential +features for usethis (besides just being useful documentation). + +For example, when developing usethis, here are a list of actions that I undertook: + +## Toolset decisions + +- Use GitHub Actions for CI +- Use uv for package management + +## Repo configuration + +- Created a repo on GitHub wih template .gitignore, MIT license and README. +- Created a develop branch +- Set up sensible rulesets for branches. +- Created a template for GitHub issues that are development tasks + +## Set up tests + +- Ran `uv init --name usethis` +- Ran `uv python pin 3.12.5` +- Ran `uv add pytest` +- Created a tests folder +- Added a trivial test module `test_nothing.py` +- Add a trivial test `test_pass` to the test module +- Confirm pytest is working with `pytest tests` in the CLI. +- Create a GitHub workflow file for CI manually in `.github/workflows/ci.yml` +- Use the following configuration to support GitFlow-style branch management: + +```yml +name: CI +on: + workflow_dispatch: + push: + branches: ['main', 'develop'] + pull_request: +``` + +- Add to set up uv in CI +- Add +- Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS. +- Set up logic to create a venv, activate it, and sync with lockfile. +- Add to set up pytest in CI. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..653f2b71 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,13 @@ +[project] +name = "usethis" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.11" +dependencies = [ + "pytest>=8.3.2", +] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" diff --git a/src/usethis/__init__.py b/src/usethis/__init__.py new file mode 100644 index 00000000..f17db583 --- /dev/null +++ b/src/usethis/__init__.py @@ -0,0 +1,2 @@ +def hello() -> str: + return "Hello from usethis!" diff --git a/tests/test_nothing.py b/tests/test_nothing.py new file mode 100644 index 00000000..a8a8219c --- /dev/null +++ b/tests/test_nothing.py @@ -0,0 +1,2 @@ +def test_pass(): + pass diff --git a/uv.lock b/uv.lock new file mode 100644 index 00000000..e142f759 --- /dev/null +++ b/uv.lock @@ -0,0 +1,61 @@ +version = 1 +requires-python = ">=3.11" + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 }, +] + +[[package]] +name = "iniconfig" +version = "2.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892 }, +] + +[[package]] +name = "packaging" +version = "24.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/51/65/50db4dda066951078f0a96cf12f4b9ada6e4b811516bf0262c0f4f7064d4/packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002", size = 148788 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/08/aa/cc0199a5f0ad350994d660967a8efb233fe0416e4639146c089643407ce6/packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124", size = 53985 }, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 }, +] + +[[package]] +name = "pytest" +version = "8.3.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b4/8c/9862305bdcd6020bc7b45b1b5e7397a6caf1a33d3025b9a003b39075ffb2/pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce", size = 1439314 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0f/f9/cf155cf32ca7d6fa3601bc4c5dd19086af4b320b706919d48a4c79081cf9/pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5", size = 341802 }, +] + +[[package]] +name = "usethis" +version = "0.1.0" +source = { editable = "." } +dependencies = [ + { name = "pytest" }, +] From 99c2fd6733608614fb99914942cabd68bc6979fa Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 13:39:34 +1200 Subject: [PATCH 02/18] Fix reference to .venv folder in ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d102fe84..2cc1c068 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,9 +20,9 @@ jobs: - name: Activate Python virtualenv uses: knicknic/os-specific-run@v1 with: - linux: source venv/bin/activate - macos: source venv/bin/activate - windows: .\venv\Scripts\active + linux: source .venv/bin/activate + macos: source .venv/bin/activate + windows: .\.venv\Scripts\active - name: Install dependencies run: uv sync From 4b6e64f507a178b860cbbec896e7720ec98fb727 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 13:56:46 +1200 Subject: [PATCH 03/18] Install Python via uv in ci.yml. --- .github/workflows/ci.yml | 18 +++++++++++------- .python-version | 2 +- doc/philosophy/introspection.md | 5 +++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cc1c068..61ee8ffd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,14 +8,16 @@ jobs: tests: runs-on: ${{ matrix.os }} steps: - - name: Setup uv and Handle Its Cache - uses: hynek/setup-cached-uv@v2.0.0 - - name: Checkout code uses: actions/checkout@v2 - - name: Create Python virtualenv - run: uv venv + - name: Setup uv and Handle Its Cache + uses: hynek/setup-cached-uv@v2.0.0 + + - name: Intall Python and create virtualenv + run: | + uv python install + uv venv - name: Activate Python virtualenv uses: knicknic/os-specific-run@v1 @@ -24,11 +26,13 @@ jobs: macos: source .venv/bin/activate windows: .\.venv\Scripts\active - - name: Install dependencies + - name: Install Dependencies run: uv sync - + - name: Run pytest uses: pavelzw/pytest-action@v2.2.0 + with: + custom-arguments: tests strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] diff --git a/.python-version b/.python-version index d9506ceb..455808f8 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.12.5 +3.12.4 diff --git a/doc/philosophy/introspection.md b/doc/philosophy/introspection.md index c1a5655c..ecc1c4df 100644 --- a/doc/philosophy/introspection.md +++ b/doc/philosophy/introspection.md @@ -49,5 +49,6 @@ on: - Add to set up uv in CI - Add - Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS. -- Set up logic to create a venv, activate it, and sync with lockfile. -- Add to set up pytest in CI. +- Set up logic to use uv to install Python, create a venv, activate it, and sync. +- Add to set up pytest in CI, using the + correct CLI args to pytest. From 5e28841ffdb78dbf813ffdc5aee61878230013e3 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 14:02:53 +1200 Subject: [PATCH 04/18] Improving process documentation. --- doc/philosophy/introspection.md | 35 ++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/doc/philosophy/introspection.md b/doc/philosophy/introspection.md index ecc1c4df..2890ca0c 100644 --- a/doc/philosophy/introspection.md +++ b/doc/philosophy/introspection.md @@ -11,30 +11,37 @@ Other times, you might have to do something manually. These are all useful points to note down and can provide a lot of insight into potential features for usethis (besides just being useful documentation). -For example, when developing usethis, here are a list of actions that I undertook: +For example, when developing usethis, here are a list of actions that I undertook (not +necessarily listed chronologically): ## Toolset decisions -- Use GitHub Actions for CI -- Use uv for package management +- Use GitHub Actions for CI. +- Use uv for package management. ## Repo configuration - Created a repo on GitHub wih template .gitignore, MIT license and README. -- Created a develop branch +- Created a develop branch. - Set up sensible rulesets for branches. -- Created a template for GitHub issues that are development tasks +- Created a template for GitHub issues that are development tasks. +- Ran `uv init --name usethis`. +- Ran `uv python pin 3.12.4`. + +## Local development configuration + +- Cloned the repo from GitHub. +- Ran `uv sync`. +- Set up git username, email, and signing key. ## Set up tests -- Ran `uv init --name usethis` -- Ran `uv python pin 3.12.5` -- Ran `uv add pytest` -- Created a tests folder -- Added a trivial test module `test_nothing.py` -- Add a trivial test `test_pass` to the test module +- Ran `uv add pytest`. +- Created a tests folder. +- Added a trivial test module `test_nothing.py`. +- Add a trivial test `test_pass` to the test module. - Confirm pytest is working with `pytest tests` in the CLI. -- Create a GitHub workflow file for CI manually in `.github/workflows/ci.yml` +- Create a GitHub workflow file for CI manually in `.github/workflows/ci.yml`. - Use the following configuration to support GitFlow-style branch management: ```yml @@ -46,8 +53,8 @@ on: pull_request: ``` -- Add to set up uv in CI -- Add +- Add to set up uv in CI. +- Add . - Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS. - Set up logic to use uv to install Python, create a venv, activate it, and sync. - Add to set up pytest in CI, using the From a745aa585e92682d80625d617ea0a6a6473a55e7 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 14:36:26 +1200 Subject: [PATCH 05/18] Use system Python in CI for uv --- .github/workflows/ci.yml | 16 +++++----------- doc/philosophy/introspection.md | 32 ++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61ee8ffd..073d72f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,20 +14,13 @@ jobs: - name: Setup uv and Handle Its Cache uses: hynek/setup-cached-uv@v2.0.0 - - name: Intall Python and create virtualenv - run: | - uv python install - uv venv - - - name: Activate Python virtualenv - uses: knicknic/os-specific-run@v1 + - name: Install Python + uses: actions/setup-python@v2 with: - linux: source .venv/bin/activate - macos: source .venv/bin/activate - windows: .\.venv\Scripts\active + python-version: ${{ matrix.python-version }} - name: Install Dependencies - run: uv sync + run: uv sync --python-preference system - name: Run pytest uses: pavelzw/pytest-action@v2.2.0 @@ -36,3 +29,4 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.12] diff --git a/doc/philosophy/introspection.md b/doc/philosophy/introspection.md index 2890ca0c..7c4f04b9 100644 --- a/doc/philosophy/introspection.md +++ b/doc/philosophy/introspection.md @@ -28,19 +28,8 @@ necessarily listed chronologically): - Ran `uv init --name usethis`. - Ran `uv python pin 3.12.4`. -## Local development configuration - -- Cloned the repo from GitHub. -- Ran `uv sync`. -- Set up git username, email, and signing key. - -## Set up tests +## Add GitHub actions CI -- Ran `uv add pytest`. -- Created a tests folder. -- Added a trivial test module `test_nothing.py`. -- Add a trivial test `test_pass` to the test module. -- Confirm pytest is working with `pytest tests` in the CLI. - Create a GitHub workflow file for CI manually in `.github/workflows/ci.yml`. - Use the following configuration to support GitFlow-style branch management: @@ -55,7 +44,22 @@ on: - Add to set up uv in CI. - Add . -- Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS. -- Set up logic to use uv to install Python, create a venv, activate it, and sync. +- Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS +- Set up the GitHub actions to use different Python versions. +- Set up logic to use uv in GitHub actions. + +## Local development configuration + +- Cloned the repo from GitHub. +- Ran `uv sync`. +- Set up git username, email, and signing key. + +## Set up tests + +- Ran `uv add pytest`. +- Created a tests folder. +- Added a trivial test module `test_nothing.py`. +- Add a trivial test `test_pass` to the test module. +- Confirm pytest is working with `pytest tests` in the CLI. - Add to set up pytest in CI, using the correct CLI args to pytest. From bc87307b8f0b9f214275dbd1f8a181ce0ca01df4 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 22:45:51 +1200 Subject: [PATCH 06/18] Try custom lockfile approach for now. --- .github/workflows/ci.yml | 17 +++++++---------- Makefile | 5 +++++ doc/philosophy/introspection.md | 14 ++++++++++---- pyproject.toml | 9 +++++---- uv.lock | 5 +++++ 5 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 073d72f4..b055814d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,19 +11,16 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Setup uv and Handle Its Cache - uses: hynek/setup-cached-uv@v2.0.0 + - name: Setup uv and handle its cache + uses: hynek/setup-cached-uv@49a39f911c85c6ec0c9aadd5a426ae2761afaba2 # v2.0.0 - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} + - name: Setup dependencies + run: | + uv pip install --system -r ./requirements/{{ matrix.python-version }}-{{ runner.os }}.txt + uv pip install --system pytest pytest-md pytest-emoji - - name: Install Dependencies - run: uv sync --python-preference system - - name: Run pytest - uses: pavelzw/pytest-action@v2.2.0 + uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0 with: custom-arguments: tests strategy: diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..ae4735e3 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +.PHONY requirements: +requirements: + uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform linux --output-file .requirements/3.12-linux.txt + uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform macos --output-file .requirements/3.12-macos.txt + uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform windows --output-file .requirements/3.12-windows.txt \ No newline at end of file diff --git a/doc/philosophy/introspection.md b/doc/philosophy/introspection.md index 7c4f04b9..0ba391bb 100644 --- a/doc/philosophy/introspection.md +++ b/doc/philosophy/introspection.md @@ -17,6 +17,7 @@ necessarily listed chronologically): ## Toolset decisions - Use GitHub Actions for CI. +- Always use the hash to pin the version of a GitHub action `uses:` - Use uv for package management. ## Repo configuration @@ -25,10 +26,13 @@ necessarily listed chronologically): - Created a develop branch. - Set up sensible rulesets for branches. - Created a template for GitHub issues that are development tasks. +- Created a Makefile. +- Created a `make requirements` command to make platform-specific requirements files. - Ran `uv init --name usethis`. - Ran `uv python pin 3.12.4`. +- Created a `.requirements` directory with Python version and OS specific files. -## Add GitHub actions CI +## Add GitHub Actions CI - Create a GitHub workflow file for CI manually in `.github/workflows/ci.yml`. - Use the following configuration to support GitFlow-style branch management: @@ -42,9 +46,9 @@ on: pull_request: ``` -- Add to set up uv in CI. +- Add . - Add . -- Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS +- Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS. - Set up the GitHub actions to use different Python versions. - Set up logic to use uv in GitHub actions. @@ -56,10 +60,12 @@ on: ## Set up tests -- Ran `uv add pytest`. +- Ran `uv add --dev pytest`. - Created a tests folder. - Added a trivial test module `test_nothing.py`. - Add a trivial test `test_pass` to the test module. +- Add step to CI to install pytest +- Add step to CI to install pytest-md and pytest-emoji (used by Action). - Confirm pytest is working with `pytest tests` in the CLI. - Add to set up pytest in CI, using the correct CLI args to pytest. diff --git a/pyproject.toml b/pyproject.toml index 653f2b71..4428059d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,11 +3,12 @@ name = "usethis" version = "0.1.0" description = "Add your description here" readme = "README.md" -requires-python = ">=3.11" -dependencies = [ - "pytest>=8.3.2", -] +requires-python = ">=3.12" +dependencies = [] [build-system] requires = ["hatchling"] build-backend = "hatchling.build" + +[tool.uv] +dev-dependencies = ["pytest>=8.3.2"] diff --git a/uv.lock b/uv.lock index e142f759..4187c477 100644 --- a/uv.lock +++ b/uv.lock @@ -59,3 +59,8 @@ source = { editable = "." } dependencies = [ { name = "pytest" }, ] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, +] From b5e76ed15c952a062f829c7e01a6ae0ab482246a Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 22:59:38 +1200 Subject: [PATCH 07/18] Add missing $ syntax. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b055814d..110ab394 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Setup dependencies run: | - uv pip install --system -r ./requirements/{{ matrix.python-version }}-{{ runner.os }}.txt + uv pip install --system -r ./requirements/${{ matrix.python-version }}-${{ runner.os }}.txt uv pip install --system pytest pytest-md pytest-emoji - name: Run pytest From 4d9045f63a1afbbc7faf4f24d06eda34c70657c8 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:00:25 +1200 Subject: [PATCH 08/18] Add missing requirements files. --- .requirements/3.12-linux.txt | 2 ++ .requirements/3.12-macos.txt | 2 ++ .requirements/3.12-windows.txt | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 .requirements/3.12-linux.txt create mode 100644 .requirements/3.12-macos.txt create mode 100644 .requirements/3.12-windows.txt diff --git a/.requirements/3.12-linux.txt b/.requirements/3.12-linux.txt new file mode 100644 index 00000000..5ea47688 --- /dev/null +++ b/.requirements/3.12-linux.txt @@ -0,0 +1,2 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform linux --output-file .requirements/3.12-linux.txt diff --git a/.requirements/3.12-macos.txt b/.requirements/3.12-macos.txt new file mode 100644 index 00000000..02a8cc6d --- /dev/null +++ b/.requirements/3.12-macos.txt @@ -0,0 +1,2 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform macos --output-file .requirements/3.12-macos.txt diff --git a/.requirements/3.12-windows.txt b/.requirements/3.12-windows.txt new file mode 100644 index 00000000..a1c0325b --- /dev/null +++ b/.requirements/3.12-windows.txt @@ -0,0 +1,2 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform windows --output-file .requirements/3.12-windows.txt From 2e3dd645b08601135f08dc21e5e61843dbed0f88 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:03:37 +1200 Subject: [PATCH 09/18] Synchronize capitalization of requirements files with GitHub actions. --- .requirements/3.12-linux.txt | 2 +- .requirements/3.12-macos.txt | 2 +- .requirements/3.12-windows.txt | 2 +- Makefile | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.requirements/3.12-linux.txt b/.requirements/3.12-linux.txt index 5ea47688..21d8888f 100644 --- a/.requirements/3.12-linux.txt +++ b/.requirements/3.12-linux.txt @@ -1,2 +1,2 @@ # This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform linux --output-file .requirements/3.12-linux.txt +# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform linux --output-file .requirements/3.12-Linux.txt diff --git a/.requirements/3.12-macos.txt b/.requirements/3.12-macos.txt index 02a8cc6d..bbf5adb8 100644 --- a/.requirements/3.12-macos.txt +++ b/.requirements/3.12-macos.txt @@ -1,2 +1,2 @@ # This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform macos --output-file .requirements/3.12-macos.txt +# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform macos --output-file .requirements/3.12-macOS.txt diff --git a/.requirements/3.12-windows.txt b/.requirements/3.12-windows.txt index a1c0325b..b913d37d 100644 --- a/.requirements/3.12-windows.txt +++ b/.requirements/3.12-windows.txt @@ -1,2 +1,2 @@ # This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform windows --output-file .requirements/3.12-windows.txt +# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform windows --output-file .requirements/3.12-Windows.txt diff --git a/Makefile b/Makefile index ae4735e3..e411a935 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .PHONY requirements: requirements: - uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform linux --output-file .requirements/3.12-linux.txt - uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform macos --output-file .requirements/3.12-macos.txt - uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform windows --output-file .requirements/3.12-windows.txt \ No newline at end of file + uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform linux --output-file .requirements/3.12-Linux.txt + uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform macos --output-file .requirements/3.12-macOS.txt + uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform windows --output-file .requirements/3.12-Windows.txt \ No newline at end of file From b08ce8913c8c6d9b07936055b9bf413d12e32693 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:05:07 +1200 Subject: [PATCH 10/18] Fix typo in CI path to .requirements dir. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 110ab394..e3a9c001 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Setup dependencies run: | - uv pip install --system -r ./requirements/${{ matrix.python-version }}-${{ runner.os }}.txt + uv pip install --system -r .requirements/${{ matrix.python-version }}-${{ runner.os }}.txt uv pip install --system pytest pytest-md pytest-emoji - name: Run pytest From dae808d9aa46ec37d727d8a996327ff397fbbab9 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:06:57 +1200 Subject: [PATCH 11/18] Add relative path spec --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3a9c001..695ea876 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Setup dependencies run: | - uv pip install --system -r .requirements/${{ matrix.python-version }}-${{ runner.os }}.txt + uv pip install --system -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt uv pip install --system pytest pytest-md pytest-emoji - name: Run pytest From ab3c05f867b21f3a31ad76ea1508d2b2d0ca80c1 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:11:38 +1200 Subject: [PATCH 12/18] Add debug ls statement in CI --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 695ea876..c3b6e12a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: - name: Setup dependencies run: | + ls ./.requirements uv pip install --system -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt uv pip install --system pytest pytest-md pytest-emoji From d5dc4c971ff8bc5ee11176ce509d57093b5239aa Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:17:49 +1200 Subject: [PATCH 13/18] Fix capitalization of requirements files and remove debug line. --- .github/workflows/ci.yml | 1 - .requirements/{3.12-linux.txt => 3.12-Linux.txt} | 0 .requirements/{3.12-windows.txt => 3.12-Windows.txt} | 0 .requirements/{3.12-macos.txt => 3.12-macOS.txt} | 0 4 files changed, 1 deletion(-) rename .requirements/{3.12-linux.txt => 3.12-Linux.txt} (100%) rename .requirements/{3.12-windows.txt => 3.12-Windows.txt} (100%) rename .requirements/{3.12-macos.txt => 3.12-macOS.txt} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3b6e12a..695ea876 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,6 @@ jobs: - name: Setup dependencies run: | - ls ./.requirements uv pip install --system -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt uv pip install --system pytest pytest-md pytest-emoji diff --git a/.requirements/3.12-linux.txt b/.requirements/3.12-Linux.txt similarity index 100% rename from .requirements/3.12-linux.txt rename to .requirements/3.12-Linux.txt diff --git a/.requirements/3.12-windows.txt b/.requirements/3.12-Windows.txt similarity index 100% rename from .requirements/3.12-windows.txt rename to .requirements/3.12-Windows.txt diff --git a/.requirements/3.12-macos.txt b/.requirements/3.12-macOS.txt similarity index 100% rename from .requirements/3.12-macos.txt rename to .requirements/3.12-macOS.txt From d4e80b9f122d177674a99020bade07fbe637a525 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:22:35 +1200 Subject: [PATCH 14/18] Remove --system in `uv pip install` commands in ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 695ea876..640ecc18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: - name: Setup dependencies run: | - uv pip install --system -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt - uv pip install --system pytest pytest-md pytest-emoji + uv pip install -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt + uv pip install pytest pytest-md pytest-emoji - name: Run pytest uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0 From f5efa478082d85400e10e345eedeea120f7fbacf Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:33:30 +1200 Subject: [PATCH 15/18] Use --system --break-system-packages --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 640ecc18..0e7da607 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: - name: Setup dependencies run: | - uv pip install -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt - uv pip install pytest pytest-md pytest-emoji + uv pip install --system --break-system-packages -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt + uv pip install --system --break-system-packages pytest pytest-md pytest-emoji - name: Run pytest uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0 From 5379ac0a5fe76fc9d318fccd6b4a1b131cc64569 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:39:42 +1200 Subject: [PATCH 16/18] Update actions/checkout and pin --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e7da607..4308722d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup uv and handle its cache uses: hynek/setup-cached-uv@49a39f911c85c6ec0c9aadd5a426ae2761afaba2 # v2.0.0 From b85b07ede18d137b5bfa9e51b802e96bc38675da Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 14 Aug 2024 23:43:34 +1200 Subject: [PATCH 17/18] Use --user instead of --system --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4308722d..a28fe670 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: - name: Setup dependencies run: | - uv pip install --system --break-system-packages -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt - uv pip install --system --break-system-packages pytest pytest-md pytest-emoji + uv pip install --user --break-system-packages -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt + uv pip install --user --break-system-packages pytest pytest-md pytest-emoji - name: Run pytest uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0 From 246965c5485e75c3a3d8c162fbfd18d25223a8cf Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Thu, 15 Aug 2024 00:02:58 +1200 Subject: [PATCH 18/18] Set up Python version with GitHub action. --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a28fe670..820afc3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,11 +13,16 @@ jobs: - name: Setup uv and handle its cache uses: hynek/setup-cached-uv@49a39f911c85c6ec0c9aadd5a426ae2761afaba2 # v2.0.0 + + - name: "Set up Python" + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + with: + python-version: ${{ matrix.python-version }} - name: Setup dependencies run: | - uv pip install --user --break-system-packages -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt - uv pip install --user --break-system-packages pytest pytest-md pytest-emoji + uv pip install --system --break-system-packages -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt + uv pip install --system --break-system-packages pytest pytest-md pytest-emoji - name: Run pytest uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0