Skip to content

Commit 8d1c8bc

Browse files
authored
MRG: Merge pull request #731 from octue/rename-project-name-to-project-id
Rename `project_name` to `project_id`
2 parents ab2639b + bbbc1f4 commit 8d1c8bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1060
-970
lines changed

.github/workflows/python-ci.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ jobs:
4444
- name: Check pyproject.toml file
4545
run: poetry check
4646

47-
- name: Install tox
48-
run: pip install tox
49-
5047
- name: Authenticate with Google Cloud
5148
id: auth
5249
uses: google-github-actions/[email protected]
@@ -56,11 +53,14 @@ jobs:
5653
workload_identity_provider: "projects/437801218871/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
5754
service_account: "[email protected]"
5855

56+
- name: Install package
57+
run: poetry install --all-extras -v
58+
5959
- name: Run tests
60-
env:
61-
TEST_PROJECT_NAME: ${{ secrets.TEST_PROJECT_NAME }}
62-
GOOGLE_CLOUD_PROJECT: ${{ secrets.TEST_PROJECT_NAME }}
63-
run: tox -vv -e py
60+
run: |
61+
poetry run coverage run --source octue -m unittest discover
62+
poetry run coverage report --show-missing
63+
poetry run coverage xml
6464
6565
- name: Upload coverage to Codecov
6666
uses: codecov/codecov-action@v4

.github/workflows/release.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ jobs:
4848
- name: Check pyproject.toml file
4949
run: poetry check
5050

51-
- name: Install tox
52-
run: pip install tox
53-
5451
- name: Authenticate with Google Cloud
5552
id: auth
5653
uses: google-github-actions/[email protected]
@@ -60,11 +57,14 @@ jobs:
6057
workload_identity_provider: "projects/437801218871/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
6158
service_account: "[email protected]"
6259

60+
- name: Install package
61+
run: poetry install --all-extras -v
62+
6363
- name: Run tests
64-
env:
65-
TEST_PROJECT_NAME: ${{ secrets.TEST_PROJECT_NAME }}
66-
GOOGLE_CLOUD_PROJECT: ${{ secrets.TEST_PROJECT_NAME }}
67-
run: tox -vv -e py
64+
run: |
65+
poetry run coverage run --source octue -m unittest discover
66+
poetry run coverage report --show-missing
67+
poetry run coverage xml
6868
6969
- name: Upload coverage to Codecov
7070
uses: codecov/codecov-action@v4

README.md

-7
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,13 @@ Then run the tests to check everything's working.
8686
These environment variables need to be set to run the tests:
8787

8888
- `GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/service/account/file.json`
89-
- `TEST_PROJECT_NAME=<name-of-google-cloud-project-to-run-pub-sub-tests-on>`
9089

9190
Then, from the repository root, run
9291

9392
```shell
9493
python3 -m unittest
9594
```
9695

97-
or
98-
99-
```shell
100-
tox
101-
```
102-
10396
## Contributing
10497

10598
Take a look at our [contributing](/docs/contributing.md) page.

docs/contributing.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# Contributing
22

