swansonk14 / typed-argument-parser

Typed argument parser for Python
MIT License
494 stars 40 forks source link

setup.py -> pyproject.toml, and mv tap to src #142

Closed kddubey closed 2 months ago

kddubey commented 2 months ago

The goal of this PR is to make tap's structure a bit safer. Here are the changes:

  1. Replace setup.py w/ a static pyproject.toml. See docs
  2. Move tap to src/tap. See docs
  3. Store tap.__version__ as a literal string

From the user's perspective, I believe there aren't any breaking changes. But in case you prefer making the most minimal change to fix #141, it would be to add a pyproject.toml which looks like this:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

How has this been tested?

Install the fork 1. Make and activate a fresh venv (I use virtualenvwrapper) ``` mkvirtualenv temp ``` 2. Uninstall `wheel`, `setuptools` ``` python -m pip uninstall wheel setuptools --upgrade pip ``` 4. Install the package from the fork ``` python -m pip install git+https://github.com/kddubey/typed-argument-parser.git@pyprojecttoml ``` 5. Install `pytest` and `pydantic`, and run `pytest` ``` python -m pip install pytest "pydantic>=2" ``` ``` pytest ``` 6. rm temp ``` rmvirtualenv temp ```
Build, test-upload, install, and test the package 1. Checkout this branch: ``` git pull ``` ``` git checkout pyprojecttoml ``` 2. Make and activate a fresh venv (I use virtualenvwrapper) ``` mkvirtualenv temp ``` 3. Install some packaging things ``` python -m pip install build twine ``` 4. Build the package ``` python -m build ``` `dist/` should have: ``` typed_argument_parser-1.10.0-py3-none-any.whl typed_argument_parser-1.10.0.tar.gz ``` 5. Test the contents of `dist/` ``` python -m twine check dist/* ``` 6. Test that [fake-uploading to PyPI works](https://packaging.python.org/en/latest/guides/using-testpypi/#using-testpypi-with-twine) (I haven't actually ran this step onwards) ``` python -m twine upload --repository testpypi dist/* ``` You may wanna also check that https://test.pypi.org/project/typed-argument-parser looks good 7. Test that installing from this test PyPI repo works ``` python -m pip install \ --index-url https://test.pypi.org/simple/ \ --extra-index-url https://pypi.org/simple/ \ typed-argument-parser ``` 8. Install `pytest` and `pydantic`, and run `pytest` ``` python -m pip install pytest "pydantic>=2" ``` ``` pytest ``` 9. Maybe run some of the demo scripts in the repo in case you wanna double check 10. rm temp ``` rmvirtualenv temp ```
codecov-commenter commented 2 months ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.07%. Comparing base (b6505ff) to head (9f90ea1).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #142 +/- ## ========================================== - Coverage 94.10% 94.07% -0.03% ========================================== Files 5 4 -1 Lines 695 692 -3 ========================================== - Hits 654 651 -3 Misses 41 41 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

martinjm97 commented 2 months ago

Great work as always @kddubey! Thank you!