-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added example pyproject and package. #11
Added example pyproject and package. #11
Conversation
Can we implement this on the files in #1 (and thus merge that ASAP if ready) including moving those files as appropriate? |
Yes, I was thinking this should be based on #1, but I didn't want to deal with a second remote. So I'll make this a draft again until that is merged.
By this do you mean moving the current files in #1 into the package or not? I was thinking of including some top level files that show good practices for scripting, and then this being an independent-ish folder and showing packaging. |
I guess I don't need to get too complicated. It's meant for people starting new projects from scratch without a lot of prior experience. Happy to debate what that minimal case looks like, so I'll see how it all fits. Don't want you to go too far down a rabbit hole though. |
Add example of pyproject scripts/entry points? |
Todo: move |
-issue is that pip isn't updating setuptools -work around: just install wheel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of typos and reminder about docstring format.
@@ -4,22 +4,20 @@ | |||
|
|||
logger = logging.getLogger(__name__) | |||
|
|||
# using Sphinx docstrings style: <https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we decide to switch to numpy docstring style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we decided to make that a separate PR #12.
tests/__init__.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pytest isn't happy without it. I can't remember if python has removed the need for this file or not. There might be a workaround, but I'm thinking: "if it ain't broke..."
========================================================================= test session starts ==========================================================================
platform linux -- Python 3.10.13, pytest-7.4.0, pluggy-1.3.0
rootdir: /home/mgale/dev/py-template
plugins: anyio-4.0.0, profiling-1.7.0
collected 0 items / 2 errors
================================================================================ ERRORS ================================================================================
________________________________________________________________ ERROR collecting tests/test_do_task.py ________________________________________________________________
ImportError while importing test module '/home/mgale/dev/py-template/tests/test_do_task.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/lib/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_do_task.py:1: in <module>
import acme_corp.do_task as do_task
E ModuleNotFoundError: No module named 'acme_corp'
_________________________________________________________________ ERROR collecting tests/test_piano.py _________________________________________________________________
ImportError while importing test module '/home/mgale/dev/py-template/tests/test_piano.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/lib/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_piano.py:1: in <module>
import acme_corp
E ModuleNotFoundError: No module named 'acme_corp'
======================================================================= short test summary info ========================================================================
ERROR tests/test_do_task.py
ERROR tests/test_piano.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================== 2 errors in 0.11s ===========================================================================
Co-authored-by: Paul Wilson <[email protected]>
Co-authored-by: Paul Wilson <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MicahGale
Added an example package with a
pyproject.toml
file.This a variety of levels of concepts that may or not be appropriate for this scope.
pyproject.toml
file that covers:python -m build
andpip install .
should work on it.pytest
).__init__.py
__main__.py
_private
@property
getterspytest.fixture
pytest.approx
for float comparisonsFixes #3.