Skip to content
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

build: Use hatchling to package project #9

Merged

Conversation

matthewfeickert
Copy link
Contributor

@matthewfeickert matthewfeickert commented Dec 4, 2024

Resolves #8

  • Convert packaging from setuptools to hatchling as UMNN is pure-Python.
  • Add required dependencies of NumPy and PyTorch.
  • Add missing requires-python and correct licence to BSD-3 given

UMNN/LICENSE

Line 1 in 9e489b5

BSD 3-Clause License

Example of working as expected

From the top level of the repo

$ pipx run build --installer uv .
* Creating isolated environment: venv+uv...
* Using external uv from /home/feickert/.pyenv/shims/uv
* Installing packages in isolated environment:
  - hatchling
* Getting build dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating isolated environment: venv+uv...
* Using external uv from /home/feickert/.pyenv/shims/uv
* Installing packages in isolated environment:
  - hatchling
* Getting build dependencies for wheel...
* Building wheel...
Successfully built umnn-1.70.tar.gz and umnn-1.70-py3-none-any.whl
$ python -m tarfile --list dist/umnn-1.70.tar.gz 
umnn-1.70/models/UMNN/MonotonicNN.py 
umnn-1.70/models/UMNN/NeuralIntegral.py 
umnn-1.70/models/UMNN/ParallelNeuralIntegral.py 
umnn-1.70/models/UMNN/UMNNMAF.py 
umnn-1.70/models/UMNN/UMNNMAFFlow.py 
umnn-1.70/models/UMNN/__init__.py 
umnn-1.70/models/UMNN/made.py 
umnn-1.70/models/UMNN/spectral_normalization.py 
umnn-1.70/LICENSE 
umnn-1.70/pyproject.toml 
umnn-1.70/PKG-INFO
$ python -m zipfile --list dist/umnn-1.70-py3-none-any.whl 
File Name                                             Modified             Size
UMNN/MonotonicNN.py                            2020-02-02 00:00:00         1957
UMNN/NeuralIntegral.py                         2020-02-02 00:00:00         2895
UMNN/ParallelNeuralIntegral.py                 2020-02-02 00:00:00         4270
UMNN/UMNNMAF.py                                2020-02-02 00:00:00        10524
UMNN/UMNNMAFFlow.py                            2020-02-02 00:00:00         5656
UMNN/__init__.py                               2020-02-02 00:00:00          258
UMNN/made.py                                   2020-02-02 00:00:00         9945
UMNN/spectral_normalization.py                 2020-02-02 00:00:00         2536
umnn-1.70.dist-info/METADATA                   2020-02-02 00:00:00          298
umnn-1.70.dist-info/WHEEL                      2020-02-02 00:00:00           87
umnn-1.70.dist-info/licenses/LICENSE           2020-02-02 00:00:00         1524
umnn-1.70.dist-info/RECORD                     2020-02-02 00:00:00          905
$ rm -rf dist
$ uv pip install --upgrade .
$ uv pip show umnn
Using Python 3.12.1 environment at: /home/feickert/.pyenv/versions/3.12.1/envs/umnn-dev
Name: umnn
Version: 1.70
Location: /home/feickert/.pyenv/versions/3.12.1/envs/umnn-dev/lib/python3.12/site-packages
Requires: numpy, torch
Required-by:
$ python -c 'import UMNN; print(UMNN)'
<module 'UMNN' from '/home/feickert/.pyenv/versions/umnn-dev/lib/python3.12/site-packages/UMNN/__init__.py'>

* Convert packaging from setuptools to hatchling as UMNN is pure-Python.
* Add required dependencies of NumPy and PyTorch.
* Add missing requires-python and correct licence to BSD-3.
@matthewfeickert
Copy link
Contributor Author

matthewfeickert commented Dec 4, 2024

@AWehenkel This is ready for review.

cc @glouppe (hi! 🙂 ) in the event that @AWehenkel doesn't see this and might need to get contacted other ways.


Context: This is required to get sbi on conda-forge. c.f. Issue #8 and linked Issues for details.


[project]
name = "UMNN"
version = "1.70"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set to 1.70 given https://pypi.org/project/UMNN/1.70/ exists and so assuming that release corresponds to 9e489b5.

@AWehenkel AWehenkel merged commit 9041bff into AWehenkel:master Dec 10, 2024
@matthewfeickert matthewfeickert deleted the build/add-required-dependencies branch December 10, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add packaging support
2 participants