Releasing a Package


We've created and edited packages in our development environment so far. However, non of the work we have done is available to anybody but us. In order to make our work available for the ongoing productions, we have to release them.

Releasing packages is done via using the tools provided by mMecoRelease package. Now it's the time to release our package aDisplayMessage. Let's initialize the master project with the main development environment.

# meco-init

meco -de main

We must be in the root of our package to release it. Let's change directory to its root by executing the following command:

cd aDisplayMessage

You can type and execute the following command in order to release the package.

mmecorelease-release

As a result you should see a message like this one:

--------------------------------------------------------------------------------------------------------
PACKAGE RELEASE - CONTAINER
--------------------------------------------------------------------------------------------------------

    PACKAGE RELEASE - PRE DEPENDENCY
    ----------------------------------------------------------------------------------------------------
    2020.12.27 - 17:25:52 - INFO    : Generic    - Display Package Info                    : aDisplayMessage 1.0.0
    2020.12.27 - 17:25:52 - SUCCESS : Generic    - Check end of Week                       : OK
    2020.12.27 - 17:25:52 - SUCCESS : Generic    - Check Package Development Location      : OK
    2020.12.27 - 17:25:52 - SUCCESS : Generic    - Check Package Version for Releasing     : OK

    -

    PACKAGE RELEASE - PROCESS
    ----------------------------------------------------------------------------------------------------
    2020.12.27 - 17:25:52 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage/README.md
    2020.12.27 - 17:25:52 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage/python/aDisplayMessage/__init__.py
    2020.12.27 - 17:25:52 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage/python/aDisplayMessage/displayMessage.py
    2020.12.27 - 17:25:52 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage/python/aDisplayMessage/packageEnvLib.py
    2020.12.27 - 17:25:52 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage/python/aDisplayMessage/packageInfoLib.py
    2020.12.27 - 17:25:52 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage/python/aDisplayMessage/tests/__init__.py
    2020.12.27 - 17:25:52 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage/python/aDisplayMessage/tests/displayMessageTest.py
    2020.12.27 - 17:25:52 - SUCCESS : Package Release : OK

    -

    PACKAGE RELEASE - POST DEPENDENCY
    ----------------------------------------------------------------------------------------------------
    2020.12.27 - 17:25:52 - SUCCESS : Generic    - Send Notification                       : OK

Now we have successfully released our package, and it's available for production. Let's initialize the master project and check whether our package is there.

# meco-init

meco

Displayed info about the environment indeed contains our package.

----------------------------------------------------------------------------------------------------
MASTER PROJECT INTERNAL
----------------------------------------------------------------------------------------------------
aDisplayMessage - 1.0.0       > /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage
PYTHONPATH                    : /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage/python

As you expect you can see that our module is available and working once you execute the following command:

python -c "import aDisplayMessage.displayMessage;aDisplayMessage.displayMessage.display();"

Displayed result:

Hello from Master Project

Releasing a New Version of a Package

Let's make some changes in our code. Firstly, initialize main development environment, like so;

# meco-init

meco -de main

Open the following file in your editor.

/<PATH>/meco/master/developers/<USER_NAME>/development/main/aDisplayMessage/python/aDisplayMessage/displayMessage.py

Replace the content of the file with the following snippet.

import os
import sys

def displayProject():
    return 'Hello from Master Project'

def displayProjectByEnvironment():
    return 'Hello from {} Project'.format(os.environ.get('MECO_PROJECT_NAME', ''))

def display():
    sys.stdout.write(displayProject())

Let's try to release our package again by executing the following command.

mmeco-cd-dev; cd aDisplayMessage;

mmecorelease-release

Now we get an error saying we can't release this version because it has already been released previously.

--------------------------------------------------------------------------------------------------------
PACKAGE RELEASE - CONTAINER
--------------------------------------------------------------------------------------------------------

    PACKAGE RELEASE - PRE DEPENDENCY
    ----------------------------------------------------------------------------------------------------
    2020.12.27 - 17:49:51 - INFO    : Generic    - Display Package Info                    : aDisplayMessage 1.0.0
    2020.12.27 - 17:49:51 - SUCCESS : Generic    - Check end of Week                       : OK
    2020.12.27 - 17:49:51 - SUCCESS : Generic    - Check Package Development Location      : OK
    2020.12.27 - 17:49:51 - FAILED  : Generic    - Check Package Version for Releasing     : This version of the package has been previously released: /<PATH>/meco/master/internal/aDisplayMessage/1.0.0/aDisplayMessage

    2020.12.27 - 17:49:51 - FAILED  : Pre dependency failed.

Open the following file in your editor.

/<PATH>/meco/master/developers/<USER_NAME>/development/main/aDisplayMessage/python/aDisplayMessage/packageInfoLib.py

Bump up the minor version attribute like so;

VERSION             = '1.1.0'

Save the file and run the release command again.

mmecorelease-release

The result should look like;

--------------------------------------------------------------------------------------------------------
PACKAGE RELEASE - CONTAINER
--------------------------------------------------------------------------------------------------------

    PACKAGE RELEASE - PRE DEPENDENCY
    ----------------------------------------------------------------------------------------------------
    2020.12.27 - 17:53:38 - INFO    : Generic    - Display Package Info                    : aDisplayMessage 1.1.0
    2020.12.27 - 17:53:38 - SUCCESS : Generic    - Check end of Week                       : OK
    2020.12.27 - 17:53:38 - SUCCESS : Generic    - Check Package Development Location      : OK
    2020.12.27 - 17:53:38 - SUCCESS : Generic    - Check Package Version for Releasing     : OK

    -

    PACKAGE RELEASE - PROCESS
    ----------------------------------------------------------------------------------------------------
    2020.12.27 - 17:53:38 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage/README.md
    2020.12.27 - 17:53:38 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage/python/aDisplayMessage/__init__.py
    2020.12.27 - 17:53:38 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage/python/aDisplayMessage/displayMessage.py
    2020.12.27 - 17:53:38 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage/python/aDisplayMessage/packageEnvLib.py
    2020.12.27 - 17:53:38 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage/python/aDisplayMessage/packageInfoLib.py
    2020.12.27 - 17:53:38 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage/python/aDisplayMessage/tests/__init__.py
    2020.12.27 - 17:53:38 - INFO    : Package Release : /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage/python/aDisplayMessage/tests/displayMessageTest.py
    2020.12.27 - 17:53:38 - SUCCESS : Package Release : OK

    -

    PACKAGE RELEASE - POST DEPENDENCY
    ----------------------------------------------------------------------------------------------------
    2020.12.27 - 17:53:38 - SUCCESS : Generic    - Send Notification                       : OK

Initialize the master project with no development environment, and you can see in the displayed information that new version of our package is available.

----------------------------------------------------------------------------------------------------
MASTER PROJECT INTERNAL
----------------------------------------------------------------------------------------------------
aDisplayMessage - 1.1.0       > /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage
PYTHONPATH                    : /<PATH>/meco/master/internal/aDisplayMessage/1.1.0/aDisplayMessage/python

Checking a Package Before Release

If you want to only check a package for release you can do so by executing the following command in the root of the package.

mmecorelease-check

This command runs all the pre-dependencies on the package but doesn't release it. So you can fix displayed errors if any to make sure that the package is production ready before you release it.

Customizing Package Release

Since Meco™ provides a flexible architecture, which designed and developed developers in mind, you can customize every aspect of the package release API. You can add new dependencies, edit existing ones and even change the whole behaviour of it if you need to. Please visit mMecoRelease for more information.