typed-argument-parser icon indicating copy to clipboard operation
typed-argument-parser copied to clipboard

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

Open kddubey opened this issue 1 year ago • 1 comments
trafficstars

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
    
  3. Install the package from the fork

    python -m pip install git+https://github.com/kddubey/typed-argument-parser.git@pyprojecttoml
    
  4. Install pytest and pydantic, and run pytest

    python -m pip install pytest "pydantic>=2"
    
    pytest
    
  5. 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 (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

kddubey avatar Jul 01 '24 05:07 kddubey

: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
@@            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.

codecov-commenter avatar Jul 01 '24 05:07 codecov-commenter

Great work as always @kddubey! Thank you!

martinjm97 avatar Jul 08 '24 14:07 martinjm97