A simple Python package used by me and a friend at the university in the course 'Advanced Image, Video and Motion Analysis'
Project description
ZAOWR Package
This is a ZAOWR (Zaawansowana Analiza Obrazu, Wideo i Ruchu, eng. Advanced Image, Video, and Motion Analysis) Python package used by me and a friend at the university.
PyPI link to the package
Installing the package using pip
- PyPI MAIN
- Linux
python3 -m pip install --upgrade zaowr-polsl-kisiel
- Windows
py -m pip install --upgrade zaowr-polsl-kisiel
- Linux
- TestPyPI
- Linux
python3 -m pip install --index-url https://test.pypi.org/simple/ --upgrade zaowr-polsl-kisiel
- Windows
py -m pip install --index-url https://test.pypi.org/simple/ --upgrade zaowr-polsl-kisiel
- Linux
Creating virtual environment for the package
[!NOTE]
Complete instructions on managing Python virtual environments
can be found here.
- Create project directory (where you create your files and where the venv will be created)
python -m venv ENV_NAME
- Activate the venv (while in the project directory)
source ENV_NAME/bin/activate
or
. ENV_NAME/bin/activate - Install the package from PyPI
python3 -m pip install --upgrade zaowr-polsl-kisiel
- Deactivate the currently active venv
deactivate
- To reactivate the venv, navigate to the path where you created the venv and source it again (command shown above in section number 2)
[!NOTE]
ENV_NAMEis the name of your venv, so you can change it however you like
Building package - DEV Tutorial based on official DOCS
- Install pip
python3 -m pip install --upgrade pip
- Prepare files and directories
directory_used_for_package/ ├── LICENSE ├── pyproject.toml ├── README.md ├── src/ │ └── name_of_the_package/ │ ├── __init__.py │ └── example.py └── tests/
- Choose build backend (I chose
setuptools)
python3 -m pip install --upgrade setuptools
- Prepare
pyproject.tomlfile (this package's configuration as an example)
[build-system] requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] name = "zaowr_polsl_kisiel" dynamic = ["version"] authors = [ { name="Maksymilian Kisiel", email="NONE@NONE.PL" }, ] description = "A simple Python package used by me and a friend at the university in the course 'Advanced Image, Video and Motion Analysis'" readme = "README.md" requires-python = ">=3.8" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] keywords = ["polsl", "zaowr", "2024", "IGT", "ZAOWR"] [tool.setuptools.dynamic] dependencies = {file = "requirements.txt"} [project.urls] Homepage = "https://github.com/revalew/zaowr-py-package" Issues = "https://github.com/revalew/zaowr-py-package/issues"
- Prepare
README.mdfile (customize this as you’d like) - Prepare
LICENSEfile (MIT license shown below, more licenses can be found here)
Copyright (c) 2018 The Python Packaging Authority Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Instal the build tool (if you encounter errors see official tutorial)
python3 -m pip install --upgrade build
- Navigate to the folder where the
pyproject.tomlfile is located - Generate distribution archives
python3 -m build
- Verify that the build was successful
In the package there should now be
dist/directory. Thetar.gzfile is a source distribution whereas the.whlfile is a built distribution. Newer pip versions preferentially install built distributions, but will fall back to source distributions if needed. You should always upload a source distribution and provide built distributions for the platforms your project is compatible with.
dist/ ├── zaowr_polsl_kisiel-0.0.0-py3-none-any.whl └── zaowr_polsl_kisiel-0.0.0.tar.gz
- Register the account in TestPyPI or PyPI (just follow the given instructions)
- Generate API token for TestPyPI or PyPI (just follow the given instructions, I added the credentials to
$HOME/.pypircusing[pypi]and[testpypi]headers) - Instal
twineto upload the package
python3 -m pip install --upgrade twine
- Upload the package
- If you didn't add the credentials to
$HOME/.pypirc, you will be prompted for username and password. Use__token__for username andpypi-*(your API token) for password - PyPI
python3 -m twine upload dist/*
- TestPyPI
python3 -m twine upload --repository testpypi dist/*
- If you didn't add the credentials to
- After the upload succeeded, the package should be vievable on PyPI or TestPyPI
- Installing the package
- PyPI
python3 -m pip install --upgrade zaowr-polsl-kisiel
- TestPyPI
python3 -m pip install --upgrade --index-url https://test.pypi.org/simple/ --no-deps zaowr-polsl-kisiel
[!NOTE]
Here we additionally use
--no-depsflag.Since TestPyPI doesn’t have the same packages as the live PyPI, it’s possible that attempting to install dependencies may fail or install something unexpected.
- PyPI
- Test the installation
- Launch python
python3
- Import the package
>>> from zaowr_polsl_kisiel.read_calibration import read_calibration >>> read_calibration()
- Launch python
[!NOTE]
requirements.txtfile listed as "dependencies" was created usingpip freeze > requirements.txtcommandwhich was executed in active python
venvprepared for this uni course.Check my tutorial on managing venvs here.
Sources
This package has been prepared following this tutorial.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zaowr_polsl_kisiel-0.0.1.tar.gz.
File metadata
- Download URL: zaowr_polsl_kisiel-0.0.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c48eff952f46cb0dbcbcd35d47555c9db12d3d31cc027772e4e3301fdb1d9d18
|
|
| MD5 |
1d75393bdda021954a43ecbae35d6a30
|
|
| BLAKE2b-256 |
3cd828f35be76237f11f30a658c9d23386a328d4e0813ccb70ef8414be6994fe
|
File details
Details for the file zaowr_polsl_kisiel-0.0.1-py3-none-any.whl.
File metadata
- Download URL: zaowr_polsl_kisiel-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
948b9906e5b9be37b781be75de2e594ae8870dd4aacf6b833854b07a44ed9ce5
|
|
| MD5 |
c4f14c3c73330a842d03a2dd319fc115
|
|
| BLAKE2b-256 |
25268bc60e56934a1ead72bad0166a9ae431a50347d039ff823d92f0a3d14deb
|