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

review: library build process #1

Open
andrecastro0o opened this issue Jul 29, 2024 · 5 comments · May be fixed by #2
Open

review: library build process #1

andrecastro0o opened this issue Jul 29, 2024 · 5 comments · May be fixed by #2
Assignees

Comments

@andrecastro0o
Copy link
Member

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 andrecastro0o self-assigned this Jul 29, 2024
@andrecastro0o
Copy link
Member Author

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
Copy link
Member Author

andrecastro0o commented Jul 29, 2024

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

  • including a pyproject.toml file
  • (removing setup.py)
  • editing the readme to use build
  • ...

@andrecastro0o andrecastro0o added this to the publish in pypi milestone Jul 29, 2024
@andrecastro0o
Copy link
Member Author

andrecastro0o commented Jul 30, 2024

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:

  • install build (Python packaging build frontend)
  • create a wheel1 (and sdist) python3 -m build
  • check twine check dist/*
    Checking dist/ncqc-0.1.0-py3-none-any.whl: PASSED
    Checking dist/ncqc-0.1.0.tar.gz: PASSED
  • upload to testpy: twine upload --repository testpypi dist/* 2

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

Notes

Footnotes

  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
Copy link
Member Author

andrecastro0o commented Jul 30, 2024

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 andrecastro0o linked a pull request Jul 30, 2024 that will close this issue
@andrecastro0o
Copy link
Member Author

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

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 a pull request may close this issue.

1 participant