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

Making neat-ml poetry-fied (plus tox, black, flake8, and mypy updates) #88

Merged
merged 87 commits into from
Jul 19, 2022

Conversation

hrshdhgd
Copy link
Contributor

@hrshdhgd hrshdhgd commented Jun 21, 2022

  • Make poetry the main package management system
  • Implement tox within poetry and within it:
    • black
    • flake8
    • mypy

@hrshdhgd hrshdhgd linked an issue Jun 21, 2022 that may be closed by this pull request
3 tasks
@hrshdhgd hrshdhgd changed the title Added poetry relevant files Making neat-ml poetry-tied Jun 21, 2022
@hrshdhgd hrshdhgd changed the title Making neat-ml poetry-tied Making neat-ml poetry-fied Jun 21, 2022
@caufieldjh
Copy link
Contributor

This is pretty strange - I'm having difficulty establishing the path for neat_ml_schema. I can import it without issue, but any attempt to find its path returns None:

>>> import neat_ml_schema
>>> print(neat_ml_schema.__file__)
None
>>> import inspect
>>> inspect.getfile(neat_ml_schema)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/inspect.py", line 659, in getfile
    raise TypeError('{!r} is a built-in module'.format(object))
TypeError: <module 'neat_ml_schema' (namespace)> is a built-in module
>>> import pkg_resources 
>>> pkg_resources.resource_filename('neat_ml_schema','src/schema/neat_ml_schema.yaml')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/harry/neat-env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1144, in resource_filename
    return get_provider(package_or_requirement).get_resource_filename(
  File "/home/harry/neat-env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 364, in get_provider
    return _find_adapter(_provider_factories, loader)(module)
  File "/home/harry/neat-env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1392, in __init__
    self.module_path = os.path.dirname(getattr(module, '__file__', ''))
  File "/usr/lib/python3.8/posixpath.py", line 152, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

@hrshdhgd
Copy link
Contributor Author

Aah ... I think I know what the problem is. I need to fix it in neat-ml-schema

@hrshdhgd
Copy link
Contributor Author

Alright, releasing a new version of neat-ml-schema (v0.1.11) right now. That should solve the problem. Also, the new path will be pkg_resources.resource_filename('neat_ml_schema','schema/neat_ml_schema.yaml') and this should work. I have made the change in neat-ml and will push the change once the release is done, that way gh-action must pass.

@hrshdhgd
Copy link
Contributor Author

hrshdhgd commented Jun 21, 2022

Alright, this passes! I have implemented tox which in turn implements black. There will be a lot of files committed that will be reformatted. Should we do this in this PR or a separate one?

@caufieldjh
Copy link
Contributor

Let's take care of the reformatting here too

@hrshdhgd
Copy link
Contributor Author

I will need help with flake8 error correction. Primarily because you both have a better knowledge of what each of the functions do than I. We can go through it together during our hackathons. the command to highlight the areas that need attention : poetry run tox -e flake8

@caufieldjh caufieldjh changed the title Making neat-ml poetry-fied Making neat-ml poetry-fied (plus tox, black, flake8, and mypy updates) Jun 23, 2022
@caufieldjh
Copy link
Contributor

Not sure what's going on with ensmallen or why poetry can't find it to install.

@caufieldjh
Copy link
Contributor

There may be some strange python version interaction between poetry, ensmallen, and OS - the poetry install works perfectly on my machine, running Py3.9.5, but the workflow here is running Py3.9.13 on windows/linux. The windows one fails during install but the linux one works.

Going to try deactivating the windows tests as I don't think grape really supports it anyway.

@caufieldjh
Copy link
Contributor

OK, now it makes it to pytest but just takes far too long. Probably trying to make a real embedding by accident.

@caufieldjh
Copy link
Contributor

Tests are still taking too long - I suspect this test is the culprit:

def test_sklearn_fit(self) -> None:

@caufieldjh
Copy link
Contributor

Hrm, looks like it may just need the extra imports to be test dependencies. Will try that.

@caufieldjh
Copy link
Contributor

See AnacletoLAB/grape#12 - just ran into this

@caufieldjh
Copy link
Contributor

Looks like this is working - tests are still running long, but I think that's because it includes all the tensorflow and sklearn stuff that generally runs quickly (i.e., not 100 minutes) if it isn't on a GH actions instance.

@caufieldjh
Copy link
Contributor

caufieldjh commented Jul 19, 2022

Hrm, the tests install TF and scikit-learn, but it's strange that they still take so long. On my machine it takes <2 min to run all tests.

@caufieldjh caufieldjh merged commit 6f46d81 into main Jul 19, 2022
@caufieldjh caufieldjh deleted the poetry-ify branch July 19, 2022 19:42
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.

poetryfying the project
2 participants