Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Rename requirements.in to requirements.txt. #2619

Merged
merged 6 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN rm $(which python3)
RUN ln -s $(which python3.11) /usr/local/bin/python
RUN ln -s $(which python3.11) /usr/local/bin/python3
RUN python -m pip install --upgrade pip
RUN cd /src && python -m pip install -r requirements.in
RUN cd /src && python -m pip install -r requirements.txt
RUN cd /src && python -m pip install .

# set dummy git credentials for empty commit used in postprocessing
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/verify_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: |
set -ex
pushd library_generation
pip install -r requirements.in
pip install -r requirements.txt
pip install .
popd
- name: Run integration tests
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
run: |
set -ex
pushd library_generation
pip install -r requirements.in
pip install -r requirements.txt
popd
- name: install synthtool
shell: bash
Expand All @@ -87,7 +87,7 @@ jobs:
git reset --hard origin/no-java-templates

python3 -m pip install -e .
python3 -m pip install -r requirements.in
python3 -m pip install -r requirements.txt
- name: Run shell unit tests
run: |
set -x
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
run: |
set -ex
pushd library_generation
pip install -r requirements.in
pip install -r requirements.txt
popd
- name: Lint
shell: bash
Expand Down
25 changes: 17 additions & 8 deletions library_generation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ configuration file.
- Java runtime environment (8 or above)
- Apache Maven (used in formatting source code)
- Python (3.11.6 or above)
- Docker
- Git
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need git?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some post processing scripts perform git operations, I don't think we should continue this way and should refactor it in the future, but currently we do.


## Prerequisite

Expand Down Expand Up @@ -184,19 +186,26 @@ libraries:
- proto_path: google/cloud/asset/v1p7beta1
```

## An example to generate a repository using `generate_repo.py`
# Local Environment Setup before running `generate_repo.py`

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).
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`
```bash
# install python module (allows the `library_generation` module to be imported from anywhere)
python -m pip install -r library_generation/requirements.in
# generate the repository
python -m library_generation/generate_repo.py generate \
--generation-config-yaml=/path/to/config-file \
--repository-path=/path/to/repository
python -m pip install -r library_generation/requirements.txt
```
3. Run the following command to install `library_generation` as a module, which allows the `library_generation` module to be imported from anywhere
```bash
python -m pip install library_generation/
```

## An example of generated repository using `generate_repo.py`
## An example to generate a repository using `generate_repo.py`

```bash
# generate the repository
python library_generation/generate_repo.py generate \
--generation-config-yaml=absolute/path/to/config-file \
--repository-path=absolute/path/to/repository
```
If you run `generate_repo.py` with the example [configuration](#an-example-of-generation-configuration)
shown above, the repository structure is:
```
Expand Down
2 changes: 1 addition & 1 deletion library_generation/postprocess_library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ git fetch --all
git reset --hard "${synthtool_commitish}"

python3 -m pip install -e .
python3 -m pip install -r requirements.in
python3 -m pip install -r requirements.txt
popd # synthtool
popd # temp dir

Expand Down
File renamed without changes.
Loading