Installation
The Python Package Index (PyPI) is a repository of software.
From PyPI:
(venv) $ pip install redata
From source:
(venv) $ git clone git@github.com:UAL-RE/redata-commons.git
(venv) $ python setup.py install
Check packages installed
(venv) $ pip freeze
Note: This beautiful table for Conda vs. pip https://docs.conda.io/projects/conda/en/latest/commands.html#conda-vs-pip-vs-virtualenv-commands
Updating redata-commons
redata-commons
has a typical Python repository structrure. A good reading can be found on The Hitchhiker’s Guide to Python: Best Practices for Development
at https://docs.python-guide.org/writing/structure/
- There are a few files to updated for a new version:
requirements.txt
: redata-common required dependenciessetup.py
: Package and distribution managementCHANGELOG.md
:README.md
: README file./docs/requirements.text
: Sphinx required dependencies. It may need to be updated./docs/source/conf.py
: Configuration file for Sphinx RTD/docs/source/*.rst
: RTD source files. These might need to be updated.github/workflows/pypi-publish.yml
: workflow publishing to pypi.org
Building and Publishing redata-commons
in pypi.org
Directories build/
, dist/
, the egg file redata.egg-info
and so on (see .gitignore) are generated when running on building the package. Use the following first command
to see the available parameters. The 2nd command is to build the package.
(venv) $ python setup.py --help-commands
(venv) $ python setup.py sdist bdist_wheel
After creating a pull request, workflow actions will be run/compile/test to check the updated code. One of the workflows automatically publish redata-commons
in pypi.org, using its workflows at .github/workflows/pypi-publish.yml
.
Best Practices for using a Python requirements.txt
- The following are best practices:
Use
pip freeze
to generate a list of Python modules and packages installed in the virtual env.ONLY list the modules and packages needed. Do NOT include unneccssary packages, as this makes upgrade extra efforts. It is also a waste of resources.
Keep requirements.txt file up to date and accurate. This ensure the project always use the latest version of of the Python modules and packages.