cnerg / py-template

Template for a new python project
MIT License
1 stars 1 forks source link

Added example pyproject and package. #11

Closed MicahGale closed 3 weeks ago

MicahGale commented 2 months ago

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.

  1. a pyproject.toml file that covers:
    1. base metadata
    2. dependencies
    3. setuptools/build metadata: python -m build and pip install . should work on it.
    4. Configuring third-party plugins (pytest).
    5. Specifying optional dependencies
  2. Packaging covering:
    1. having an __init__.py
    2. Importing a class to be top-level from a submodule
    3. Making the module executable via __main__.py
    4. Internal package imports
    5. Testing a package
  3. OOP:
    1. Using _private
    2. Making @property getters
    3. Doc strings with sphinx directives
  4. Testing:
    1. Structure and imports
    2. pytest.fixture
    3. Using pytest.approx for float comparisons
  5. Amusing myself.

Fixes #3.

gonuke commented 2 months ago

Can we implement this on the files in #1 (and thus merge that ASAP if ready) including moving those files as appropriate?

MicahGale commented 2 months ago

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.

Can we implement this on the files in https://github.com/cnerg/py-template/pull/1 (and thus merge that ASAP if ready) including moving those files as appropriate?

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.

gonuke commented 1 month ago

Can we implement this on the files in #1 (and thus merge that ASAP if ready) including moving those files as appropriate?

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.

MicahGale commented 1 month ago

Add example of pyproject scripts/entry points?

MicahGale commented 1 month ago

Todo: move do_task.py and test_do_task.py into acme_corp. Harmonize doc strings.