From a5ae4f35473a38427f3fba9b225b6de0ec16522c Mon Sep 17 00:00:00 2001 From: Jono Yang Date: Thu, 2 Sep 2021 16:48:04 -0700 Subject: [PATCH] Update README.rst #33 Signed-off-by: Jono Yang --- README.rst | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index b84a049186..a52d80506e 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,7 @@ A Simple Python Project Skeleton ================================ This repo attempts to standardize our python repositories using modern python packaging and configuration techniques. Using this `blog post`_ as inspiration, this -repository will serve as the base for all new python projects and will be adopted to all +repository will serve as the base for all new python projects and will be adopted to all our existing ones as well. .. _blog post: https://blog.jaraco.com/a-project-skeleton-for-python-projects/ @@ -33,7 +33,6 @@ Update an existing project This is also the workflow to use when updating the skeleton files in any given repository. - Customizing ----------- @@ -42,6 +41,72 @@ You typically want to perform these customizations: - remove or update the src/README.rst and tests/README.rst files - check the configure and configure.bat defaults +Initializing a project +---------------------- + +All projects using the skeleton will be expected to pull all of it dependencies +from thirdparty.aboutcode.org/pypi or the local thirdparty directory, using +requirements.txt and/or requirements-dev.txt to determine what version of a +package to collect. By default, PyPI will not be used to find and collect +packages from. + +In the case where we are starting a new project where we do not have +requirements.txt and requirements-dev.txt and whose dependencies are not yet on +thirdparty.aboutcode.org/pypi, we run the following command after adding and +customizing the skeleton files to your project: + +.. code-block:: bash + + ./configure --init + +This will initialize the virtual environment for the project, pull in the +dependencies from PyPI and add them to the virtual environment. + +Generating requirements.txt and requirements-dev.txt +---------------------------------------------------- + +After the project has been initialized, we can generate the requirements.txt and +requirements-dev.txt files. + +Ensure the virtual environment is enabled. + +To generate requirements.txt: + +.. code-block:: bash + + python etc/scripts/gen_requirements.py -s tmp/lib/python/site-packages/ + +Replace \ with the version number of the Python being used. + +To generate requirements-dev.txt after requirements.txt has been generated: + +.. code-block:: bash + ./configure --dev + source tmp/bin/activate + python etc/scripts/gen_requirements_dev.py -s tmp/lib/python/site-packages/ + +Collecting and generating ABOUT files for dependencies +------------------------------------------------------ + +Once we have requirements.txt and requirements-dev.txt, we can fetch the project +dependencies as wheels and generate ABOUT files for them: + +.. code-block:: bash + + python etc/scripts/bootstrap.py -r requirements.txt -r requirements-dev.txt --with-deps + +There may be issues with the generated ABOUT files, which will have to be +corrected. You can check to see if your corrections are valid by running: + +.. code-block:: bash + + python etc/scripts/check_thirdparty.py -d thirdparty + +Once the wheels are collected and the ABOUT files are generated and correct, +upload them to thirdparty.aboutcode.org/pypi by placing the wheels and ABOUT +files from the thirdparty directory to the pypi directory at +https://github.com/nexB/thirdparty-packages + Release Notes -------------