Skip to content

Manual Packages Deployment

George M. Dias edited this page May 30, 2023 · 5 revisions

Python Package to PyPIRegistry

Instruction

To manually deploy a python package to PyPI the follow tools are required

  • python or python3
  • pip or python3-pip
  • build ([python or python3] -m pip install build --user)
  • twine ([python or python3]-m pip install --upgrade twine)

Once these tools are install follow these steps:

  • Step 1 - Generate the distribution archives

    Change directory to where the pyproject.toml file is located and run the build command

      cd src/python_client
      [python or python3]-m build --sdist --wheel --outdir dist/

    Once the process above is completed, a new directory is generated called dist/ with two files in it.

    • The .tag.tz file is the source archive
    • The .whl* file is the built archive

    These files represent the distribution archives of our Python package

  • Step 2 - Upload distribution archives to PyPI

    This step requires an account in PyPI and an api-token Invoke this command to push the packages into PiPY

      [python or python3]-m twine upload --repository pypi dist/*
    

    Then, enter __token__ as username, and the token (pypi- prefix included) previously generated as a password

    Press Enter to upload the distributions. The following notification is presented:

    image

  • Step 3 - Verify that the package available in PyPI

    Go to PyPI registry and make sure that the package is available

Typescript Package to NpmRegistry

Instruction

To manually deploy (push) a npm package to the registry follow these steps:

  • Step 1 - Authenticating with a personal access token

    • You must use a personal access token (classic) with the appropriate scopes to publish and install packages in GitHub Packages. For more information, see "Introduction to GitHub Packages."
    • Use the npm login command, you will be prompt for a User name and Password. Use the following command to login into the emass_client repository:
    $ npm login --scope=@mitre/emass_client --auth-type=legacy --registry=https://npm.pkg.github.com
    

    NOTE: For USERNAME use your GitHub username, for TOKEN use your personal access token (classic).

  • Step 2 - Publishing a package using a local .npmrc file

    • In the same directory of the emass_client where the package.json file is located, create or edit an .npmrc file to include a line specifying GitHub Packages URL and the namespace where the package is hosted.
    @mitre/emass_client:registry=https://npm.pkg.github.com
    
    • Add the .npmrc file to the repository where GitHub Packages can find your project. For more information, see "Adding a file to a repository."

    • Verify the name of your package in the project's package.json. It should be "name": "@mitre/emass_client".

    • Verify the repository field in your project's package.json. It should be:

    "repository": {
      "type": "git",
      "url": "https://github.com/mitre/emass_client.git"
    },
    
    • Publish the package:
    $ npm publish
    

Ruby Package to RubyGems

Instruction

image

eMASS API Specification

Automates the generation of eMASS API clients


Table of Contents

Clone this wiki locally