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

Implement /api/version API endpoint that returns app version #1111

Conversation

eecavanna
Copy link
Collaborator

@eecavanna eecavanna commented Jan 10, 2024

Summary

  • Implemented an API endpoint (/api/version) that returns the application version number
  • Added a test targeting that endpoint
  • Note: Most of the commits in this branch are related to linting

Screenshot showing that the API returns the same version number as Swagger UI shows:

image

@eecavanna eecavanna linked an issue Jan 10, 2024 that may be closed by this pull request
@eecavanna eecavanna self-assigned this Jan 10, 2024
@eecavanna
Copy link
Collaborator Author

eecavanna commented Jan 10, 2024

Linting is failing in GitHub Actions. I don't know how I can run the same checks locally so as to avoid racking up GHA costs.

https://github.com/microbiomedata/nmdc-server/actions/runs/7480175478/job/20359024322?pr=1111#step:8:144

tox: lint
  lint: commands[0]> flake8 nmdc_server tests
  nmdc_server/api.py:11: [I001] isort found an import in the wrong position
  nmdc_server/api.py:12: [I005] isort found an unexpected missing import
  nmdc_server/api.py:26: [I001] isort found an import in the wrong position
  lint: exit 1 (1.47 seconds) /home/runner/work/nmdc-server/nmdc-server> flake8 nmdc_server tests pid=3093
lint: FAILin 3.99 seconds

For now, I'll look at the flake8 docs and try to map those to the code.

@naglepuff
Copy link
Collaborator

Linting is failing in GitHub Actions. I don't know how I can run the same checks locally so as to avoid racking up GHA costs.

You should be able to run locally with tox.

If you just want to run the linting test, try tox -e lint.

You can also try auto-formatting the files with tox -e format, which will use black to format the python files. You can check black's work by re-running tox -e lint.

@eecavanna
Copy link
Collaborator Author

eecavanna commented Jan 10, 2024

Thanks, @naglepuff. By the way, I made another commit before I saw your message (it's being GHA tested now).

I had been trying to run everything (including tox) within the backend Docker container, since I don't have the dependencies installed directly on my host. If the current GHA test fails (edit: It failed), I'll try to get my host machine set up to run tox (and the other commands you listed)—thanks!

@eecavanna eecavanna requested a review from naglepuff January 10, 2024 21:04
@eecavanna eecavanna added type: feature New feature or request scope: server related to server priority: medium X SMALL Less than 1 day python Pull requests that update Python code labels Jan 10, 2024
Copy link
Collaborator

@naglepuff naglepuff left a comment

Choose a reason for hiding this comment

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

LGTM!

@eecavanna
Copy link
Collaborator Author

Thanks! I forgot to say: you can "squash" the branch into a single commit (upon merge, assuming GitHub still offers that ability) if you want. I consider most of the commits to have been "noise."

@eecavanna
Copy link
Collaborator Author

FYI - I don't have access to merge this.

image

Merging it is not particularly urgent, from my perspective.

@ssarrafan
Copy link

Appears to be active. Moving to new sprint. Please remove from sprint if not actively working on this.

@naglepuff naglepuff merged commit 0a53b99 into main Jan 16, 2024
2 checks passed
@naglepuff naglepuff deleted the 1108-implement-api-endpoint-that-returns-nmdc-server-application-version branch January 16, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium python Pull requests that update Python code scope: server related to server type: feature New feature or request X SMALL Less than 1 day
Projects
Development

Successfully merging this pull request may close these issues.

Implement API endpoint that returns nmdc-server application version
3 participants