Skip to content

Commit 0deb495

Browse files
authored
Merge pull request #14 from IBM/ProjectScaffoldOverhaul
Project scaffold overhaul
2 parents f035d48 + 9735d84 commit 0deb495

20 files changed

+157
-389
lines changed

.coveragerc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
1-
# This workflow runs the publication to pypi
21
name: release
32
on:
43
release:
54
types: [published]
65
workflow_dispatch: {}
76
jobs:
8-
build-38:
7+
publish:
98
runs-on: ubuntu-latest
109
steps:
11-
- uses: actions/checkout@v5
12-
- name: Run release
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- uses: astral-sh/setup-uv@v5
14+
- name: Build sdist and wheel
15+
run: uv build
16+
- name: Publish to PyPI
17+
run: uv publish
1318
env:
14-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
15-
PYTHON_VERSION: "3.8"
16-
run: REF="${{ github.ref }}" ./scripts/release.sh
17-
build-39:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v5
21-
- name: Run release
22-
env:
23-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
24-
PYTHON_VERSION: "3.9"
25-
run: REF="${{ github.ref }}" ./scripts/release.sh
26-
build-310:
27-
runs-on: ubuntu-latest
28-
steps:
29-
- uses: actions/checkout@v5
30-
- name: Run release
31-
env:
32-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
33-
PYTHON_VERSION: "3.10"
34-
run: REF="${{ github.ref }}" ./scripts/release.sh
19+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}

.github/workflows/tests.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# This workflow runs the python unit tests
21
name: tests
32
on:
43
push:
@@ -7,21 +6,16 @@ on:
76
branches: [main]
87
workflow_dispatch: {}
98
jobs:
10-
build-310:
9+
test:
1110
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1215
steps:
13-
- uses: actions/checkout@v5
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- uses: astral-sh/setup-uv@v5
1420
- name: Run unit tests
15-
run: docker build . --target=test --build-arg PYTHON_VERSION=3.10
16-
build-311:
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v5
20-
- name: Run unit tests
21-
run: docker build . --target=test --build-arg PYTHON_VERSION=3.11
22-
build-312:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@v5
26-
- name: Run unit tests
27-
run: docker build . --target=test --build-arg PYTHON_VERSION=3.12
21+
run: uv run --python ${{ matrix.python-version }} --extra test pytest

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ reports
1010
htmlcov
1111
.coverage
1212
.bash_history
13+
uv.lock
14+
*_pb2.py
15+
*_pb2_grpc.py

.isort.cfg

Lines changed: 0 additions & 9 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
repos:
22
- repo: https://github.com/pre-commit/mirrors-prettier
3-
rev: v2.1.2
3+
rev: v3.0.0
44
hooks:
55
- id: prettier
66
- repo: https://github.com/psf/black
7-
rev: 20.8b1
7+
rev: 24.3.0
88
hooks:
99
- id: black
1010
exclude: imports
11-
additional_dependencies: ["click==8.0.4"]
1211
- repo: https://github.com/PyCQA/isort
13-
rev: 5.11.5
12+
rev: 5.13.2
1413
hooks:
1514
- id: isort
1615
exclude: imports