33
## Developing the SDK
4+
45
- We follow a test-driven development (TDD) approach and require a high test coverage of each PR.
56
- We use [`pre-commit`](https://pre-commit.com/) to apply consistent code quality checks and linting to new code, commit messages, and documentation - see [below](#pre-commit) for how to set this up
67
- Documentation is automatically built by `pre-commit` but needs to be updated with any changes to public interface of the package
78

8-
99
## Releases
10+
1011
We use continuous deployment and semantic versioning for our releases:
12+
1113
- Continuous deployment - each pull request into `main` constitutes a new version
1214
- [Semantic versioning](https://semver.org/) supported by [Conventional Commits](https://github.com/octue/conventional-commits) - to automate meaningful version numbering
1315
- Conventional Commit messages - these are essential for the above to be automated. We've developed a `pre-commit` check that guides and enforces this.
1416

15-
1617
## Pull requests
1718

1819
### Internal developers
20+
1921
1. Check out a new branch
2022
2. Create a pull request into the `main` branch
2123
3. Undertake your changes, committing and pushing to your branch
@@ -27,11 +29,13 @@ We use continuous deployment and semantic versioning for our releases:
2729
9. Merge into `main`. A release will automatically be created on GitHub and published to PyPi and Docker Hub.
2830

2931
### External developers
32+
3033
- Please [raise an issue](https://github.com/octue/octue-sdk-python/issues) (or add your $0.02 to an existing issue) so
3134
the maintainers know what's happening and can advise/steer you.
3235

3336
- Create a fork of `octue-sdk-python`, undertaking your changes on a new branch, (see `.pre-commit-config.yaml` for
3437
branch naming conventions). To run tests and make commits, you'll need to do something like:
38+
3539
```
3640
git clone <your_forked_repo_address> # Fetches the repo to your local machine
3741
cd octue-sdk-python # Move into the repo directory
@@ -40,17 +44,18 @@ We use continuous deployment and semantic versioning for our releases:
4044
pip install poetry # Installs the poetry package manager
4145
poetry install --all-extras # Installs the package editably, including developer dependencies (e.g. testing and code formatting utilities)
4246
pre-commit install && pre-commit install -t commit-msg # Installs the pre-commit hooks in the git repo
43-
tox # Runs the tests
47+
poetry run python3 -m unittest # Runs the tests
4448
```
4549

4650
- Open a pull request into the `main` branch of `octue/octue-sdk-python`.
4751
- Follow the rest of the process for internal developers above.
4852
- Once checks have passed, test coverage of the new code is 100%, documentation is updated, and the review has passed,
4953
we'll merge and release your changes.
5054

51-
5255
## Pre-Commit
56+
5357
You need to install pre-commit to get the hooks working. Run:
58+
5459
```
5560
pip install pre-commit
5661
pre-commit install && pre-commit install -t commit-msg
@@ -74,16 +79,18 @@ Upon failure, the commit will halt. **Re-running the commit will automatically f
7479
- Commit messages - the error messages should explain how to fix these too
7580

7681
You can run pre-commit hooks without making a commit, too, like:
82+
7783
```
7884
pre-commit run black --all-files
7985
```
86+
8087
or
88+
8189
```
8290
# -v gives verbose output, useful for figuring out why docs won't build
8391
pre-commit run build-docs -v
8492
```
8593

86-
8794
## Documentation
8895

8996
### Building documents automatically
@@ -93,19 +100,20 @@ The documentation will build automatically in a pre-configured environment when
93100
In fact, the way `pre-commit` works, you won't be allowed to make the commit unless the documentation builds. This way
94101
we avoid getting broken documentation pushed to the main repository on any commit so we can rely on builds working.
95102

96-
97103
### Building documents manually
98104

99105
**If you did need to build the documentation**
100106

101107
Install `doxygen`. On a mac, that's `brew install doxygen`; other systems may differ.
102108

103109
Install sphinx and other requirements for building the docs:
110+
104111
```
105112
pip install -r docs/requirements.txt
106113
```
107114

108115
Run the build process:
116+
109117
```
110118
sphinx-build -b html docs/source docs/html
111119
```

docs/source/asking_questions.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ can be:
2020
`django-twined <https://django-twined.readthedocs.io/en/latest/>`_ or custom logic in your own webserver.
2121

2222
Questions are always asked to a *revision* of a service. You can ask a service a question if you have its
23-
:ref:`SRUID <sruid_definition>`, project name, and the necessary permissions.
23+
:ref:`SRUID <sruid_definition>`, project ID, and the necessary permissions.
2424

2525

2626
Asking a question
@@ -32,7 +32,7 @@ Asking a question
3232
3333
child = Child(
3434
id="my-organisation/my-service:2.1.7",
35-
backend={"name": "GCPPubSubBackend", "project_name": "my-project"},
35+
backend={"name": "GCPPubSubBackend", "project_id": "my-project"},
3636
)
3737
3838
answer, question_uuid = child.ask(
@@ -241,15 +241,15 @@ if these values are in your service configuration file:
241241
"id": "template-child-services/wind-speed-service:2.1.1",
242242
"backend": {
243243
"name": "GCPPubSubBackend",
244-
"project_name": "my-project"
244+
"project_id": "my-project"
245245
}
246246
},
247247
{
248248
"key": "elevation",
249249
"id": "template-child-services/elevation-service:3.1.9",
250250
"backend": {
251251
"name": "GCPPubSubBackend",
252-
"project_name": "my-project"
252+
"project_id": "my-project"
253253
}
254254
}
255255
]
@@ -302,15 +302,15 @@ For example, if the child requires these children in its service configuration:
302302
"id": "template-child-services/wind-speed-service:2.1.1",
303303
"backend": {
304304
"name": "GCPPubSubBackend",
305-
"project_name": "octue-sdk-python"
305+
"project_id": "octue-sdk-python"
306306
},
307307
},
308308
{
309309
"key": "elevation",
310310
"id": "template-child-services/elevation-service:3.1.9",
311311
"backend": {
312312
"name": "GCPPubSubBackend",
313-
"project_name": "octue-sdk-python"
313+
"project_id": "octue-sdk-python"
314314
},
315315
}
316316
]
@@ -327,15 +327,15 @@ then you can override them like this:
327327
"id": "my/own-service:1.0.0",
328328
"backend": {
329329
"name": "GCPPubSubBackend",
330-
"project_name": "octue-sdk-python"
330+
"project_id": "octue-sdk-python"
331331
},
332332
},
333333
{
334334
"key": "elevation",
335335
"id": "organisation/another-service:0.1.0",
336336
"backend": {
337337
"name": "GCPPubSubBackend",
338-
"project_name": "octue-sdk-python"
338+
"project_id": "octue-sdk-python"
339339
},
340340
},
341341
],
@@ -380,7 +380,7 @@ You can specify service registries in two ways:
380380
381381
child = Child(
382382
id="my-organisation/my-service:1.1.0",
383-
backend={"name": "GCPPubSubBackend", "project_name": "my-project"},
383+
backend={"name": "GCPPubSubBackend", "project_id": "my-project"},
384384
service_registries=[
385385
{"name": "my-registry", "endpoint": "blah.com/services"},
386386
]

0 commit comments

Comments
 (0)