Skip to main content

Questions tagged [import]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
149 views

Best practice when declaring imports with different execution contexts in python?

Say I have a Python project that looks like this: project/ ├── package/ │ ├── __init__.py │ ├── module1.py └── main.py I would like package/ to be self-contained, though it is called from main.py....
Leftover Salad's user avatar
-1 votes
2 answers
112 views

Should uniqueness validation be on the database level or backend codebase level in data import

There is a kinda ETL task of importing data from csv to the database in project with legacy codebase and legacy database**. Data should be validated before persisting to database. Validation includes ...
Rui's user avatar
  • 1,909
0 votes
1 answer
167 views

Is it bad practice to export all the names from one module both as named exports and as a default export?

I like to export the names in my modules both as individual named exports and grouped together in a default export. Like this: // mod.js export function f() {} export const x = true export default {f,...
Blue Nebula's user avatar
0 votes
1 answer
514 views

What's the best way to import a python module in a python module without cluttering the modules namepace? [closed]

Let's say I am writing a python module module.py. Which provides functionalities for other parts of my code. Of course, the module has to import other modules. A simple example: import abc as _abc ...
HerpDerpington's user avatar
0 votes
5 answers
633 views

Why don't languages auto import everything?

Why is there a such thing as import in programming languages? If a package does not exist, then trying to import it would cause an error anyway. So why don't languages just auto import ALL available ...
user1345541's user avatar
0 votes
1 answer
818 views

How to use lazy import to speed up a list of known types in python? [closed]

I have an application in which the user can describe an analysis job via a yaml like analysis: learner: name: LinearRegression args: solver: liblinear and then it is parsed to ...
mmdanziger's user avatar
0 votes
1 answer
86 views

Better design for a REST import into web store

I have an import that needs to grab data from a REST service and import into an web store. It's basically an ETL type of service, but because the REST service can be slow and I don't want to call it ...
user204588's user avatar
0 votes
2 answers
107 views

Transferring data from 1 web app into another offline

I have a web app that will be used locally on 2 different site. The program is a Vue web app made with node.js and express, using MySQL database. Due to limitation (no internet in site 1), there is no ...
Aditya D.'s user avatar
1 vote
1 answer
450 views

Python Unit Tests Mocking Imports - Removing Dependencies for CI/CD

I have a project written in python that I would like to create unit tests on. This project has a dependency on a database project which is a sort of abstraction layer to data connections. The issue ...
Simon Nicholls's user avatar
-1 votes
1 answer
2k views

Python dynamically import modules

I am trying to find the best practice for importing modules dynamically. I have multiple files in a specific folder called providers which contain a class Updater and all of them have the same objects....
bkbilly's user avatar
  • 131
3 votes
1 answer
1k views

Strictly only importing modules in subdirectories: is this a good rule?

I'm making my 1st official project. It's written in Python, is open-sources, and I'd like people to be able to freely and easily fork and modify the code. The project name is "shelf" and the ...
ChocolateOverflow's user avatar
1 vote
1 answer
227 views

Component based architectures in JS / PHP: what indicators suggest that a UI element ought to be written as an importable component?

N.B. Several months after initially asking this question (and not coming up with any satisfactory answers) I am now learning to use HTML Custom Elements / WebComponents. It seems the same question ...
Rounin's user avatar
  • 285
5 votes
1 answer
709 views

Are legacy C# DataTable/SqlDataAdapters exponentially faster than SqlConnection/SqlCommand and/or LINQ to SQL DataContext.ExecuteCommand calls? [closed]

I can't believe DataTable/SqlDataAdapter massively beat out System.Data.Linq.DataContext.ExecuteCommand and ExecuteNonQuery (tried with both Stored Procedures and command text) and just straight ...
Terry's user avatar
  • 159
1 vote
0 answers
48 views

How to develop an Import/Export Functionality for my node application

I have a configuration application in Nodejs. It has a Component with name and uuid. A Component can have many Schemas. A Schema has a uuid, name, componentId, json. A Schema can have many ...
Ahmed Nawaz Khan's user avatar
-2 votes
1 answer
298 views

Store line numbers of CSV in the database

In our environment, we often have to import CSV files into a database, where each line represents a record. Though there is no actual business use case for storing the original line numbers inside the ...
Eugene Lycenok's user avatar
7 votes
2 answers
2k views

Why is it necessary to "import" a library first before usage?

My question regards the use of import statements. In most programming languages I've come across (e.g. Python, Scala, Go), it is necessary to first import a library before you can use its functions. ...
NieuweNils's user avatar
7 votes
2 answers
3k views

Why should imports be made at the beginning

Why is it considered good style to do all imports in a python application at the beginning, even if what is imported is used only once? I have been programming only shorter pieces of software for a ...
l7ll7's user avatar
  • 263
6 votes
2 answers
7k views

Is importing wildcards a bad idea?

If I do this import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; Then why don't I do this, it's more convenient ...
Niklas Rosencrantz's user avatar
7 votes
3 answers
2k views

System Design: Very Large CSV Imports Every Month

We have a webapp that will rely on large CSVs from external vendors every month. When I say large, we are looking at around 6gb so a few million rows. Probably, 2-5 CSVs. This webapp will also allow ...
user2370642's user avatar
2 votes
1 answer
261 views

Maintainable way for keeping objects in memory

I am trying to figure out the best way to keep objects in memory without having them scattered everywhere within the code. For example: I have a PyQT menu system which interacts with objects. ...
e15purple's user avatar
1 vote
2 answers
2k views

Best way to import a large module to use in different modules

I have a python module dataProcessor.py which initialises a large amount of data into memory (approximately 3GB) I want to use this module in different processes which are running simultaneously. ...
Harwee's user avatar
  • 169
4 votes
5 answers
10k views

Import large csv files

I've been tasked to query 2 large csv files which are roughly 1 GB in size each. The files contain related data, so file one may contain a list of order numbers, Order Dates, etc and the file may ...
Rhodes73's user avatar
1 vote
2 answers
218 views

How can I include common strings (regexes) in several projects written in different languages?

I have a simple Go library (~300 lines, mostly type declarations and nice methods and compatibility methods for gomobile etc., also pretty-printing scripts). The heart of the whole project are two ...
Mika Feiler's user avatar
3 votes
1 answer
84 views

Interactive review of data in modal before inserting in db

I'm looking for a conceptual approach to a problem. I'm building a web app that imports data from a source I don't control. The data quality is pretty high, but occasionally, the data does not make ...
globalSchmidt's user avatar
1 vote
1 answer
4k views

Should I automatically install needed modules?

I'm writing a program for my grandpa. Occasionally an update will require a new module that's not installed on his computer. I don't want to have to manually install new modules every time, but he's ...
spelchekr's user avatar
  • 123
0 votes
1 answer
147 views

Recurring database migration

I'm importing data from older website to new one using database migrations. I have created first as one of first steps of development phase of new site. Then I planned to create another one, that will ...
trejder's user avatar
  • 2,406
3 votes
0 answers
598 views

Optimal data structure for binary data/Java

I have several input formats mostly restricted to geotiff and some proprietary binary formats. I import them into my program and then need to export them into various other data formats (also binary) ...
user avatar
1 vote
0 answers
86 views

Help design this data import program

I want to import some data from various locations and pump it into MongoDb and some cloud services. The data starts off as JSON, I read that JSON, create some objects in mongo, go to the next level ...
iwayneo's user avatar
  • 195
0 votes
1 answer
88 views

Plugins and exporting an API between python scripts

I've got a python script, which should read a subdirectory and make all the scripts within it callable like this: python mainscript.py subscript arguments I've figured out most of the details but I'm ...
mechalynx's user avatar
  • 152
3 votes
3 answers
2k views

Python - defining exit method before importing

This breaks nothing (in my experience), but lots of things "don't break anything" and are still wrong. #! /usr/bin/env python """Short description of this module.""" def preferred_exit_method(*args):...
user avatar
0 votes
1 answer
82 views

Is it okay to check in changes to import statement on opensource projects on a commit? [duplicate]

There are some guidelines out there (eg scala guidelines) and I'm wondering if it's okay to do some tidying up when committing other changes or if the commits should be more focused and to the point? ...
JasonG's user avatar
  • 1,129
3 votes
1 answer
942 views

Using naming conventions to make `import *` safer in Python

Consider the following code: a.py import os def print_rand(): print os.urandom() And another module: b.py from a import * In this code, I end up with an os variable getting imported from a. ...
jpmc26's user avatar
  • 5,469
8 votes
4 answers
4k views

When to import names into the global namespace? (using x::y, from x import y etc.)

I've been programming in various languages for about 10 years now. And I still haven't figured out when it is a good idea to import something into the global namespace (using x::y in C++, from x ...
futlib's user avatar
  • 2,185
-1 votes
2 answers
395 views

Ideal "intermediate" file format to use for structured/styled text? [closed]

I have files that I want to make available in an variety of formats: HTML PDF EPUB Plain Text (maybe) Most of the files will be sourced in doc, docx, or rtf format, so that needs to be considered. ...
Jordan Reiter's user avatar
41 votes
3 answers
5k views

Experience of Python's “PEP-302 New Import Hooks” [closed]

I'm one of the developers of Ruby (CRuby). We are working on Ruby 2.0 release (planned to release 2012/Feb). Python has "PEP302: New Import Hooks" (2003): This PEP proposes to add a new set of ...
Koichi Sasada's user avatar
5 votes
2 answers
2k views

Development Patterns for dealing with Data Import / Export

I have a ASP.NET web based application that allows the end user to export data to a flat file format. (essentially taking a point-in-time backup of their work) At a later date they can re-upload (...
Eoin Campbell's user avatar
0 votes
2 answers
785 views

Script/tool to import series of snapshots, each being a new edition, into GIT, populating source tree? [closed]

I've developed code locally and taken a fairly regular snapshot whenever I reach a significant point in development, e.g. a working build. So I have a long-ish list of about 40 folders, each folder ...
therobyouknow's user avatar