Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Consider creating a semver package #169

Copy link
Copy link
Closed
@tomschr

Description

@tomschr
Issue body actions

Definitions

  • Module
    A module is a file containing Python definitions and statements.
  • Package
    A package is a collection of modules in directories that give a package hierarchy.

Situation

The current semver.py module contains almost 800 lines of code. As new functionality is added, the files grows bigger and bigger.

Suggested Solution

Should we consider to refactor the semver module into a package?

If yes, this is a feature which we should introduce for the upcoming 3.0.0 release. Could we label that in GitHub as such (or create a milestone)? 😉

Maybe we should also consider to refactor our test cases too and move them to a tests/ directory and create different files? They are currently almost 700 lines of code.

That issue involves the following actions:

  • refactor semver module into package
  • Probably introduce a tests/ directory?
semver/
├── __main__.py  # basically imports semver.cli.main and runs main()
├── __init__.py  # should contain only the usual constants like __version__, __author__ etc.
├── cli.py       # implements the command line interface
└── [... probably more files ...]

An example (although a bit outdated now as new commits arrived in master) can be viewed in
my fork). It's not perfect, but a start.

Pros

  • Make files smaller and more readable
  • No API change to the user
  • Easier to add more functionality
  • With __main__.py, it is possible to use python -m semver -h

Cons

  • More files means also, to search where a function is defined
  • Slightly more difficult to test as it may be needed to run tox first or create a virtual environment.

What do you think? 😉

Metadata

Metadata

Assignees

Labels

Release_3.x.yOnly for the major release 3Only for the major release 3

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.