Code Monkey home page Code Monkey logo

python's Introduction

UGRC Python Starter Template

Build Status codecov

UGRC's default Python project configuration/template

Installation

  1. Create new environment for the project
    • With python 3 (without arcpy)
      • python -m venv .env
      • activate the environment source .env/bin/activate
    • With conda
      • conda create --name PROJECT_NAME python=3.9
  2. Rename src/projectname folder to your desired project name
  3. Edit the setup.py:name, url, project_urls, keywords, and entry_points to reflect your new project name
  4. Edit the pyproject.toml --cov=projectname to reflect your new project name
  5. Edit the test_projectname.py to match your project name.
    • You will have one test_filename.py file for each file in your src directory and you will write tests for the specific file in the test_filename.py file
    • If you are using arcpy, you should mock out the arcpy module in any test that directly imports arcpy or tests any of your code that imports arcpy. Add import mock_arcpy to the imports in your test file before importing arcpy or any of your modules that you're testing. This effectively replaces all of arcpy in the test environment with a Mock object; you can then create custom return_values and side_effects for whatever functions you need, and the tests will run appropriately in GitHub Actions (which doesn't have arcpy installed).
  6. Set up Codecov to create coverage reports from GitHub Actions:
    • Navigate to codecov.io, logging in with your GitHub account if necessary.
    • Select your new repo and and copy the Upload Token.
    • Create a new repository secret (github repository Settings -> Secrets -> Actions secrets -> New repository secret) named CODECOV_TOKEN and paste the Upload Token as the Value
  7. Install an editable package for development
    • pip install -e ".[tests]"
    • Add any project requirements to the setup.py:install_requires array
    • If you specify arcgis version 2.0.0 or greater, uncomment the section in .github/workflows/ci.yml so that GitHub Actions installs the necessary dependencies.
  8. Run the tests
    • VSCode -> Python: Run All Tests or Python: Debug All Tests
    • ptw
      • Pytest Watch will restart the tests every time you save a file
  9. Bring your test code coverage to 80% or above!
  10. Replace the title of this markdown file with your project name
  11. Replace python in the badge links at the top of this page with your new repository name

python's People

Contributors

dependabot[bot] avatar jacobdadams avatar stdavis avatar steveoh avatar ugrc-release-bot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jacobdadams

python's Issues

Remove Coverage extension settings

These seem more like personal preferences than standards that we want to promote. Could they be easily moved to user settings?

"coverage-gutters.showGutterCoverage": true,
"coverage-gutters.showLineCoverage": true,
"coverage-gutters.showRulerCoverage": false,
"coverage-gutters.highlightdark": "rgb(61, 153, 112, .05)",
"coverage-gutters.noHighlightDark": "rgb(255, 65, 54, .05)",
"coverage-gutters.partialHighlightDark": "rgb(255, 133, 27, .05)"

Remove packages, package_dir once setuptools>=61

Starting with setuptools 61.0.0, it will auto-detect packages using the standard src-tree structure. However, ArcGIS Pro 3.0 still includes 58.0.4. Once the default Pro install has a compatible version of setuptools, I vote we drop the packages and package_dir keywords from setupy.py.

Possibly change formatters

What do you all think about updating this to use black instead of yapf?

https://github.com/psf/black

It seems more like prettier for javascript which we have really come to like.

Would this be a cheese move or do you see some value in using a more active/popular/maybe faster package?

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.