CONTRIBUTING.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,27 @@ Improvements to existing functionality are tracked as [GitHub issues using the U
4848

4949
### Set up your dev environment
5050

51-
#### Using Docker
51+
#### Using uv
5252

53-
The easiest way to get up and running is to use the dockerized development environment which you can launch using:
53+
The recommended way to get up and running is to use [`uv`](https://github.com/astral-sh/uv) for managing the Python environment:
5454

5555
```sh
56-
make develop
57-
```
56+
# Install dependencies including test tools
57+
uv sync --extra test
58+
59+
# Run tests
60+
uv run pytest
5861

59-
Within the `develop` shell, any of the `make` targets that do not require `docker` can be run directly. The shell has the local files mounted, so changes to the files on your host machine will be reflected when commands are run in the `develop` shell.
62+
# Run formatting
63+
uv run pre-commit run --all-files
64+
```
6065

6166
#### Locally
6267

6368
You can also develop locally using standard python development practices. You'll need to install the dependencies for the unit tests. It is recommended that you do this in a virtual environment such as [`conda`](https://docs.conda.io/en/latest/miniconda.html) or [`pyenv`](https://github.com/pyenv/pyenv) so that you avoid version conflicts in a shared global dependency set.
6469

6570
```sh
66-
pip install -r requirements_test.txt
71+
pip install -e ".[test]"
6772
```
6873

6974
### Run unit tests
@@ -74,14 +79,19 @@ Running the tests is as simple as:
7479
make test
7580
```
7681

77-
If you want to use the full set of [`pytest` CLI arguments](https://docs.pytest.org/en/6.2.x/usage.html), you can run the `scripts/run_tests.sh` script directly with any arguments added to the command.
82+
If you want to use the full set of [`pytest` CLI arguments](https://docs.pytest.org/en/6.2.x/usage.html), you can run the `scripts/run_tests.sh` script directly with any arguments added to the command. For example, to run only a single test without capturing output, you can do:
83+
84+
```sh
85+
./scripts/run_tests.sh tests/test_tls_test_tools.py
86+
```
7887

7988
### Code formatting
8089

81-
This project uses [pre-commit](https://pre-commit.com/) to enforce coding style using [black](https://github.com/psf/black). To set up `pre-commit` locally, you can:
90+
This project uses [pre-commit](https://pre-commit.com/) to enforce coding style using [black](https://github.com/psf/black) and [isort](https://pycqa.github.io/isort/). To set up `pre-commit` locally, you can:
8291

8392
```sh
8493
pip install pre-commit
94+
pre-commit install
8595
```
8696

8797
Coding style is enforced by the CI tests, so if not installed locally, your PR will fail until formatting has been applied.
@@ -97,7 +107,7 @@ Unsure where to begin contributing? You can start by looking through these issue
97107

98108
To contribute to this repo, you'll use the Fork and Pull model common in many open source repositories. For details on this process, watch [how to contribute](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).
99109

100-
When ready, you can create a pull request. Pull requests are often referred to as "PR". In general, we follow the standard [github pull request](https://help.github.com/en/articles/about-pull-requests) process. Follow the template to provide details about your pull request to the maintainers.
110+
When ready, you can create a pull request. Pull requests are often referred to as "PR". In general, we follow the standard [github pull request](https://help.github.com/en/articles/about-pull-request) process. Follow the template to provide details about your pull request to the maintainers.
101111

102112
Before sending pull requests, make sure your changes pass tests.
103113

@@ -110,6 +120,13 @@ Once you've [created a pull request](#how-to-contribute), maintainers will revie
110120
- Write detailed commit messages
111121
- Break large changes into a logical series of smaller patches, which are easy to understand individually and combine to solve a broader issue
112122

113-
<!-- ## Releasing (Maintainers only)
123+
## Releasing (Maintainers only)
124+
125+
The responsibility for releasing new versions of the libraries falls to the maintainers. Releases will follow standard [semantic versioning](https://semver.org/) and be hosted on [pypi](https://pypi.org/project/tls-test-tools/).
126+
127+
To create a release:
114128

115-
The responsibility for releasing new versions of the libraries falls to the maintainers. Releases will follow standard [semantic versioning](https://semver.org/) and be hosted on [pypi](https://pypi.org/project/jtd-to-proto/). -->
129+
1. Tag the release: `git tag -a vX.Y.Z -m "Release vX.Y.Z"`
130+
2. Push the tag: `git push origin vX.Y.Z`
131+
3. Create a GitHub release for the tag
132+
4. The CI will automatically build and publish to PyPI

Dockerfile

Lines changed: 0 additions & 65 deletions
This file was deleted.

Makefile

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,12 @@ help: ## Display this help.
99

1010
.PHONY: test
1111
test: ## Run the unit tests
12-
./scripts/run_tests.sh
13-
14-
.PHONY: test.develop
15-
test.develop: develop.build ## Run the unit tests in the develop shell
16-
./scripts/develop.sh ./scripts/run_tests.sh
12+
uv run --extra test pytest
1713

1814
.PHONY: fmt
1915
fmt: ## Run code formatting
2016
./scripts/fmt.sh
2117

22-
.PHONY: wheel
23-
wheel: ## Build release wheels
24-
./scripts/build_wheel.sh
25-
26-
##@ Develop
27-
28-
PYTHON_VERSION ?= 3.8
29-
30-
.PHONY: develop.build
31-
develop.build: ## Build the development environment container
32-
docker build . --target=base -t tls-test-tools-develop --build-arg PYTHON_VERSION=${PYTHON_VERSION}
33-
34-
.PHONY: develop
35-
develop: develop.build ## Run the develop shell with the local codebase mounted
36-
./scripts/develop.sh
18+
.PHONY: build
19+
build: ## Build sdist and wheel
20+
uv build

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TLS Test Tools
22

3-
This project is a collection of tools for managing ephemeral TLS secrets in unit tests.
3+
This project is a library of tools for managing ephemeral TLS secrets in unit tests.
44

55
When writing code that needs to either host a server with TLS enabled or make connections to a TLS enabled server, it's
66
often difficult to write succinct unit tests that exercise these connections. This package aims to fix that! It provides
@@ -9,8 +9,18 @@ ports to host temporary servers on.
99

1010
## Installation
1111

12-
To install, simply use `pip`
12+
To install, simply use `pip`:
1313

1414
```sh
1515
pip install tls-test-tools
1616
```
17+
18+
Or use `uv` for faster installation:
19+
20+
```sh
21+
uv add tls-test-tools
22+
```
23+
24+
## Development
25+
26+
See [CONTRIBUTING.md](CONTRIBUTING.md) for information on setting up a development environment and contributing to this project.

0 commit comments

Comments
 (0)