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

V4.y #38

Closed
wants to merge 38 commits into from
Closed

V4.y #38

wants to merge 38 commits into from

Conversation

LAShemilt
Copy link
Collaborator

This is a first pass refactor to get pyscicat working with v4 of Scicat. We would like to :

  • Provide an easy install that can be versioned
  • mark where functions are deprecated and breaking changes occur
  • have a ci workflow for testing against the v4.y backend

Copy link
Collaborator

@dylanmcreynolds dylanmcreynolds left a comment

Choose a reason for hiding this comment

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

Thanks for this! I've never migrated a python project to use setup.cfg. I have some changes and questions.

setup.cfg Outdated Show resolved Hide resolved
setup.cfg Outdated Show resolved Hide resolved
pyscicat/tests/tests_local.py Outdated Show resolved Hide resolved
@LAShemilt LAShemilt changed the base branch from main to v4.x March 17, 2023 17:06
@LAShemilt LAShemilt changed the base branch from v4.x to main March 17, 2023 17:07
…t. The versioneer part of the set up config will set the version and does not need to be written in the metadata section
@LAShemilt
Copy link
Collaborator Author

LAShemilt commented Apr 21, 2023

Now finished work on the pyscicat version for interacting with the v4 scicat backend. Please see the following important changes to pyscicat:

1) Install and Setup
I have now split up the setup.py into a minimal setup.py script and a setup.cfg. This allows for easy configuration of unique setups which may require optional dependencies. To now install these please use for example:
pip install -e ".[option]" so to use the hd5f plugins install with pip install -e ".hdf5"

2) Deprecation of methods
I have used python's deprecation package to deprecate methods that no longer exist in the v4 backend. They will still work with the old backend, and can still be called with pyscicat as normal. However, you will get a deprecation warning when they are called.

3) Endpoint routes
I had really trouble with the getter methods which was coming from urllib's urljoin. If you use a / in an endpoint definition when you join that with a base url , urljoin will treat it as an absolute path and will append it after the port number. So http://localhost:3000/api/v3 joined with /Datasets/ was becoming http://localhost:3000/Datasets/. This problem goes away when using proper routing as to not have the port in the url name, which is why I guess it has not affected production systems so far. I have removed the / at the beginning so that the append will work properly in both the test and prod cases.

4) Integration testing in github actions
I have updated the github actions to include some minor integration testing for the backend-v.4 . It uses the docker image of the last stable release from https://github.com/SciCatProject/scicat-backend-next. This runs as a service and the tests run a few methods against it to ingest and retrieve data.

Any comments and review would be greatly appreciated.

@LAShemilt LAShemilt changed the title WIP:V4.y V4.y Apr 21, 2023
setup.cfg Show resolved Hide resolved
pyscicat/client.py Outdated Show resolved Hide resolved
@nitrosx
Copy link
Collaborator

nitrosx commented May 22, 2023

@dylanmcreynolds why don't we align the version with the current SciCat one?

@nitrosx
Copy link
Collaborator

nitrosx commented May 22, 2023

One more thing: given that this PR goes against the v4.x branch, should we go ahead and merge and than work on the v4.x to make it production ready?
This merge would help me greatly with the current work that I'm doing now to refactor all our services to interact correctly with BE v4.x
@LAShemilt , @dylanmcreynolds : thoughts?

@dylanmcreynolds
Copy link
Collaborator

Tests are failing because of the change in how requirements are listed.

@dylanmcreynolds
Copy link
Collaborator

Hmm, flake8 failures now.

Copy link
Collaborator

@dylanmcreynolds dylanmcreynolds left a comment

Choose a reason for hiding this comment

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

pytest tests are failing in this PR because somewhere along the way in these many commits, the client.py has changed dramatically.

  • test_client:test_scicat_ingest fails because the returns for upload_instrument, upload_proposal and upload_sample once returned a string, now they returns a dictionary (the ones you can see in add_mock_reqeusts. I don't know who uses these methods, but they return string in the main branch.
  • It looks like there are similar major changes that affect in test_client2

SCICAT_PASSWORD - the password for your scicat user.
"""

sci_clie = ScicatClient(base_url=os.environ["BASE_URL"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

This call to os.environ["BASE_URL"] now blows up tests for developers that use pytest but don't have the full integration suite configured (like me). pytest picks up this module because it's name starts with test.

I don't this module using either pytest or unittest. Perhaps we could change the module name from test_integration.py to integration.py to prevent is from getting in the way of pytest?

@LAShemilt LAShemilt mentioned this pull request Jun 6, 2023
@LAShemilt
Copy link
Collaborator Author

Please see #40

@LAShemilt LAShemilt closed this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants