Skip to content

Commit ad55967

Browse files
authored
refactor: Rename requirements.in to requirements.txt. (#2619)
Rename requirements.in to requirements.txt. It is a more standard way to manage Python dependencies, it can be recognized automatically by some IDEs. Add environment setup section to README for running hermetic build scripts.
1 parent b19fa33 commit ad55967

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

.cloudbuild/library_generation/library_generation.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN rm $(which python3)
2626
RUN ln -s $(which python3.11) /usr/local/bin/python
2727
RUN ln -s $(which python3.11) /usr/local/bin/python3
2828
RUN python -m pip install --upgrade pip
29-
RUN cd /src && python -m pip install -r requirements.in
29+
RUN cd /src && python -m pip install -r requirements.txt
3030
RUN cd /src && python -m pip install .
3131

3232
# set dummy git credentials for empty commit used in postprocessing

.github/workflows/verify_library_generation.yaml

+3-11
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,9 @@ on:
1010
name: verify_library_generation
1111
jobs:
1212
integration_tests:
13-
strategy:
14-
matrix:
15-
java: [ 11 ]
1613
runs-on: ubuntu-22.04
1714
steps:
1815
- uses: actions/checkout@v4
19-
- uses: actions/setup-java@v4
20-
with:
21-
java-version: ${{ matrix.java }}
22-
distribution: temurin
23-
cache: maven
2416
- uses: actions/setup-python@v5
2517
with:
2618
python-version: 3.11
@@ -41,7 +33,7 @@ jobs:
4133
run: |
4234
set -ex
4335
pushd library_generation
44-
pip install -r requirements.in
36+
pip install -r requirements.txt
4537
pip install .
4638
popd
4739
- name: Run integration tests
@@ -71,7 +63,7 @@ jobs:
7163
run: |
7264
set -ex
7365
pushd library_generation
74-
pip install -r requirements.in
66+
pip install -r requirements.txt
7567
popd
7668
- name: install synthtool
7769
shell: bash
@@ -115,7 +107,7 @@ jobs:
115107
run: |
116108
set -ex
117109
pushd library_generation
118-
pip install -r requirements.in
110+
pip install -r requirements.txt
119111
popd
120112
- name: Lint
121113
shell: bash

library_generation/README.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ google-cloud-java) from a configuration file.
1010
- Java runtime environment (8 or above)
1111
- Apache Maven (used in formatting source code)
1212
- Python (3.11.6 or above)
13+
- Docker
14+
- Git
1315

1416
## Prerequisite
1517

@@ -188,22 +190,26 @@ libraries:
188190
- proto_path: google/cloud/asset/v1p7beta1
189191
```
190192
193+
# Local Environment Setup before running `entry_point.py`
194+
195+
1. Assuming Python 3 is installed, follow official guide from [Python.org](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#create-and-use-virtual-environments) to create a virtual environment. The virtual environment can be installed to any folder, usually it is recommended to be installed under the root folder of the project(`sdk-platform-java` in this case).
196+
2. Assuming the virtual environment is installed under `sdk-platform-java`. Run the following command under the root folder of `sdk-platform-java` to install the dependencies of `library_generation`
197+
```bash
198+
python -m pip install -r library_generation/requirements.txt
199+
```
200+
3. Run the following command to install `library_generation` as a module, which allows the `library_generation` module to be imported from anywhere
201+
```bash
202+
python -m pip install library_generation/
203+
```
204+
191205
## An example to generate a repository using `entry_point.py`
192206

193207
```bash
194-
# install python module (allows the `library_generation` module to be imported from anywhere)
195-
python -m pip install -r library_generation/requirements.in
196-
# install library_generation module
197-
python -m pip install library_generation
198-
# generate the repository
199-
python -m library_generation/entry_point.py generate \
208+
python library_generation/entry_point.py generate \
200209
--baseline-generation-config=/path/to/baseline_config_file \
201210
--current-generation-config=/path/to/current_config_file \
202-
--repository-path=/path/to/repository
211+
--repository-path=path/to/repository
203212
```
204-
205-
## An example of generated repository using `entry_point.py`
206-
207213
If you run `entry_point.py` with the example [configuration](#an-example-of-generation-configuration)
208214
shown above, the repository structure is:
209215
```

0 commit comments

Comments
 (0)