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

fix(testing+linting): add nox lint+format directives #123

Conversation

odeke-em
Copy link
Contributor

@odeke-em odeke-em commented Dec 26, 2024

This change introduces new nox directives:

  • blacken: nox -s blacken
  • format: nox -s format to apply formatting to files
  • lint: nox -s lint to flag linting issues
  • unit: to run unit tests locally

which are the basis to enable scalable development and continuous testing as I prepare to bring in
Approximate Nearest Neighors (ANN) functionality into this package.

@odeke-em odeke-em requested review from a team as code owners December 26, 2024 11:05
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/langchain-google-spanner-python API. label Dec 26, 2024
@gauravpurohit06
Copy link
Contributor

@Yuan325, Can you also review it and run the tests?

@odeke-em odeke-em force-pushed the testing-add-nox-lint+blacken+enable-unit-testing branch from af7b616 to 312898d Compare December 27, 2024 06:18
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove these changes. This project (and consistently across other projects) does not use nox to run lints. Please see https://github.com/googleapis/langchain-google-spanner-python/blob/main/.github/workflows/lint.yml

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @averikitsch, Do we have a reason for not using it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • The dependencies are in the pyproject.toml that get updated by dependabot. This file does not get automatically updated
  • This config is copied from repos that use a different package naming schema, different directory structure, and setup.py

Also, for the future we should not be using "fix" in the commit message, that will trigger a new release and we do not create new releases for CI updates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@averikitsch thanks for your reply. The purpose of the PR is to get functionality to allow code to be formatted, unit tests to be run locally et al as code is being built by developers so as to speed up development. Do you perhaps have alternative suggestions for how to accomplish the above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please remove these changes. This project (and consistently across other projects) does not use nox to run lints.

@averikitsch python-spanner the main repo representing Cloud Spanner does use nox https://github.com/googleapis/python-spanner/blob/main/noxfile.py for linting, testing and all, for more than 7 years https://github.com/googleapis/python-spanner/commits/main/noxfile.py?after=32e761b0d4052938bf67cfec63a0e83702a35ada+34.

Could you perhaps explain your objections and help out with suggestions? This PR has been sitting for more than 2 weeks and it moving is necessary to accomplish other tasks.

Copy link
Contributor

@gauravpurohit06 gauravpurohit06 Jan 16, 2025

Choose a reason for hiding this comment

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

Hi @averikitsch,

@odeke-em is trying to define a nox task for liniting and running the test locally and for linting he is using black (i.e. we are using same in our workflows).

If noxfile.py is not getting copied from any other repos or configurations.. I don't see any problem with the change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This will be diverting from the other langchain repos. I am fine with adding it, but the Spanner team will have to keep it up to date as I mentioned that it doesn't get auto-updates and will not stay in sync with the repo CI setup. This may cause long term confusion for maintainers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @averikitsch. It won't need many updates except indeed as you mention mirror-ing pyproject dependencies into setup.py and those won't be updates needed even with a year. However, the benefits of having non-Googlers be able to develop and make updates robustly I believe shall heavily outweigh any of those. Also currently I can't even look at the Kokoro statuses as one needs to be a Googler per https://console.cloud.google.com/cloud-build/triggers/edit/16ba25ff-d74a-42ef-8f19-9780571439ab?project=585680705374
Screenshot 2025-01-19 at 10 15 12 PM

Copy link
Collaborator

Choose a reason for hiding this comment

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

README.rst Outdated Show resolved Hide resolved
noxfile.py Outdated Show resolved Hide resolved
noxfile.py Show resolved Hide resolved
noxfile.py Show resolved Hide resolved
@averikitsch
Copy link
Collaborator

Please fix the lint errors

@averikitsch
Copy link
Collaborator

/gcbrun

@averikitsch
Copy link
Collaborator

Please work with @gauravpurohit06 to run the tests via the comment "/gcbrun"

@odeke-em odeke-em force-pushed the testing-add-nox-lint+blacken+enable-unit-testing branch from 312898d to b0a4104 Compare January 20, 2025 05:55
@odeke-em odeke-em requested a review from averikitsch January 20, 2025 06:35
@gauravpurohit06
Copy link
Contributor

/gcbrun

@gauravpurohit06
Copy link
Contributor

Please fix the linting errors.

@odeke-em
Copy link
Contributor Author

/gcbrun

@odeke-em
Copy link
Contributor Author

@gauravpurohit06 kindly help me run /gcbrun

@gauravpurohit06
Copy link
Contributor

/gcbrun

noxfile.py Outdated Show resolved Hide resolved
@averikitsch averikitsch dismissed their stale review January 24, 2025 22:52

My approval doesn't matter

@gauravpurohit06
Copy link
Contributor

/gcbrun

@odeke-em odeke-em force-pushed the testing-add-nox-lint+blacken+enable-unit-testing branch from fc0b553 to bf7e000 Compare January 28, 2025 03:13
@odeke-em
Copy link
Contributor Author

@gauravpurohit06 kindly help with /gcbrun

@gauravpurohit06
Copy link
Contributor

/gcbrun

This change introduces new nox directives:
* blacken: `nox -s blacken`
* format: `nox -s format` to apply formatting to files
* lint: `nox -s lint` to flag linting issues
* integration: to run integration tests
* unit: to run unit tests locally

which are the basis to enable scalable development
and continuous testing as I prepare to bring in
Approximate Nearest Neighors (ANN) functionality into
this package.
@odeke-em odeke-em force-pushed the testing-add-nox-lint+blacken+enable-unit-testing branch from bf7e000 to 50d0cfc Compare January 30, 2025 08:35
@odeke-em odeke-em force-pushed the testing-add-nox-lint+blacken+enable-unit-testing branch from 50d0cfc to e1b166d Compare January 30, 2025 08:38
@odeke-em
Copy link
Contributor Author

@gauravpurohit06 kindly please help with /gcbrun

@gauravpurohit06
Copy link
Contributor

/gcbrun

@gauravpurohit06 gauravpurohit06 merged commit b10dc28 into googleapis:main Jan 30, 2025
10 checks passed
@odeke-em odeke-em deleted the testing-add-nox-lint+blacken+enable-unit-testing branch January 30, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/langchain-google-spanner-python API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants