Coder Social home page Coder Social logo

nomadreservations / nx-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sumitparakh/nx-python

0.0 0.0 0.0 22.88 MB

๐Ÿ Plugin for using Python in an Nx Workspace

Home Page: http://npm.im/@nx-python/nx-python

License: MIT License

JavaScript 4.15% TypeScript 92.60% Python 3.25%

nx-python's Introduction

๐Ÿ NxPy: Nx Python plugin

This project was generated using Nx.

The nx-python plugin allows users to create a basic python application using nx commands. To add the plugin to your project, just follow these steps:

Getting started

Create a Nx Workspace

Before installing the nx-python plugin, it is required to have a pre-configured Nx Workspace . If you don't, then proceed to create a new one executing the following command:

npx create-nx-workspace python-workspace --preset=empty --cli=nx --nx-cloud true
cd python-workspace

Install the nx-python plugin

yarn add -D @nx-python/nx-python

Adding an application to our workspace

To create a new python application based on this plugin, please execute the following command:

nx g @nx-python/nx-python:app <app-name>

Note: Replace <app-name> with the name of your new application

Usage

After creating the <app-name> application using the nx-python plugin. We can execute the build, lint, test and serve nx commands on this new application. Output will be stored on dist/<app-name>/ directory.

Building the app

The build command is going to compile all the python files inside <app-name> directory, using the py_compile native module.

nx build <app-name>

More information here: py_compile

Linting the application

Unfortunately Python doesn't have a native linting module(yet!). nx-python uses the Flake8 module to lint your application. It is required that you install this module beforehand. More info here: Flake8

pip install Flake8

After that you can perform the lint process with:

nx lint <app-name>

Serving the application

This is going to execute the main file in your python application.

nx serve <app-name>

Testing your application

The test command is going to execute all the test units inside your python app. You can add new test unit files if you want, but there are two requirements that you must meet:

  • The filename must include the prefix test
  • Because we are using the native unittest python module to make our tests, you are going to create the tests based on this approach. More info here: unittest

To test your python app, execute the command:

nx test <app-name>

Contributing

๐Ÿ All contributions are welcome. Make sure you follow the code of conduct in this repository.

MIT License

Made with ๐Ÿ’œ by Code ON | Melvin Vega & Diana Rodriguez

nx-python's People

Contributors

alphacentauri82 avatar anfibiacreativa avatar dependabot[bot] avatar sumitparakh avatar superdiana avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.