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

python 3.10 suppport #287

Merged
merged 30 commits into from
Sep 6, 2022
Merged

python 3.10 suppport #287

merged 30 commits into from
Sep 6, 2022

Conversation

Thaulino
Copy link
Contributor

Good day everyone,

What i have done:
Added minimal build system spec pyproject.toml -> https://peps.python.org/pep-0518/ -> this will also install numpy before running setup.py
Insert a check in setup.py if python version >= 3.10, if true the extensions are freshly built
As i wanted to test if this works on a virgin system, i added a docker file for testing installation procedure within virgin ubuntu system.

Will solve #254
Looking forward for a review

kind regards

Added minimal build system spec pyproject.toml
https://peps.python.org/pep-0518/
Docker files for testing insatllation procedure within virgin system
Insert  check in setup.py if python version >= 3.10 the extensions are freshly built
@Thaulino
Copy link
Contributor Author

upps somehow the tests are not running -.-

@Thaulino Thaulino marked this pull request as draft August 18, 2022 17:09
@Thaulino
Copy link
Contributor Author

Thaulino commented Aug 18, 2022

According to this: https://nose.readthedocs.io/en/latest/
nose is in maintenance mode and has no active maintainer

nose2 or pytest may be a sufficient replacement.

@Thaulino
Copy link
Contributor Author

Thaulino commented Aug 18, 2022

As supporting python 3.10 seems to have more implications as expected i converted the pull request to a draft.

Refer #288 for some findings

@Thaulino Thaulino changed the title python 3.10 suppport, minor changes python 3.10 suppport Aug 18, 2022
@kaklise
Copy link
Collaborator

kaklise commented Aug 18, 2022

@Thaulino Thanks for working on Python 3.10 support! I'll take a look at the test failures and see if we can get this working.

@michaelbynum
Copy link
Contributor

To support python 3.10, we have to switch from nose to pytest.

@michaelbynum
Copy link
Contributor

My mistake. It looks like you are already doing that. Nose is causing the test failures though. It looks like nose is still referenced in build_tests.yml.

@Thaulino
Copy link
Contributor Author

Thaulino commented Aug 19, 2022

@michaelbynum thanks for your review, indeed i am replacing nose with pytest allready, i am Just partly finished but the quicktest allready works ✌️
Furthermore i noticed some Open questions Like #289 maybe someone can check that

@michaelbynum
Copy link
Contributor

That's great! As @kaklise said, thanks for the contribution!

@coveralls
Copy link

coveralls commented Aug 22, 2022

Coverage Status

Coverage decreased (-0.3%) to 83.803% when pulling 72e7125 on Thaulino:main into b031abf on USEPA:main.

@Thaulino Thaulino marked this pull request as ready for review August 22, 2022 12:39
@Thaulino
Copy link
Contributor Author

Thaulino commented Aug 22, 2022

@kaklise
@michaelbynum

Hi everyone, i refactored the workflows and more for a better readability, a, from my point of view, more phytonic way of distributing the package and of course python 3.10 support.

Regarding the more phytonic way of distributing the package
I noticed that the wntr package currently ships with prebuild extensions (for example sim / network_isolation) and a wheel valid for all platforms, refer to https://pypi.org/project/wntr/#files
So the wheel on pypi is a pure python wheel and valid for every python version > 3 and platform.
This is a little bit in conflict with the wntr package content as it has c/c++ extensions which are depending on the plattform, the python version and more.

I think it is more phytonic to provide wheels with prebuilt extensions for most of the platforms and python versions plus a source distribution for everyone who must or wants to build the package local. If we do so, it is important to enable the built flag in the setup.py file.

To sum up my suggestion:

  • deletion of all prebuild extensions in source distribution / repository (allready done, if this pull request is merged )
  • change build flag to True (allready done, if this pull request is merged )
  • upload needed wheels to pypi

This way it is granted that if the installation via pip succeeds the wntr package is working.
This would solve issues like #259, #276

kind regards

@kaklise
Copy link
Collaborator

kaklise commented Aug 22, 2022

@Thaulino Thanks for continuing to work on this.
@michaelbynum @dbhart Can you please review the changes in this PR?

@Thaulino
Copy link
Contributor Author

hi guys,
any progress reviewing the PR ?
can i help you with something ?

kind regards

@kaklise
Copy link
Collaborator

kaklise commented Aug 26, 2022

@Thaulino Thanks for checking in. We plan to review the PR next week.

Copy link
Collaborator

@dbhart dbhart left a comment

Choose a reason for hiding this comment

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

Hi @Thaulino
We've looked over this and I do have a couple comments. We would prefer that the docker files not be included in the commit, since they are only used for local development as opposed to use in the actions.

The other thing is that we do need to keep the _evaluator and _network_isolation binaries included in the repository. These almost never change, other than being updated for new versions of Python (they haven't changed since before 3.9 was a thing, maybe since before 3.8, because I remember having to get them built to be added in).

We are aware that this technically isn't best practice, but we have a use case where people are using WNTR in development mode but do not have access to C++ compilers installed on their machines. So they pull in or make changes to Python files elsewhere in the package, but can't build the aml/network_isolation plugins themselves, so we need them in the repository.

With your updates here, we would then take the artifacts of the build and add in py310 support as well once we pull in the PR. If we were just doing PyPI, we could do just wheel upload, but our use cases don't allow for that. Right now we are thinking of putting in a flag, like what you had for the 3.10 in setup.py, that would only set build to true in the GitHub workflow, and be false by default when pulling from the repository. Hopefully that all makes sense.

I think if you can exclude the dockerfile pieces and undelete the binaries, we would be ready to pull this in. I am currently going through the test_examples to try to figure out why they aren't working, so that we don't have to exclude them, but I don't think we need to wait for that :-)

@kaklise anything else?

@Thaulino
Copy link
Contributor Author

Please ignore the last 2 commits, i used the wrong branch -> reverted all changes

@Thaulino
Copy link
Contributor Author

Thaulino commented Aug 29, 2022

@dbhart thanks for the the feedback and the detailed explanation.
It makes some sense to me 😉
Even though i would handle this like i described it allready
--- proposal starting ----
keep the package as pythonic as possible, maybe adding a how-to-dev section to the documentation.
Describe the process of setting up a dev environment: install requirements for python, install C/C++ Toolchain and so on.
All in all i guess 2 of the 3 major plattforms allready have a C/C++ toolchain preinstalled or it is a one liner like brew install gcc
As a reference: what the numpy community wrote:
https://numpy.org/doc/stable/dev/development_environment.html
--- proposal ending ----
i understand your arguments as well and finally it is up to you 😄

I have excluded the docker files and inlcuded the binaries again - as a result we should be ready for a merge.

kind regards

@Thaulino
Copy link
Contributor Author

hmm, that is strange i restarted the workflow on my fork (same hash) and it succeeded.
https://github.com/Thaulino/WNTR/actions/runs/2951244882
https://github.com/Thaulino/WNTR/actions/runs/2951244877
Can you try restart the workflow with enabled debug logs ?
I cannot restart the workflow in your repository ☹️

@Thaulino
Copy link
Contributor Author

Renamed the test marker: time_consuming (because the marked tests are time consuming)
Enabled time consuming tests for build tests refer -> #289

@Thaulino
Copy link
Contributor Author

Hooray, all tests succeeded

but i do not understand why this one does not succeded:
https://github.com/USEPA/WNTR/pull/287/checks?check_run_id=8078470097
do we have a workflow issue ?
We should keep that in mind.

@Thaulino
Copy link
Contributor Author

@kaklise @dbhart any thougths ? Can i Help ?

Kind regards

@dbhart
Copy link
Collaborator

dbhart commented Sep 6, 2022 via email

Copy link
Collaborator

@dbhart dbhart left a comment

Choose a reason for hiding this comment

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

These look good. @kaklise I think we can merge this in, then I'll add in the DLLs for py 310.

@kaklise kaklise merged commit 2153c1d into USEPA:main Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants