Merge ppa-dev-tools:packaging-pypi into ppa-dev-tools:main

Proposed by Bryce Harrington
Status: Merged
Merge reported by: Bryce Harrington
Merged at revision: 03062a4271406b02133a320d290c45dc51e26a1c
Proposed branch: ppa-dev-tools:packaging-pypi
Merge into: ppa-dev-tools:main
Diff against target: 354 lines (+217/-14) (has conflicts)
10 files modified
INSTALL.md (+16/-1)
Makefile (+40/-0)
README.md (+22/-5)
RELEASING.md (+79/-2)
ppa/_version.py (+1/-1)
pyproject.toml (+25/-2)
requirements-dev.txt (+5/-0)
setup.cfg (+2/-2)
setup.py (+0/-1)
tox.ini (+27/-0)
Conflict in INSTALL.md
Reviewer Review Type Date Requested Status
Athos Ribeiro (community) Approve
Canonical Server Reporter Pending
Review via email: mp+429681@code.staging.launchpad.net

Description of the change

This brings in a bunch of packaging-related work, mainly focusing on pypi and pulling ideas from Athos' lppa packaging. It's not a straight copy, though. The version number is passed to set-release-version via a VERSION environment variable instead of autoincrementing, in order to give me more explicit control over setting specific version numbers (I plan to jump from 0.5.0 or so, to 1.0.0, when things are ready). lppa updates version numbers to set them to end in .dev1 for periods when the codebase is under active development; that adds complexity to the Makefile and is probably not necessary this early on in development.

I've tested most of the targets in the Makefile. I know the RELEASING.md doc doesn't yet make use of them however I'll update the doc when I actually do the 0.2.0 release. I haven't been able to successfully test the check and coverage commands since there's still some busted test cases in the old code.

To post a comment you must log in.
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks, Bryce. LGTM

Some Makefile targets seem to still need some work/cleaning up, such as the devel one (I left an inline command there) depending on how we are going to manage the python packaging here. This can be done later though, when we decide on the packaging tooling stack.

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks!

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

On Wed, Sep 14, 2022 at 03:57:01AM -0000, Bryce Harrington wrote:
>Thanks!
>
>Diff comments:
>
>> diff --git a/Makefile b/Makefile
>> new file mode 100644
>> index 0000000..f9375f7
>> --- /dev/null
>> +++ b/Makefile
>> @@ -0,0 +1,46 @@
>> +.PHONY: clean devel check build
>> +
>> +build: clean
>> + python3 -m build
>> + twine check dist/*
>> +
>> +check:
>> + flake8 tests ppa scripts
>> + python3-coverage run --source=ppa -m pytest -v tests
>> +
>> +coverage: check
>> + python3-coverage report
>> + python3-coverage html
>> +
>> +devel:
>> + pip install -r requirements-dev.txt
>> + echo 'import setuptools; setuptools.setup()' > setup.py
>> + pip install -e .
>> + rm setup.py
>
>Thanks, I was wondering about this, and pondering some of the newer build systems.
>I'd love to hear your opinions/guidance on what you'd think is best, I get the sense you're more clued in on the state of the art than me. :-)
>
>For now I guess I'll drop this target from the Makefile.

ack;

I do like using build for its simplicity. The part I dislike about this
setup is this setup.py hack for setting up the development environemnt.
I could not find a nicer workaround for that matter though.

Still, it would be nice to check poetry before going down that path
since it's been getting more adoption. I also wonder how dh-python deals
with those tools nowadays.

>> +
>> +clean:
>> + rm -rf *.egg-info dist build .pytest_cache */__pycache__ .coverage htmlcov
>> +
>> +publish: build
>> + twine upload dist/*
>> +
>> +set-release-version:
>> +ifndef VERSION
>> + $(error VERSION environment variable is undefined)
>> +endif
>> + sed -Ei "s/^(__version__ = ')[0-9]+\.[0-9]+\.[0-9]+.*'$$/\1${VERSION}\'/" ppa/_version.py
>> + sed -Ei "s/^(version = \")[0-9]+\.[0-9]+\.[0-9]+.*\"$$/\1${VERSION}\"/" pyproject.toml
>> + sed -Ei "s/^(version: )[0-9]+\.[0-9]+\.[0-9]+.*\$$/\1${VERSION}/" snap/snapcraft.yaml
>> + git add ppa/_version.py pyproject.toml snap/snapcraft.yaml
>> +
>> +tag-release:
>> + VERSION=$$(sed -En "s/__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'$$/\1/p" ppa/_version.py); \
>> + if [ -z "$$VERSION" ]; then \
>> + echo 'Version is not in the expected format. Is this a release version?'; \
>> + exit 1; \
>> + fi; \
>> + echo "tagging $$VERSION as v$$VERSION"; \
>> + git commit -s -m "Prepare $$VERSION release"; \
>> + git tag v$$VERSION
>> +
>> +release: clean set-release-version changelog tag-release publish set-devel
>
>
>--
>https://code.launchpad.net/~bryce/ppa-dev-tools/+git/ppa-dev-tools-1/+merge/429681
>You are reviewing the proposed merge of ppa-dev-tools:packaging-pypi into ppa-dev-tools:main.
>

--
Athos Ribeiro

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, I've filed LP: #1989617 for doing the analysis here. If you do any explorations feel free to jot them into that report to take into account.

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: