Commit 57e8ddcd authored by vertighel's avatar vertighel
Browse files

Pipeline test

parent 3d0e8520
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+57 −0
Original line number Diff line number Diff line
image: python:3.12 # Use the Python version matching your requires-python

stages:
  - lint
  # - test # Future stage for unit tests
  # - build # Future stage for building the package
  # - deploy # Future stage

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  PYLINT_TARGETS: "noctua" # Target your main package directory
  ISORT_TARGETS: "noctua tests" # Target package and tests directory

cache:
  paths:
    - .cache/pip
    - venv/

before_script:
  - python -V # Print out python version for debugging
  - pip install --upgrade pip
  # Install isort, pylint, and project dependencies (for pylint to understand imports)
  # It's good practice to install project deps so pylint can resolve them.
  # Alternatively, install only linters if you don't need pylint to check against installed deps.
  - pip install isort pylint
  - pip install -e . # Install the project in editable mode so pylint can find 'noctua' and its deps

isort_check:
  stage: lint
  script:
    - echo "Running isort check..."
    # --check-only: exits with non-zero if files need formatting
    # --diff: shows differences
    # --profile black: if you use black for formatting, isort can align with it. Optional.
    - isort --check-only --diff ${ISORT_TARGETS}
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Run on merge requests
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run on commits to default branch (main/master)
    - when: manual # Allow manual trigger for other branches/tags
      allow_failure: true

pylint_check:
  stage: lint
  script:
    - echo "Running pylint check on '${PYLINT_TARGETS}'..."
    # PYLINT_TARGETS should be the package name or specific files/directories.
    # --rcfile=.pylintrc: specify your config file
    # --fail-under=N: Optional, set a minimum score for the build to pass.
    #                 Start without it or with a low N and increase over time.
    - pylint --rcfile=.pylintrc ${PYLINT_TARGETS} # || pylint-exit $? 
      # The `|| pylint-exit $?` part is if you use pylint-exit for custom exit codes based on message types.
      # For a basic setup, just `pylint ...` is fine. It will exit non-zero on errors.
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - when: manual
      allow_failure: true

.pylintrc

0 → 100644
+72 −0
Original line number Diff line number Diff line
[BASIC]
good-names=i,
            j,
            k,
            v,
            e,
            ra,
            dec,
            tn, # Added from your astelco.py example
            ob, # Added from your sequencer example
            up, # If used
            fs, # If used
            fh, # If used
            gp, # If you were using gnuplotlib
            fd # Often used for file descriptors
            # Add any other short variable names you commonly and acceptably use

[MASTER]
# The init-hook is generally used to modify sys.path if pylint can't find your modules.
# If your project is structured as a standard Python package and you run pylint
# on the package (e.g., pylint noctua), this hook might not be strictly necessary
# for path reasons, but it doesn't hurt.
# It's more critical if you have complex import structures or run pylint on individual files
# from a different directory.
init-hook='
    import os, sys;
    sys.path.insert(0, os.getcwd());
    '
    # Assuming .pylintrc is at the project root, and 'noctua' is a package in this root.
    # This adds the project root to sys.path, allowing pylint to find 'noctua'.



# To find modules when running pylint on the 'noctua' package, it's usually better to ensure
# your execution environment (like the CI job) has the current directory in PYTHONPATH
# or to install the package in editable mode before linting.
# However, for CI, the init-hook can be a quick way.

load-plugins=pylint.extensions.docparams, pylint.extensions.check_elif # Examples

[MESSAGES CONTROL]
# Disable specific messages if needed, e.g.:
# disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
disable=C0114, # Missing module docstring
         C0115, # Missing class docstring
         C0116, # Missing function docstring
         R0903, # Too few public methods
         R0913, # Too many arguments
         R0902, # Too many instance attributes (can be high in device classes)
         W0703, # Catching too general exception Exception (sometimes necessary in device comms)
         W0613  # Unused argument (common in callbacks/overrides)


[REPORTS]
reports=no

[TYPECHECK]
# If you have generated-members that pylint can't see (e.g. from dynamic imports in devices)
# generated-members=
# For devices dynamically added to 'noctua.devices'
# This is tricky. Pylint is static. If 'noctua.devices.dom' is created at runtime,
# pylint won't know about it unless you explicitly tell it or use a plugin.
# For now, we'll lint 'noctua' and submodules directly.
# The dynamic attributes on `noctua.devices` itself will likely cause `no-member` errors.
# You might need to lint `noctua.devices.__init__.py` with specific disables or a custom plugin.

# For SQLAlchemy in your dependencies, if you use it and get no-member errors:
# ignored-classes=sqlalchemy.orm.scoping.scoped_session,sqlalchemy.sql.schema.Table
# contextmanager-decorators=contextlib.contextmanager,sqlalchemy.orm.scoping.scoped_session.remove

[FORMAT]
max-line-length=120
+4 −3
Original line number Diff line number Diff line
@@ -166,7 +166,8 @@ class Telescope(OpenTSI):

    @tracking.setter
    def tracking(self, b):
        '''(Re)Start/Stop tracking of telescope in function of currently configured target'''
        '''(Re)Start/Stop tracking of telescope in function of currently
           configured target'''
        '''  1 slew to currently configured target and start tracking'''
        '''  0 stop tracking'''
        message = "POINTING.TRACK"
+64 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ noctua-sequencer = "noctua.sequencer:cli"

[tool.setuptools.packages.find]
where = ["."]  # list of folders that contain the packages (["."] by default)
include = ["noctua"]  # package names should match these glob patterns (["*"] by default)
include = ["noctua", "tests"]  # package names should match these glob patterns (["*"] by default)
exclude = []  # exclude packages matching these glob patterns (empty by default)
namespaces = false  # to disable scanning PEP 420 namespaces (true by default)

@@ -52,3 +52,66 @@ noctua = [
    "config/devices.ini",
    "defaults/*json"
]

[tool.isort]
known_templates = "templates" # This should be 'noctua.templates' if
                              # templates is a sub-package or just
                              # 'templates' if it's a top-level dir
                              # you're linting directly.  Given your
                              # project structure, 'noctua.templates'
                              # is more accurate if you run isort on
                              # the 'noctua' package.  Let's adjust
                              # for running on 'noctua' package:
                              
known_first_party = "noctua" # Helps isort identify 'noctua' as first-party
import_heading_stdlib = "System modules"
import_heading_thirdparty = "Third-party modules"
import_heading_firstparty = "Custom modules" # 'noctua' and its subpackages
import_heading_localfolder = "Other templates"

# This was 'import_heading_templates'.  For isort, LOCALFOLDER is for
# relative imports like 'from . import foo' The 'templates' specific
# heading is unusual for standard isort sections.  Let's map your
# 'Other templates' to how isort handles it.  If 'templates' are truly
# separate from 'noctua' (firstparty), they might need a different
# 'known_' type.  Given 'from templates.basetemplate import ...'  this
# implies 'templates' is a top-level import path or a special case.
# For now, assuming 'Other templates' are relative imports within a
# module, or you want a custom section header.

sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"

# Removed TEMPLATES as it's not standard.  If 'Other templates' are
# from e.g. `noctua.templates.something`, they'd fall under
# FIRSTPARTY.  If they are `from . import foo` they are LOCALFOLDER.
# Let's assume for now that "Other templates" are from
# `noctua.templates` which `known_first_party = "noctua"` should
# cover.  We'll keep the custom heading if that's the intent.

# If you want to enforce the "Other templates" heading specifically
# for imports from `noctua.templates`, you might need to list
# `noctua.templates` in `known_other_templates` (custom known type)
# and add `OTHER_TEMPLATES` to your sections, then map the heading.
# Example for more specific control: known_other_templates =
# "noctua.templates" sections =
# "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,OTHER_TEMPLATES,LOCALFOLDER"
# import_heading_other_templates = "Other templates"

# Simpler approach assuming 'Other templates' are from 'noctua.templates':
# known_first_party = "noctua"
# sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
# import_heading_stdlib = "System modules"
# import_heading_thirdparty = "Third-party modules"
# import_heading_firstparty = "Custom modules"
# import_heading_localfolder = "Local (relative) imports" # isort default for LOCALFOLDER

# Let's try to achieve your desired heading for templates, assuming
# they are first-party.  We'll make 'templates' a specific first-party
# section.

known_noctua = "noctua"
known_templates_pkg = "noctua.templates" # Treat imports from here specifically
sections = "FUTURE,STDLIB,THIRDPARTY,NOCTUA,TEMPLATES_PKG,LOCALFOLDER"
import_heading_noctua = "Custom modules (Noctua Core)"
import_heading_templates_pkg = "Other templates (from noctua.templates)"
# Default headings for others will be used unless specified.