ruisdael-observatory / NCQC

NetCDF Quality Control Python library
GNU General Public License v3.0
0 stars 0 forks source link

review: library build process #1

Open andrecastro0o opened 2 months ago

andrecastro0o commented 2 months ago

The README instruct the user to install the library from source by performing the following steps

pip install wheel
pip install setuptools
pip install twine

python setup.py bdist_wheel

pip install ./dist/ncqc-0.1.0-py3-none-any.whl
andrecastro0o commented 2 months ago

build with setup tools

in https://setuptools.pypa.io/en/latest/userguide/quickstart.html it is stated that

Every python package must provide a pyproject.toml and specify the backend (build system) it wants to use.

However the repo hav no ncqc.toml, instead it uses setup.py

According to quickstart.html#transitioning-from-setup-py-to-declarative-config

we are transitioning from defining all your package information by running setup() to doing this declaratively - by using pyproject.toml

https://packaging.python.org/en/latest/discussions/setup-py-deprecated/#setup-py-deprecated Mentions that although setup.py is NOT deprecated

python setup.py and the use of setup.py as a command line tool are deprecated.

With the following commands NOT MEANT be run anymore:

    python setup.py install
    python setup.py develop
    python setup.py sdist
    python setup.py bdist_wheel

which is exactly what is instructed in the README python setup.py bdist_wheel

https://packaging.python.org/en/latest/guides/modernize-setup-py-project/ explains how to modernize and replace setup.py with myproject.toml

andrecastro0o commented 2 months ago

Given these facts, I consider necessary to modernize the build setup, by:

andrecastro0o commented 2 months ago

packaging project

see https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#packaging-your-project

To have your project installable from a Package Index like PyPI, you’ll need to create a Distribution (aka “Package”) for your project.

steps:

Once uploaded to testpypi, the module is indexed and pip installable:

Notes

[^1]: A wheel is a built package, as opposed to a "source distribution” which is unbuilt, and can be installed without going through the “build” process. [^2]: for uploading a changed version, without chaning the version number, include --skip-existing: twine upload --skip-existing --repository testpypi dist/*

andrecastro0o commented 2 months ago

After a few version bumps and uploads to https://test.pypi.org/project/ncqc/, which failed when pip install -i https://test.pypi.org/simple/ ncqc due to conflicting library versions, seems I seem to have had success

pip install -i https://test.pypi.org/simple/ ncqc==0.1.10

Looking in indexes: https://test.pypi.org/simple/
Collecting ncqc==0.1.10
  Using cached https://test-files.pythonhosted.org/packages/7f/8e/0321294a0b422354a0f541bd254e78217c59993ff09cf73a14d6aa3626da/ncqc-0.1.10-py3-none-any.whl (37 kB)
Installing collected packages: ncqc
Successfully installed ncqc-0.1.10

pip freeze

ncqc==0.1.10

andrecastro0o commented 2 months ago
Collecting ncqc==0.1.33
  Using cached https://test-files.pythonhosted.org/packages/66/8c/adf767840deb2352cd7926e5c309ad40abde5c6b7080f5d735d2e0a9bde4/ncqc-0.1.33-py3-none-any.whl.metadata (50 kB)
INFO: pip is looking at multiple versions of ncqc to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement PyYAML~=6.0.1 (from ncqc) (from versions: 3.11)
ERROR: No matching distribution found for PyYAML~=6.0.1