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 testing-framework module #10

Open
LarsSchaaf opened this issue Jul 10, 2021 · 4 comments · May be fixed by #11
Open

Making testing-framework module #10

LarsSchaaf opened this issue Jul 10, 2021 · 4 comments · May be fixed by #11
Labels
enhancement New feature or request

Comments

@LarsSchaaf
Copy link

I was wondering if we could add a setup.py and change the file strucutre to allow for the testing-framework functions to be imported.

Benefits:

  1. Functions could be used ouside of the testing-framework setting, while still working there
  2. Rather than having to be careful in what working dir one is and using import utils *, one could import testingframeowrk.utils, allowing for better editor support and more varied folder structure.
  3. All tests would effectively become "shared", and useable accorss different tets

To Do:

  • Move all files to a subfolder testingframework, such that it could be imported as from testingframework.utilities import *, note that testing-framework would not be valid subdirectory name.
  • Adding a setup.py file, something like below.

Potential setup.py

from setuptools import setup, find_packages

PACKAGENAME = "testingframework"
DESCRIPTION = "Testing Framework for atomistic models"
AUTHOR = "Libatoms"
AUTHOR_EMAIL = ""

version = {}
with open("version.py") as fp:
    exec(fp.read(), version)

setup(
    name=PACKAGENAME,
    packages=find_packages(),
    version=version["__version__"],
    description=DESCRIPTION,
    long_description=open("testing-framework/README.md").read(),
    install_requires=["scipy", "numpy", "matplotlib", "pandas>=0.21.0", "scipy",],
    setup_requires=["pytest-runner",],
    tests_require=["pytest",],
    author=AUTHOR,
    author_email=AUTHOR_EMAIL,
    package_data={"": ["data/*", "calib/data/*"],},
)

Questions

  1. Would someones own implementation/use of the framework impeded by the file structure change?
@LarsSchaaf LarsSchaaf added the enhancement New feature or request label Jul 10, 2021
@gabor1
Copy link
Contributor

gabor1 commented Jul 10, 2021

Sounds like a good idea. Let's get some feedback from some python wizards, @jameskermode @noambernstein @stenczelt

@jameskermode
Copy link
Member

I have no objection, sounds like it would work well.

@stenczelt
Copy link
Member

Sounds great, let's do it! Tell me if you need help!

I would rather not encourage from testingframework.utilities import * but make sure you import what is needed and used, so that we have a sense of where functions are coming from even without smart editors that trace it.

Are you sure using an exec is the best way of handling versions in your setup.py:

version = {}
with open("version.py") as fp:
    exec(fp.read(), version)

perhaps versioneer or for a time manual versioning would be nicer.

@LarsSchaaf LarsSchaaf linked a pull request Jul 11, 2021 that will close this issue
@LarsSchaaf
Copy link
Author

LarsSchaaf commented Jul 11, 2021

Thanks for the comments!! I had a quick look into the versioner - and it looks really cool. Didn't know that existed - cheers Tamas. If you would like to include it that'd be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants